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 long 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 /* simple text drawing functions */
193 /* ========================================================================= */
195 void DrawInitTextExt(char *text, int ypos, int font_nr, boolean force)
197 static unsigned long progress_delay = 0;
198 unsigned long progress_delay_value = 100; /* (in milliseconds) */
202 if (!force && !DelayReached(&progress_delay, progress_delay_value))
205 if (window != NULL &&
207 gfx.font_bitmap_info[font_nr].bitmap != NULL)
209 int x = (video.width - getTextWidth(text, font_nr)) / 2;
211 int width = video.width;
212 int height = getFontHeight(font_nr);
214 ClearRectangle(drawto, 0, y, width, height);
215 DrawTextExt(drawto, x, y, text, font_nr, BLIT_OPAQUE);
217 /* this makes things significantly faster than directly drawing to window */
218 BlitBitmap(drawto, window, 0, y, width, height, 0, y);
222 void DrawInitText(char *text, int ypos, int font_nr)
224 DrawInitTextExt(text, ypos, font_nr, TRUE);
227 void DrawInitTextIfNeeded(char *text, int ypos, int font_nr)
229 DrawInitTextExt(text, ypos, font_nr, FALSE);
232 void DrawTextF(int x, int y, int font_nr, char *format, ...)
234 char buffer[MAX_OUTPUT_LINESIZE + 1];
237 va_start(ap, format);
238 vsprintf(buffer, format, ap);
241 if (strlen(buffer) > MAX_OUTPUT_LINESIZE)
242 Error(ERR_EXIT, "string too long in DrawTextF() -- aborting");
244 DrawText(gfx.sx + x, gfx.sy + y, buffer, font_nr);
247 void DrawTextFCentered(int y, int font_nr, char *format, ...)
249 char buffer[MAX_OUTPUT_LINESIZE + 1];
252 va_start(ap, format);
253 vsprintf(buffer, format, ap);
256 if (strlen(buffer) > MAX_OUTPUT_LINESIZE)
257 Error(ERR_EXIT, "string too long in DrawTextFCentered() -- aborting");
259 DrawText(gfx.sx + (gfx.sxsize - getTextWidth(buffer, font_nr)) / 2,
260 gfx.sy + y, buffer, font_nr);
263 void DrawTextS(int x, int y, int font_nr, char *text)
265 DrawText(gfx.sx + x, gfx.sy + y, text, font_nr);
268 void DrawTextSCentered(int y, int font_nr, char *text)
270 DrawText(gfx.sx + (gfx.sxsize - getTextWidth(text, font_nr)) / 2,
271 gfx.sy + y, text, font_nr);
274 void DrawTextCentered(int y, int font_nr, char *text)
276 DrawText((gfx.sxsize - getTextWidth(text, font_nr)) / 2, y, text, font_nr);
279 void DrawTextSAligned(int x, int y, char *text, int font_nr, int align)
281 DrawText(gfx.sx + ALIGNED_XPOS(x, getTextWidth(text, font_nr), align),
282 gfx.sx + y, text, font_nr);
285 void DrawTextAligned(int x, int y, char *text, int font_nr, int align)
287 DrawText(ALIGNED_XPOS(x, getTextWidth(text, font_nr), align),
291 void DrawText(int x, int y, char *text, int font_nr)
293 int mask_mode = BLIT_OPAQUE;
295 if (DrawingOnBackground(x, y))
296 mask_mode = BLIT_ON_BACKGROUND;
298 DrawTextExt(drawto, x, y, text, font_nr, mask_mode);
301 redraw_mask |= REDRAW_FIELD;
302 else if (y < gfx.vy || gfx.vy == 0)
303 redraw_mask |= REDRAW_DOOR_1;
306 void DrawTextExt(DrawBuffer *dst_bitmap, int dst_x, int dst_y, char *text,
307 int font_nr, int mask_mode)
310 struct FontBitmapInfo *font = getFontBitmapInfo(font_nr);
312 int font_bitmap_id = gfx.select_font_function(font_nr);
313 struct FontBitmapInfo *font = &gfx.font_bitmap_info[font_bitmap_id];
315 int font_width = getFontWidth(font_nr);
316 int font_height = getFontHeight(font_nr);
318 int border_1 = gfx.sx + gfx.sxsize;
319 int border_2 = gfx.dx + gfx.dxsize;
320 int dst_x_start = dst_x;
324 char *text_ptr = text;
326 if (font->bitmap == NULL)
329 /* skip text to be printed outside the window (left/right will be clipped) */
330 if (dst_y < 0 || dst_y + font_height > video.height)
333 /* add offset for drawing font characters */
334 dst_x += font->draw_xoffset;
335 dst_y += font->draw_yoffset;
339 char c = *text_ptr++;
342 c = ' '; /* print space instead of newline */
344 getFontCharSource(font_nr, c, &src_bitmap, &src_x, &src_y);
346 /* clip text at the left side of the window */
354 /* clip text at the right side of the window */
356 if (dst_x + font_width > video.width)
359 /* (this does not work well when trying to print text to whole screen) */
360 if ((dst_x_start < border_1 && dst_x + font_width > border_1) ||
361 (dst_x_start < border_2 && dst_x + font_width > border_2))
365 if (mask_mode == BLIT_INVERSE) /* special mode for text gadgets */
367 /* first step: draw solid colored rectangle (use "cursor" character) */
368 if (strlen(text) == 1) /* only one char inverted => draw cursor */
370 Bitmap *cursor_bitmap;
371 int cursor_x, cursor_y;
373 getFontCharSource(font_nr, FONT_ASCII_CURSOR, &cursor_bitmap,
374 &cursor_x, &cursor_y);
376 BlitBitmap(cursor_bitmap, dst_bitmap, cursor_x, cursor_y,
377 font_width, font_height, dst_x, dst_y);
380 #if defined(TARGET_SDL)
381 /* second step: draw masked inverted character */
382 SDLCopyInverseMasked(src_bitmap, dst_bitmap, src_x, src_y,
383 font_width, font_height, dst_x, dst_y);
385 /* second step: draw masked black rectangle (use "space" character) */
386 SetClipOrigin(src_bitmap, src_bitmap->stored_clip_gc,
387 dst_x - src_x, dst_y - src_y);
388 BlitBitmapMasked(src_bitmap, dst_bitmap, 0, 0,
389 font_width, font_height, dst_x, dst_y);
392 else if (mask_mode == BLIT_MASKED || mask_mode == BLIT_ON_BACKGROUND)
394 if (mask_mode == BLIT_ON_BACKGROUND)
396 /* clear font character background */
397 ClearRectangleOnBackground(dst_bitmap, dst_x, dst_y,
398 font_width, font_height);
401 #if defined(TARGET_X11_NATIVE_PERFORMANCE_WORKAROUND)
402 /* use special font tile clipmasks */
404 int font_pos = getFontCharPosition(font_nr, c);
406 SetClipMask(src_bitmap, font_clip_gc, font->clip_mask[font_pos]);
407 SetClipOrigin(src_bitmap, font_clip_gc, dst_x, dst_y);
410 SetClipOrigin(src_bitmap, src_bitmap->stored_clip_gc,
411 dst_x - src_x, dst_y - src_y);
414 BlitBitmapMasked(src_bitmap, dst_bitmap, src_x, src_y,
415 font_width, font_height, dst_x, dst_y);
417 else /* normal, non-masked font blitting */
419 BlitBitmap(src_bitmap, dst_bitmap, src_x, src_y,
420 font_width, font_height, dst_x, dst_y);
428 /* ========================================================================= */
429 /* text buffer drawing functions */
430 /* ========================================================================= */
432 #define MAX_LINES_FROM_FILE 1024
434 char *GetTextBufferFromFile(char *filename, int max_lines)
440 if (filename == NULL)
443 if (!(file = fopen(filename, MODE_READ)))
446 buffer = checked_calloc(1); /* start with valid, but empty text buffer */
448 while (!feof(file) && num_lines < max_lines)
450 char line[MAX_LINE_LEN];
452 /* read next line of input file */
453 if (!fgets(line, MAX_LINE_LEN, file))
456 buffer = checked_realloc(buffer, strlen(buffer) + strlen(line) + 1);
458 strcat(buffer, line);
468 void DrawTextToTextArea_OLD(int x, int y, char *text, int font_nr, int line_length,
469 int area_xsize, int area_ysize, int mask_mode)
472 int font_height = getFontHeight(font_nr);
477 while (*text && area_line < area_ysize)
479 char buffer[MAX_OUTPUT_LINESIZE + 1];
482 for (i = 0; i < line_length && *text; i++)
483 if ((buffer[i] = *text++) == '\n')
485 buffer[MIN(i, area_xsize)] = '\0';
487 DrawTextExt(drawto, x, y + area_line * font_height, buffer, font_nr,
493 redraw_mask |= REDRAW_FIELD;
496 static boolean RenderLineToBuffer(char **src_buffer_ptr, char *dst_buffer,
497 int *dst_buffer_len, int line_length,
498 boolean last_line_was_empty)
500 char *text_ptr = *src_buffer_ptr;
501 char *buffer = dst_buffer;
502 int buffer_len = *dst_buffer_len;
503 boolean buffer_filled = FALSE;
510 /* skip leading whitespaces */
511 while (*text_ptr == ' ' || *text_ptr == '\t')
517 /* look for end of next word */
518 while (*word_ptr != ' ' && *word_ptr != '\t' && *word_ptr != '\0')
528 else if (*text_ptr == '\n') /* special case: force empty line */
533 /* prevent printing of multiple empty lines */
534 if (buffer_len > 0 || !last_line_was_empty)
535 buffer_filled = TRUE;
537 else if (word_len < line_length - buffer_len)
539 /* word fits into text buffer -- add word */
542 buffer[buffer_len++] = ' ';
544 strncpy(&buffer[buffer_len], text_ptr, word_len);
545 buffer_len += word_len;
546 buffer[buffer_len] = '\0';
547 text_ptr += word_len;
549 else if (buffer_len > 0)
551 /* not enough space left for word in text buffer -- print buffer */
553 buffer_filled = TRUE;
557 /* word does not fit at all into empty text buffer -- cut word */
559 strncpy(buffer, text_ptr, line_length);
560 buffer[line_length] = '\0';
561 text_ptr += line_length;
562 buffer_filled = TRUE;
569 *src_buffer_ptr = text_ptr;
570 *dst_buffer_len = buffer_len;
572 return buffer_filled;
576 void DrawTextWrapped_OLD(int x, int y, char *text, int font_nr, int line_length,
579 char *text_ptr = text;
580 int current_line = 0;
581 int font_height = getFontHeight(font_nr);
583 while (*text_ptr && current_line < max_lines)
585 char buffer[line_length + 1];
590 RenderLineToBuffer(&text_ptr, buffer, &buffer_len, line_length, TRUE);
592 DrawText(x, y + current_line * font_height, buffer, font_nr);
599 int DrawTextFromFile_OLD(int x, int y, char *filename, int font_nr,
600 int line_length, int max_lines, boolean wrap_text)
602 int font_height = getFontHeight(font_nr);
603 char line[MAX_LINE_LEN];
604 char buffer[line_length + 1];
606 int current_line = 0;
609 if (current_line >= max_lines)
612 if (filename == NULL)
615 if (!(file = fopen(filename, MODE_READ)))
621 while (!feof(file) && current_line < max_lines)
624 boolean last_line_was_empty = TRUE;
626 /* read next line of input file */
627 if (!fgets(line, MAX_LINE_LEN, file))
630 /* skip comments (lines directly beginning with '#') */
634 /* cut trailing newline from input line */
635 for (line_ptr = line; *line_ptr; line_ptr++)
637 if (*line_ptr == '\n' || *line_ptr == '\r')
644 if (strlen(line) == 0) /* special case: force empty line */
649 while (*line_ptr && current_line < max_lines)
652 boolean buffer_filled;
656 buffer_filled = RenderLineToBuffer(&line_ptr, buffer, &buffer_len,
657 line_length, last_line_was_empty);
661 if (strlen(line_ptr) <= line_length)
663 buffer_len = strlen(line_ptr);
664 strcpy(buffer, line_ptr);
668 buffer_len = line_length;
669 strncpy(buffer, line_ptr, line_length);
672 buffer[buffer_len] = '\0';
673 line_ptr += buffer_len;
675 buffer_filled = TRUE;
678 boolean buffer_filled = RenderLineToBuffer(&line_ptr, buffer, &buffer_len,
679 line_length, last_line_was_empty);
684 DrawText(x, y + current_line * font_height, buffer, font_nr);
687 last_line_was_empty = (buffer_len == 0);
697 if (buffer_len > 0 && current_line < max_lines)
699 DrawText(x, y + current_line * font_height, buffer, font_nr);
707 static boolean getCheckedTokenValueFromString(char *string, char **token,
712 if (!getTokenValueFromString(string, token, value))
715 if (**token != '.') /* token should begin with dot */
718 for (ptr = *token; *ptr; ptr++) /* token should contain no whitespace */
719 if (*ptr == ' ' || *ptr == '\t')
722 for (ptr = *value; *ptr; ptr++) /* value should contain no whitespace */
723 if (*ptr == ' ' || *ptr == '\t')
729 static void DrawTextBuffer_Flush(int x, int y, char *buffer, int font_nr,
730 int line_length, int cut_length, int mask_mode,
731 boolean centered, int current_line)
733 int buffer_len = strlen(buffer);
734 int font_width = getFontWidth(font_nr);
735 int font_height = getFontHeight(font_nr);
736 int offset_chars = (centered ? (line_length - buffer_len) / 2 : 0);
738 (centered ? font_width * (line_length - buffer_len) / 2 : 0);
739 int final_cut_length = MAX(0, cut_length - offset_chars);
740 int xx = x + offset_xsize;
741 int yy = y + current_line * font_height;
743 buffer[final_cut_length] = '\0';
746 DrawTextExt(drawto, xx, yy, buffer, font_nr, mask_mode);
748 DrawText(xx, yy, buffer, font_nr);
751 int DrawTextBuffer(int x, int y, char *text_buffer, int font_nr,
752 int line_length, int cut_length, int max_lines,
753 int mask_mode, boolean autowrap, boolean centered,
754 boolean parse_comments)
757 int font_width = getFontWidth(font_nr);
758 int font_height = getFontHeight(font_nr);
760 char buffer[line_length + 1];
762 int current_line = 0;
764 if (text_buffer == NULL || *text_buffer == '\0')
767 if (current_line >= max_lines)
770 if (cut_length == -1)
771 cut_length = line_length;
776 while (*text_buffer && current_line < max_lines)
778 char line[MAX_LINE_LEN + 1];
780 boolean last_line_was_empty = TRUE;
782 int num_line_chars = MAX_LINE_LEN;
784 int num_line_chars = (autowrap ? MAX_LINE_LEN : line_length);
788 /* copy next line from text buffer to line buffer (nearly fgets() style) */
789 for (i = 0; i < num_line_chars && *text_buffer; i++)
790 if ((line[i] = *text_buffer++) == '\n')
794 /* prevent 'num_line_chars' sized lines to cause additional empty line */
795 if (i == num_line_chars && *text_buffer == '\n')
798 /* skip comments (lines directly beginning with '#') */
799 if (line[0] == '#' && parse_comments)
803 /* try to read generic token/value pair definition after comment sign */
804 if (getCheckedTokenValueFromString(line + 1, &token, &value))
806 /* if found, flush the current buffer, if non-empty */
807 if (buffer_len > 0 && current_line < max_lines)
809 DrawTextBuffer_Flush(x, y, buffer, font_nr, line_length, cut_length,
810 mask_mode, centered, current_line);
818 if (strEqual(token, ".font"))
819 font_nr = gfx.get_font_from_token_function(value);
820 else if (strEqual(token, ".autowrap"))
821 autowrap = get_boolean_from_string(value);
822 else if (strEqual(token, ".centered"))
823 centered = get_boolean_from_string(value);
824 else if (strEqual(token, ".parse_comments"))
825 parse_comments = get_boolean_from_string(value);
831 /* cut trailing newline and carriage return from input line */
832 for (line_ptr = line; *line_ptr; line_ptr++)
834 if (*line_ptr == '\n' || *line_ptr == '\r')
841 if (strlen(line) == 0) /* special case: force empty line */
846 while (*line_ptr && current_line < max_lines)
848 boolean buffer_filled;
852 buffer_filled = RenderLineToBuffer(&line_ptr, buffer, &buffer_len,
853 line_length, last_line_was_empty);
857 if (strlen(line_ptr) <= line_length)
859 buffer_len = strlen(line_ptr);
860 strcpy(buffer, line_ptr);
864 buffer_len = line_length;
865 strncpy(buffer, line_ptr, line_length);
868 buffer[buffer_len] = '\0';
869 line_ptr += buffer_len;
871 buffer_filled = TRUE;
877 DrawTextBuffer_Flush(x, y, buffer, font_nr, line_length, cut_length,
878 mask_mode, centered, current_line);
880 int offset_chars = (centered ? (line_length - buffer_len) / 2 : 0);
882 (centered ? font_width * (line_length - buffer_len) / 2 : 0);
883 int final_cut_length = MAX(0, cut_length - offset_chars);
884 int xx = x + offset_xsize;
886 buffer[final_cut_length] = '\0';
889 DrawTextExt(drawto, xx, y + current_line * font_height, buffer,
892 DrawText(xx, y + current_line * font_height, buffer, font_nr);
897 last_line_was_empty = (buffer_len == 0);
905 if (buffer_len > 0 && current_line < max_lines)
908 DrawTextBuffer_Flush(x, y, buffer, font_nr, line_length, cut_length,
909 mask_mode, centered, current_line);
911 int offset_chars = (centered ? (line_length - buffer_len) / 2 : 0);
913 (centered ? font_width * (line_length - buffer_len) / 2 : 0);
914 int final_cut_length = MAX(0, cut_length - offset_chars);
915 int xx = x + offset_xsize;
917 buffer[final_cut_length] = '\0';
920 DrawTextExt(drawto, xx, y + current_line * font_height, buffer,
923 DrawText(xx, y + current_line * font_height, buffer, font_nr);
932 int DrawTextFile(int x, int y, char *filename, int font_nr,
933 int line_length, int cut_length, int max_lines,
934 int mask_mode, boolean autowrap, boolean centered,
935 boolean parse_comments)
937 char *text_buffer = GetTextBufferFromFile(filename, MAX_LINES_FROM_FILE);
938 int num_lines_printed = DrawTextBuffer(x, y, text_buffer, font_nr,
939 line_length, cut_length, max_lines,
940 mask_mode, autowrap, centered,
942 checked_free(text_buffer);
944 return num_lines_printed;
948 void DrawTextWrapped(int x, int y, char *text, int font_nr, int line_length,
951 DrawTextBuffer(x, y, text, font_nr, line_length, -1, max_lines, -1, TRUE,
955 void DrawTextToTextArea(int x, int y, char *text, int font_nr, int line_length,
956 int cut_length, int max_lines, int mask_mode)
958 DrawTextBuffer(x, y, text, font_nr, line_length, cut_length, max_lines,
959 mask_mode, FALSE, FALSE, FALSE);