1 /***********************************************************
2 * Artsoft Retro-Game Library *
3 *----------------------------------------------------------*
4 * (c) 1994-2006 Artsoft Entertainment *
6 * Detmolder Strasse 189 *
9 * e-mail: info@artsoft.org *
10 *----------------------------------------------------------*
12 ***********************************************************/
21 /* ========================================================================= */
23 /* ========================================================================= */
25 #if defined(TARGET_X11_NATIVE_PERFORMANCE_WORKAROUND)
26 static GC font_clip_gc = None;
28 static void InitFontClipmasks()
30 XGCValues clip_gc_values;
31 unsigned int clip_gc_valuemask;
35 /* This stuff is needed because X11 (XSetClipOrigin(), to be precise) is
36 often very slow when preparing a masked XCopyArea() for big Pixmaps.
37 To prevent this, create small (tile-sized) mask Pixmaps which will then
38 be set much faster with XSetClipOrigin() and speed things up a lot. */
40 clip_gc_values.graphics_exposures = False;
41 clip_gc_valuemask = GCGraphicsExposures;
42 font_clip_gc = XCreateGC(display, window->drawable,
43 clip_gc_valuemask, &clip_gc_values);
45 /* create graphic context structures needed for clipping */
46 clip_gc_values.graphics_exposures = False;
47 clip_gc_valuemask = GCGraphicsExposures;
48 copy_clipmask_gc = XCreateGC(display,
49 gfx.font_bitmap_info[0].bitmap->clip_mask,
50 clip_gc_valuemask, &clip_gc_values);
52 /* create only those clipping Pixmaps we really need */
53 for (i = 0; i < gfx.num_fonts; i++)
55 if (gfx.font_bitmap_info[i].bitmap == NULL)
58 gfx.font_bitmap_info[i].clip_mask =
59 checked_calloc(gfx.font_bitmap_info[i].num_chars * sizeof(Pixmap));
61 for (j = 0; j < gfx.font_bitmap_info[i].num_chars; j++)
63 Bitmap *src_bitmap = gfx.font_bitmap_info[i].bitmap;
64 Pixmap src_pixmap = src_bitmap->clip_mask;
65 int xpos = j % gfx.font_bitmap_info[i].num_chars_per_line;
66 int ypos = j / gfx.font_bitmap_info[i].num_chars_per_line;
67 int width = gfx.font_bitmap_info[i].width;
68 int height = gfx.font_bitmap_info[i].height;
69 int src_x = gfx.font_bitmap_info[i].src_x + xpos * width;
70 int src_y = gfx.font_bitmap_info[i].src_y + ypos * height;
72 gfx.font_bitmap_info[i].clip_mask[j] =
73 XCreatePixmap(display, window->drawable, width, height, 1);
75 XCopyArea(display, src_pixmap, gfx.font_bitmap_info[i].clip_mask[j],
76 copy_clipmask_gc, src_x, src_y, width, height, 0, 0);
80 XFreeGC(display, copy_clipmask_gc);
83 static void FreeFontClipmasks()
87 if (gfx.num_fonts == 0 || gfx.font_bitmap_info[0].bitmap == NULL)
90 for (i = 0; i < gfx.num_fonts; i++)
92 if (gfx.font_bitmap_info[i].clip_mask)
94 for (j = 0; j < gfx.font_bitmap_info[i].num_chars; j++)
95 XFreePixmap(display, gfx.font_bitmap_info[i].clip_mask[j]);
96 free(gfx.font_bitmap_info[i].clip_mask);
99 gfx.font_bitmap_info[i].clip_mask = NULL;
100 gfx.font_bitmap_info[i].num_chars = 0;
104 XFreeGC(display, font_clip_gc);
107 #endif /* TARGET_X11_NATIVE_PERFORMANCE_WORKAROUND */
109 void InitFontInfo(struct FontBitmapInfo *font_bitmap_info, int num_fonts,
110 int (*select_font_function)(int),
111 int (*get_font_from_token_function)(char *))
113 gfx.num_fonts = num_fonts;
114 gfx.font_bitmap_info = font_bitmap_info;
115 gfx.select_font_function = select_font_function;
116 gfx.get_font_from_token_function = get_font_from_token_function;
118 #if defined(TARGET_X11_NATIVE_PERFORMANCE_WORKAROUND)
123 void FreeFontInfo(struct FontBitmapInfo *font_bitmap_info)
125 if (font_bitmap_info == NULL)
128 #if defined(TARGET_X11_NATIVE_PERFORMANCE_WORKAROUND)
132 free(font_bitmap_info);
135 struct FontBitmapInfo *getFontBitmapInfo(int font_nr)
137 int font_bitmap_id = gfx.select_font_function(font_nr);
139 return &gfx.font_bitmap_info[font_bitmap_id];
142 int getFontWidth(int font_nr)
144 int font_bitmap_id = gfx.select_font_function(font_nr);
146 return gfx.font_bitmap_info[font_bitmap_id].width;
149 int getFontHeight(int font_nr)
151 int font_bitmap_id = gfx.select_font_function(font_nr);
153 return gfx.font_bitmap_info[font_bitmap_id].height;
156 int getTextWidth(char *text, int font_nr)
158 return (text != NULL ? strlen(text) * getFontWidth(font_nr) : 0);
161 static int getFontCharPosition(int font_nr, char c)
163 int font_bitmap_id = gfx.select_font_function(font_nr);
164 struct FontBitmapInfo *font = &gfx.font_bitmap_info[font_bitmap_id];
165 boolean default_font = (font->num_chars == DEFAULT_NUM_CHARS_PER_FONT);
166 int font_pos = (unsigned char)c - 32;
168 /* map some special characters to their ascii values in default font */
170 font_pos = MAP_FONT_ASCII(c) - 32;
172 /* this allows dynamic special characters together with special font */
173 if (font_pos < 0 || font_pos >= font->num_chars)
179 void getFontCharSource(int font_nr, char c, Bitmap **bitmap, int *x, int *y)
181 int font_bitmap_id = gfx.select_font_function(font_nr);
182 struct FontBitmapInfo *font = &gfx.font_bitmap_info[font_bitmap_id];
183 int font_pos = getFontCharPosition(font_nr, c);
185 *bitmap = font->bitmap;
186 *x = font->src_x + (font_pos % font->num_chars_per_line) * font->width;
187 *y = font->src_y + (font_pos / font->num_chars_per_line) * font->height;
191 /* ========================================================================= */
192 /* text string helper functions */
193 /* ========================================================================= */
195 int maxWordLengthInString(char *text)
198 int max_word_len = 0;
200 for (text_ptr = text; *text_ptr; text_ptr++)
201 max_word_len = (*text_ptr != ' ' ? max_word_len + 1 : 0);
207 /* ========================================================================= */
208 /* simple text drawing functions */
209 /* ========================================================================= */
211 void DrawInitTextExt(char *text, int ypos, int font_nr, boolean force)
213 static unsigned int progress_delay = 0;
214 unsigned int progress_delay_value = 100; /* (in milliseconds) */
218 if (!force && !DelayReached(&progress_delay, progress_delay_value))
221 if (window != NULL &&
222 gfx.draw_init_text &&
224 gfx.font_bitmap_info[font_nr].bitmap != NULL)
226 int x = (video.width - getTextWidth(text, font_nr)) / 2;
228 int width = video.width;
229 int height = getFontHeight(font_nr);
231 ClearRectangle(drawto, 0, y, width, height);
232 DrawTextExt(drawto, x, y, text, font_nr, BLIT_OPAQUE);
234 /* this makes things significantly faster than directly drawing to window */
235 BlitBitmap(drawto, window, 0, y, width, height, 0, y);
239 void DrawInitText(char *text, int ypos, int font_nr)
241 DrawInitTextExt(text, ypos, font_nr, TRUE);
244 void DrawInitTextIfNeeded(char *text, int ypos, int font_nr)
246 DrawInitTextExt(text, ypos, font_nr, FALSE);
249 void DrawTextF(int x, int y, int font_nr, char *format, ...)
251 char buffer[MAX_OUTPUT_LINESIZE + 1];
254 va_start(ap, format);
255 vsprintf(buffer, format, ap);
258 if (strlen(buffer) > MAX_OUTPUT_LINESIZE)
259 Error(ERR_EXIT, "string too long in DrawTextF() -- aborting");
261 DrawText(gfx.sx + x, gfx.sy + y, buffer, font_nr);
264 void DrawTextFCentered(int y, int font_nr, char *format, ...)
266 char buffer[MAX_OUTPUT_LINESIZE + 1];
269 va_start(ap, format);
270 vsprintf(buffer, format, ap);
273 if (strlen(buffer) > MAX_OUTPUT_LINESIZE)
274 Error(ERR_EXIT, "string too long in DrawTextFCentered() -- aborting");
276 DrawText(gfx.sx + (gfx.sxsize - getTextWidth(buffer, font_nr)) / 2,
277 gfx.sy + y, buffer, font_nr);
280 void DrawTextS(int x, int y, int font_nr, char *text)
282 DrawText(gfx.sx + x, gfx.sy + y, text, font_nr);
285 void DrawTextSCentered(int y, int font_nr, char *text)
287 DrawText(gfx.sx + (gfx.sxsize - getTextWidth(text, font_nr)) / 2,
288 gfx.sy + y, text, font_nr);
291 void DrawTextCentered(int y, int font_nr, char *text)
293 DrawText((gfx.sxsize - getTextWidth(text, font_nr)) / 2, y, text, font_nr);
296 void DrawTextSAligned(int x, int y, char *text, int font_nr, int align)
298 DrawText(gfx.sx + ALIGNED_XPOS(x, getTextWidth(text, font_nr), align),
299 gfx.sx + y, text, font_nr);
302 void DrawTextAligned(int x, int y, char *text, int font_nr, int align)
304 DrawText(ALIGNED_XPOS(x, getTextWidth(text, font_nr), align),
308 void DrawText(int x, int y, char *text, int font_nr)
310 int mask_mode = BLIT_OPAQUE;
312 if (DrawingOnBackground(x, y))
313 mask_mode = BLIT_ON_BACKGROUND;
315 DrawTextExt(drawto, x, y, text, font_nr, mask_mode);
318 redraw_mask |= REDRAW_FIELD;
319 else if (y < gfx.vy || gfx.vy == 0)
320 redraw_mask |= REDRAW_DOOR_1;
323 void DrawTextExt(DrawBuffer *dst_bitmap, int dst_x, int dst_y, char *text,
324 int font_nr, int mask_mode)
327 struct FontBitmapInfo *font = getFontBitmapInfo(font_nr);
329 int font_bitmap_id = gfx.select_font_function(font_nr);
330 struct FontBitmapInfo *font = &gfx.font_bitmap_info[font_bitmap_id];
332 int font_width = getFontWidth(font_nr);
333 int font_height = getFontHeight(font_nr);
335 int border_1 = gfx.sx + gfx.sxsize;
336 int border_2 = gfx.dx + gfx.dxsize;
337 int dst_x_start = dst_x;
341 char *text_ptr = text;
343 if (font->bitmap == NULL)
346 /* skip text to be printed outside the window (left/right will be clipped) */
347 if (dst_y < 0 || dst_y + font_height > video.height)
350 /* add offset for drawing font characters */
351 dst_x += font->draw_xoffset;
352 dst_y += font->draw_yoffset;
356 char c = *text_ptr++;
359 c = ' '; /* print space instead of newline */
361 getFontCharSource(font_nr, c, &src_bitmap, &src_x, &src_y);
363 /* clip text at the left side of the window */
371 /* clip text at the right side of the window */
373 if (dst_x + font_width > video.width)
376 /* (this does not work well when trying to print text to whole screen) */
377 if ((dst_x_start < border_1 && dst_x + font_width > border_1) ||
378 (dst_x_start < border_2 && dst_x + font_width > border_2))
382 if (mask_mode == BLIT_INVERSE) /* special mode for text gadgets */
384 /* first step: draw solid colored rectangle (use "cursor" character) */
385 if (strlen(text) == 1) /* only one char inverted => draw cursor */
387 Bitmap *cursor_bitmap;
388 int cursor_x, cursor_y;
390 getFontCharSource(font_nr, FONT_ASCII_CURSOR, &cursor_bitmap,
391 &cursor_x, &cursor_y);
393 BlitBitmap(cursor_bitmap, dst_bitmap, cursor_x, cursor_y,
394 font_width, font_height, dst_x, dst_y);
397 #if defined(TARGET_SDL)
398 /* second step: draw masked inverted character */
399 SDLCopyInverseMasked(src_bitmap, dst_bitmap, src_x, src_y,
400 font_width, font_height, dst_x, dst_y);
402 /* second step: draw masked black rectangle (use "space" character) */
403 SetClipOrigin(src_bitmap, src_bitmap->stored_clip_gc,
404 dst_x - src_x, dst_y - src_y);
405 BlitBitmapMasked(src_bitmap, dst_bitmap, 0, 0,
406 font_width, font_height, dst_x, dst_y);
409 else if (mask_mode == BLIT_MASKED || mask_mode == BLIT_ON_BACKGROUND)
411 if (mask_mode == BLIT_ON_BACKGROUND)
413 /* clear font character background */
414 ClearRectangleOnBackground(dst_bitmap, dst_x, dst_y,
415 font_width, font_height);
418 #if defined(TARGET_X11_NATIVE_PERFORMANCE_WORKAROUND)
419 /* use special font tile clipmasks */
421 int font_pos = getFontCharPosition(font_nr, c);
423 SetClipMask(src_bitmap, font_clip_gc, font->clip_mask[font_pos]);
424 SetClipOrigin(src_bitmap, font_clip_gc, dst_x, dst_y);
427 SetClipOrigin(src_bitmap, src_bitmap->stored_clip_gc,
428 dst_x - src_x, dst_y - src_y);
431 BlitBitmapMasked(src_bitmap, dst_bitmap, src_x, src_y,
432 font_width, font_height, dst_x, dst_y);
434 else /* normal, non-masked font blitting */
436 BlitBitmap(src_bitmap, dst_bitmap, src_x, src_y,
437 font_width, font_height, dst_x, dst_y);
445 /* ========================================================================= */
446 /* text buffer drawing functions */
447 /* ========================================================================= */
449 #define MAX_LINES_FROM_FILE 1024
451 char *GetTextBufferFromFile(char *filename, int max_lines)
457 if (filename == NULL)
460 if (!(file = fopen(filename, MODE_READ)))
463 buffer = checked_calloc(1); /* start with valid, but empty text buffer */
465 while (!feof(file) && num_lines < max_lines)
467 char line[MAX_LINE_LEN];
469 /* read next line of input file */
470 if (!fgets(line, MAX_LINE_LEN, file))
473 buffer = checked_realloc(buffer, strlen(buffer) + strlen(line) + 1);
475 strcat(buffer, line);
485 void DrawTextToTextArea_OLD(int x, int y, char *text, int font_nr, int line_length,
486 int area_xsize, int area_ysize, int mask_mode)
489 int font_height = getFontHeight(font_nr);
494 while (*text && area_line < area_ysize)
496 char buffer[MAX_OUTPUT_LINESIZE + 1];
499 for (i = 0; i < line_length && *text; i++)
500 if ((buffer[i] = *text++) == '\n')
502 buffer[MIN(i, area_xsize)] = '\0';
504 DrawTextExt(drawto, x, y + area_line * font_height, buffer, font_nr,
510 redraw_mask |= REDRAW_FIELD;
513 static boolean RenderLineToBuffer(char **src_buffer_ptr, char *dst_buffer,
514 int *dst_buffer_len, int line_length,
515 boolean last_line_was_empty)
517 char *text_ptr = *src_buffer_ptr;
518 char *buffer = dst_buffer;
519 int buffer_len = *dst_buffer_len;
520 boolean buffer_filled = FALSE;
527 /* skip leading whitespaces */
528 while (*text_ptr == ' ' || *text_ptr == '\t')
534 /* look for end of next word */
535 while (*word_ptr != ' ' && *word_ptr != '\t' && *word_ptr != '\0')
545 else if (*text_ptr == '\n') /* special case: force empty line */
550 /* prevent printing of multiple empty lines */
551 if (buffer_len > 0 || !last_line_was_empty)
552 buffer_filled = TRUE;
554 else if (word_len < line_length - buffer_len)
556 /* word fits into text buffer -- add word */
559 buffer[buffer_len++] = ' ';
561 strncpy(&buffer[buffer_len], text_ptr, word_len);
562 buffer_len += word_len;
563 buffer[buffer_len] = '\0';
564 text_ptr += word_len;
566 else if (buffer_len > 0)
568 /* not enough space left for word in text buffer -- print buffer */
570 buffer_filled = TRUE;
574 /* word does not fit at all into empty text buffer -- cut word */
576 strncpy(buffer, text_ptr, line_length);
577 buffer[line_length] = '\0';
578 text_ptr += line_length;
579 buffer_filled = TRUE;
586 *src_buffer_ptr = text_ptr;
587 *dst_buffer_len = buffer_len;
589 return buffer_filled;
593 void DrawTextWrapped_OLD(int x, int y, char *text, int font_nr, int line_length,
596 char *text_ptr = text;
597 int current_line = 0;
598 int font_height = getFontHeight(font_nr);
600 while (*text_ptr && current_line < max_lines)
602 char buffer[line_length + 1];
607 RenderLineToBuffer(&text_ptr, buffer, &buffer_len, line_length, TRUE);
609 DrawText(x, y + current_line * font_height, buffer, font_nr);
616 int DrawTextFromFile_OLD(int x, int y, char *filename, int font_nr,
617 int line_length, int max_lines, boolean wrap_text)
619 int font_height = getFontHeight(font_nr);
620 char line[MAX_LINE_LEN];
621 char buffer[line_length + 1];
623 int current_line = 0;
626 if (current_line >= max_lines)
629 if (filename == NULL)
632 if (!(file = fopen(filename, MODE_READ)))
638 while (!feof(file) && current_line < max_lines)
641 boolean last_line_was_empty = TRUE;
643 /* read next line of input file */
644 if (!fgets(line, MAX_LINE_LEN, file))
647 /* skip comments (lines directly beginning with '#') */
651 /* cut trailing newline from input line */
652 for (line_ptr = line; *line_ptr; line_ptr++)
654 if (*line_ptr == '\n' || *line_ptr == '\r')
661 if (strlen(line) == 0) /* special case: force empty line */
666 while (*line_ptr && current_line < max_lines)
669 boolean buffer_filled;
673 buffer_filled = RenderLineToBuffer(&line_ptr, buffer, &buffer_len,
674 line_length, last_line_was_empty);
678 if (strlen(line_ptr) <= line_length)
680 buffer_len = strlen(line_ptr);
681 strcpy(buffer, line_ptr);
685 buffer_len = line_length;
686 strncpy(buffer, line_ptr, line_length);
689 buffer[buffer_len] = '\0';
690 line_ptr += buffer_len;
692 buffer_filled = TRUE;
695 boolean buffer_filled = RenderLineToBuffer(&line_ptr, buffer, &buffer_len,
696 line_length, last_line_was_empty);
701 DrawText(x, y + current_line * font_height, buffer, font_nr);
704 last_line_was_empty = (buffer_len == 0);
714 if (buffer_len > 0 && current_line < max_lines)
716 DrawText(x, y + current_line * font_height, buffer, font_nr);
724 static boolean getCheckedTokenValueFromString(char *string, char **token,
729 if (!getTokenValueFromString(string, token, value))
732 if (**token != '.') /* token should begin with dot */
735 for (ptr = *token; *ptr; ptr++) /* token should contain no whitespace */
736 if (*ptr == ' ' || *ptr == '\t')
739 for (ptr = *value; *ptr; ptr++) /* value should contain no whitespace */
740 if (*ptr == ' ' || *ptr == '\t')
746 static void DrawTextBuffer_Flush(int x, int y, char *buffer, int font_nr,
747 int line_length, int cut_length,
748 int line_spacing, int mask_mode,
749 boolean centered, int current_line)
751 int buffer_len = strlen(buffer);
752 int font_width = getFontWidth(font_nr);
753 int font_height = getFontHeight(font_nr);
754 int offset_chars = (centered ? (line_length - buffer_len) / 2 : 0);
756 (centered ? font_width * (line_length - buffer_len) / 2 : 0);
757 int final_cut_length = MAX(0, cut_length - offset_chars);
758 int xx = x + offset_xsize;
759 int yy = y + current_line * (font_height + line_spacing);
761 buffer[final_cut_length] = '\0';
764 DrawTextExt(drawto, xx, yy, buffer, font_nr, mask_mode);
766 DrawText(xx, yy, buffer, font_nr);
769 int DrawTextBuffer(int x, int y, char *text_buffer, int font_nr,
770 int line_length, int cut_length, int max_lines,
771 int line_spacing, int mask_mode, boolean autowrap,
772 boolean centered, boolean parse_comments)
775 int font_width = getFontWidth(font_nr);
776 int font_height = getFontHeight(font_nr);
778 char buffer[line_length + 1];
780 int current_line = 0;
782 if (text_buffer == NULL || *text_buffer == '\0')
785 if (current_line >= max_lines)
788 if (cut_length == -1)
789 cut_length = line_length;
794 while (*text_buffer && current_line < max_lines)
796 char line[MAX_LINE_LEN + 1];
798 boolean last_line_was_empty = TRUE;
800 int num_line_chars = MAX_LINE_LEN;
802 int num_line_chars = (autowrap ? MAX_LINE_LEN : line_length);
806 /* copy next line from text buffer to line buffer (nearly fgets() style) */
807 for (i = 0; i < num_line_chars && *text_buffer; i++)
808 if ((line[i] = *text_buffer++) == '\n')
812 /* prevent 'num_line_chars' sized lines to cause additional empty line */
813 if (i == num_line_chars && *text_buffer == '\n')
816 /* skip comments (lines directly beginning with '#') */
817 if (line[0] == '#' && parse_comments)
821 /* try to read generic token/value pair definition after comment sign */
822 if (getCheckedTokenValueFromString(line + 1, &token, &value))
824 /* if found, flush the current buffer, if non-empty */
825 if (buffer_len > 0 && current_line < max_lines)
827 DrawTextBuffer_Flush(x, y, buffer, font_nr, line_length, cut_length,
828 line_spacing, mask_mode, centered, current_line);
836 if (strEqual(token, ".font"))
837 font_nr = gfx.get_font_from_token_function(value);
838 else if (strEqual(token, ".autowrap"))
839 autowrap = get_boolean_from_string(value);
840 else if (strEqual(token, ".centered"))
841 centered = get_boolean_from_string(value);
842 else if (strEqual(token, ".parse_comments"))
843 parse_comments = get_boolean_from_string(value);
849 /* cut trailing newline and carriage return from input line */
850 for (line_ptr = line; *line_ptr; line_ptr++)
852 if (*line_ptr == '\n' || *line_ptr == '\r')
859 if (strlen(line) == 0) /* special case: force empty line */
864 while (*line_ptr && current_line < max_lines)
866 boolean buffer_filled;
870 buffer_filled = RenderLineToBuffer(&line_ptr, buffer, &buffer_len,
871 line_length, last_line_was_empty);
875 if (strlen(line_ptr) <= line_length)
877 buffer_len = strlen(line_ptr);
878 strcpy(buffer, line_ptr);
882 buffer_len = line_length;
883 strncpy(buffer, line_ptr, line_length);
886 buffer[buffer_len] = '\0';
887 line_ptr += buffer_len;
889 buffer_filled = TRUE;
895 DrawTextBuffer_Flush(x, y, buffer, font_nr, line_length, cut_length,
896 line_spacing, mask_mode, centered, current_line);
898 int offset_chars = (centered ? (line_length - buffer_len) / 2 : 0);
900 (centered ? font_width * (line_length - buffer_len) / 2 : 0);
901 int final_cut_length = MAX(0, cut_length - offset_chars);
902 int xx = x + offset_xsize;
904 buffer[final_cut_length] = '\0';
907 DrawTextExt(drawto, xx, y + current_line * font_height, buffer,
910 DrawText(xx, y + current_line * font_height, buffer, font_nr);
915 last_line_was_empty = (buffer_len == 0);
923 if (buffer_len > 0 && current_line < max_lines)
926 DrawTextBuffer_Flush(x, y, buffer, font_nr, line_length, cut_length,
927 line_spacing, mask_mode, centered, current_line);
929 int offset_chars = (centered ? (line_length - buffer_len) / 2 : 0);
931 (centered ? font_width * (line_length - buffer_len) / 2 : 0);
932 int final_cut_length = MAX(0, cut_length - offset_chars);
933 int xx = x + offset_xsize;
935 buffer[final_cut_length] = '\0';
938 DrawTextExt(drawto, xx, y + current_line * font_height, buffer,
941 DrawText(xx, y + current_line * font_height, buffer, font_nr);
950 int DrawTextFile(int x, int y, char *filename, int font_nr,
951 int line_length, int cut_length, int max_lines,
952 int line_spacing, int mask_mode, boolean autowrap,
953 boolean centered, boolean parse_comments)
955 char *text_buffer = GetTextBufferFromFile(filename, MAX_LINES_FROM_FILE);
956 int num_lines_printed = DrawTextBuffer(x, y, text_buffer, font_nr,
957 line_length, cut_length, max_lines,
958 line_spacing, mask_mode, autowrap,
959 centered, parse_comments);
960 checked_free(text_buffer);
962 return num_lines_printed;
966 void DrawTextWrapped(int x, int y, char *text, int font_nr, int line_length,
969 DrawTextBuffer(x, y, text, font_nr, line_length, -1, max_lines, -1, TRUE,
973 void DrawTextToTextArea(int x, int y, char *text, int font_nr, int line_length,
974 int cut_length, int max_lines, int mask_mode)
976 DrawTextBuffer(x, y, text, font_nr, line_length, cut_length, max_lines,
977 mask_mode, FALSE, FALSE, FALSE);