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 &&
206 gfx.draw_init_text &&
208 gfx.font_bitmap_info[font_nr].bitmap != NULL)
210 int x = (video.width - getTextWidth(text, font_nr)) / 2;
212 int width = video.width;
213 int height = getFontHeight(font_nr);
215 ClearRectangle(drawto, 0, y, width, height);
216 DrawTextExt(drawto, x, y, text, font_nr, BLIT_OPAQUE);
218 /* this makes things significantly faster than directly drawing to window */
219 BlitBitmap(drawto, window, 0, y, width, height, 0, y);
223 void DrawInitText(char *text, int ypos, int font_nr)
225 DrawInitTextExt(text, ypos, font_nr, TRUE);
228 void DrawInitTextIfNeeded(char *text, int ypos, int font_nr)
230 DrawInitTextExt(text, ypos, font_nr, FALSE);
233 void DrawTextF(int x, int y, int font_nr, char *format, ...)
235 char buffer[MAX_OUTPUT_LINESIZE + 1];
238 va_start(ap, format);
239 vsprintf(buffer, format, ap);
242 if (strlen(buffer) > MAX_OUTPUT_LINESIZE)
243 Error(ERR_EXIT, "string too long in DrawTextF() -- aborting");
245 DrawText(gfx.sx + x, gfx.sy + y, buffer, font_nr);
248 void DrawTextFCentered(int y, int font_nr, char *format, ...)
250 char buffer[MAX_OUTPUT_LINESIZE + 1];
253 va_start(ap, format);
254 vsprintf(buffer, format, ap);
257 if (strlen(buffer) > MAX_OUTPUT_LINESIZE)
258 Error(ERR_EXIT, "string too long in DrawTextFCentered() -- aborting");
260 DrawText(gfx.sx + (gfx.sxsize - getTextWidth(buffer, font_nr)) / 2,
261 gfx.sy + y, buffer, font_nr);
264 void DrawTextS(int x, int y, int font_nr, char *text)
266 DrawText(gfx.sx + x, gfx.sy + y, text, font_nr);
269 void DrawTextSCentered(int y, int font_nr, char *text)
271 DrawText(gfx.sx + (gfx.sxsize - getTextWidth(text, font_nr)) / 2,
272 gfx.sy + y, text, font_nr);
275 void DrawTextCentered(int y, int font_nr, char *text)
277 DrawText((gfx.sxsize - getTextWidth(text, font_nr)) / 2, y, text, font_nr);
280 void DrawTextSAligned(int x, int y, char *text, int font_nr, int align)
282 DrawText(gfx.sx + ALIGNED_XPOS(x, getTextWidth(text, font_nr), align),
283 gfx.sx + y, text, font_nr);
286 void DrawTextAligned(int x, int y, char *text, int font_nr, int align)
288 DrawText(ALIGNED_XPOS(x, getTextWidth(text, font_nr), align),
292 void DrawText(int x, int y, char *text, int font_nr)
294 int mask_mode = BLIT_OPAQUE;
296 if (DrawingOnBackground(x, y))
297 mask_mode = BLIT_ON_BACKGROUND;
299 DrawTextExt(drawto, x, y, text, font_nr, mask_mode);
302 redraw_mask |= REDRAW_FIELD;
303 else if (y < gfx.vy || gfx.vy == 0)
304 redraw_mask |= REDRAW_DOOR_1;
307 void DrawTextExt(DrawBuffer *dst_bitmap, int dst_x, int dst_y, char *text,
308 int font_nr, int mask_mode)
311 struct FontBitmapInfo *font = getFontBitmapInfo(font_nr);
313 int font_bitmap_id = gfx.select_font_function(font_nr);
314 struct FontBitmapInfo *font = &gfx.font_bitmap_info[font_bitmap_id];
316 int font_width = getFontWidth(font_nr);
317 int font_height = getFontHeight(font_nr);
319 int border_1 = gfx.sx + gfx.sxsize;
320 int border_2 = gfx.dx + gfx.dxsize;
321 int dst_x_start = dst_x;
325 char *text_ptr = text;
327 if (font->bitmap == NULL)
330 /* skip text to be printed outside the window (left/right will be clipped) */
331 if (dst_y < 0 || dst_y + font_height > video.height)
334 /* add offset for drawing font characters */
335 dst_x += font->draw_xoffset;
336 dst_y += font->draw_yoffset;
340 char c = *text_ptr++;
343 c = ' '; /* print space instead of newline */
345 getFontCharSource(font_nr, c, &src_bitmap, &src_x, &src_y);
347 /* clip text at the left side of the window */
355 /* clip text at the right side of the window */
357 if (dst_x + font_width > video.width)
360 /* (this does not work well when trying to print text to whole screen) */
361 if ((dst_x_start < border_1 && dst_x + font_width > border_1) ||
362 (dst_x_start < border_2 && dst_x + font_width > border_2))
366 if (mask_mode == BLIT_INVERSE) /* special mode for text gadgets */
368 /* first step: draw solid colored rectangle (use "cursor" character) */
369 if (strlen(text) == 1) /* only one char inverted => draw cursor */
371 Bitmap *cursor_bitmap;
372 int cursor_x, cursor_y;
374 getFontCharSource(font_nr, FONT_ASCII_CURSOR, &cursor_bitmap,
375 &cursor_x, &cursor_y);
377 BlitBitmap(cursor_bitmap, dst_bitmap, cursor_x, cursor_y,
378 font_width, font_height, dst_x, dst_y);
381 #if defined(TARGET_SDL)
382 /* second step: draw masked inverted character */
383 SDLCopyInverseMasked(src_bitmap, dst_bitmap, src_x, src_y,
384 font_width, font_height, dst_x, dst_y);
386 /* second step: draw masked black rectangle (use "space" character) */
387 SetClipOrigin(src_bitmap, src_bitmap->stored_clip_gc,
388 dst_x - src_x, dst_y - src_y);
389 BlitBitmapMasked(src_bitmap, dst_bitmap, 0, 0,
390 font_width, font_height, dst_x, dst_y);
393 else if (mask_mode == BLIT_MASKED || mask_mode == BLIT_ON_BACKGROUND)
395 if (mask_mode == BLIT_ON_BACKGROUND)
397 /* clear font character background */
398 ClearRectangleOnBackground(dst_bitmap, dst_x, dst_y,
399 font_width, font_height);
402 #if defined(TARGET_X11_NATIVE_PERFORMANCE_WORKAROUND)
403 /* use special font tile clipmasks */
405 int font_pos = getFontCharPosition(font_nr, c);
407 SetClipMask(src_bitmap, font_clip_gc, font->clip_mask[font_pos]);
408 SetClipOrigin(src_bitmap, font_clip_gc, dst_x, dst_y);
411 SetClipOrigin(src_bitmap, src_bitmap->stored_clip_gc,
412 dst_x - src_x, dst_y - src_y);
415 BlitBitmapMasked(src_bitmap, dst_bitmap, src_x, src_y,
416 font_width, font_height, dst_x, dst_y);
418 else /* normal, non-masked font blitting */
420 BlitBitmap(src_bitmap, dst_bitmap, src_x, src_y,
421 font_width, font_height, dst_x, dst_y);
429 /* ========================================================================= */
430 /* text buffer drawing functions */
431 /* ========================================================================= */
433 #define MAX_LINES_FROM_FILE 1024
435 char *GetTextBufferFromFile(char *filename, int max_lines)
441 if (filename == NULL)
444 if (!(file = fopen(filename, MODE_READ)))
447 buffer = checked_calloc(1); /* start with valid, but empty text buffer */
449 while (!feof(file) && num_lines < max_lines)
451 char line[MAX_LINE_LEN];
453 /* read next line of input file */
454 if (!fgets(line, MAX_LINE_LEN, file))
457 buffer = checked_realloc(buffer, strlen(buffer) + strlen(line) + 1);
459 strcat(buffer, line);
469 void DrawTextToTextArea_OLD(int x, int y, char *text, int font_nr, int line_length,
470 int area_xsize, int area_ysize, int mask_mode)
473 int font_height = getFontHeight(font_nr);
478 while (*text && area_line < area_ysize)
480 char buffer[MAX_OUTPUT_LINESIZE + 1];
483 for (i = 0; i < line_length && *text; i++)
484 if ((buffer[i] = *text++) == '\n')
486 buffer[MIN(i, area_xsize)] = '\0';
488 DrawTextExt(drawto, x, y + area_line * font_height, buffer, font_nr,
494 redraw_mask |= REDRAW_FIELD;
497 static boolean RenderLineToBuffer(char **src_buffer_ptr, char *dst_buffer,
498 int *dst_buffer_len, int line_length,
499 boolean last_line_was_empty)
501 char *text_ptr = *src_buffer_ptr;
502 char *buffer = dst_buffer;
503 int buffer_len = *dst_buffer_len;
504 boolean buffer_filled = FALSE;
511 /* skip leading whitespaces */
512 while (*text_ptr == ' ' || *text_ptr == '\t')
518 /* look for end of next word */
519 while (*word_ptr != ' ' && *word_ptr != '\t' && *word_ptr != '\0')
529 else if (*text_ptr == '\n') /* special case: force empty line */
534 /* prevent printing of multiple empty lines */
535 if (buffer_len > 0 || !last_line_was_empty)
536 buffer_filled = TRUE;
538 else if (word_len < line_length - buffer_len)
540 /* word fits into text buffer -- add word */
543 buffer[buffer_len++] = ' ';
545 strncpy(&buffer[buffer_len], text_ptr, word_len);
546 buffer_len += word_len;
547 buffer[buffer_len] = '\0';
548 text_ptr += word_len;
550 else if (buffer_len > 0)
552 /* not enough space left for word in text buffer -- print buffer */
554 buffer_filled = TRUE;
558 /* word does not fit at all into empty text buffer -- cut word */
560 strncpy(buffer, text_ptr, line_length);
561 buffer[line_length] = '\0';
562 text_ptr += line_length;
563 buffer_filled = TRUE;
570 *src_buffer_ptr = text_ptr;
571 *dst_buffer_len = buffer_len;
573 return buffer_filled;
577 void DrawTextWrapped_OLD(int x, int y, char *text, int font_nr, int line_length,
580 char *text_ptr = text;
581 int current_line = 0;
582 int font_height = getFontHeight(font_nr);
584 while (*text_ptr && current_line < max_lines)
586 char buffer[line_length + 1];
591 RenderLineToBuffer(&text_ptr, buffer, &buffer_len, line_length, TRUE);
593 DrawText(x, y + current_line * font_height, buffer, font_nr);
600 int DrawTextFromFile_OLD(int x, int y, char *filename, int font_nr,
601 int line_length, int max_lines, boolean wrap_text)
603 int font_height = getFontHeight(font_nr);
604 char line[MAX_LINE_LEN];
605 char buffer[line_length + 1];
607 int current_line = 0;
610 if (current_line >= max_lines)
613 if (filename == NULL)
616 if (!(file = fopen(filename, MODE_READ)))
622 while (!feof(file) && current_line < max_lines)
625 boolean last_line_was_empty = TRUE;
627 /* read next line of input file */
628 if (!fgets(line, MAX_LINE_LEN, file))
631 /* skip comments (lines directly beginning with '#') */
635 /* cut trailing newline from input line */
636 for (line_ptr = line; *line_ptr; line_ptr++)
638 if (*line_ptr == '\n' || *line_ptr == '\r')
645 if (strlen(line) == 0) /* special case: force empty line */
650 while (*line_ptr && current_line < max_lines)
653 boolean buffer_filled;
657 buffer_filled = RenderLineToBuffer(&line_ptr, buffer, &buffer_len,
658 line_length, last_line_was_empty);
662 if (strlen(line_ptr) <= line_length)
664 buffer_len = strlen(line_ptr);
665 strcpy(buffer, line_ptr);
669 buffer_len = line_length;
670 strncpy(buffer, line_ptr, line_length);
673 buffer[buffer_len] = '\0';
674 line_ptr += buffer_len;
676 buffer_filled = TRUE;
679 boolean buffer_filled = RenderLineToBuffer(&line_ptr, buffer, &buffer_len,
680 line_length, last_line_was_empty);
685 DrawText(x, y + current_line * font_height, buffer, font_nr);
688 last_line_was_empty = (buffer_len == 0);
698 if (buffer_len > 0 && current_line < max_lines)
700 DrawText(x, y + current_line * font_height, buffer, font_nr);
708 static boolean getCheckedTokenValueFromString(char *string, char **token,
713 if (!getTokenValueFromString(string, token, value))
716 if (**token != '.') /* token should begin with dot */
719 for (ptr = *token; *ptr; ptr++) /* token should contain no whitespace */
720 if (*ptr == ' ' || *ptr == '\t')
723 for (ptr = *value; *ptr; ptr++) /* value should contain no whitespace */
724 if (*ptr == ' ' || *ptr == '\t')
730 static void DrawTextBuffer_Flush(int x, int y, char *buffer, int font_nr,
731 int line_length, int cut_length, int mask_mode,
732 boolean centered, int current_line)
734 int buffer_len = strlen(buffer);
735 int font_width = getFontWidth(font_nr);
736 int font_height = getFontHeight(font_nr);
737 int offset_chars = (centered ? (line_length - buffer_len) / 2 : 0);
739 (centered ? font_width * (line_length - buffer_len) / 2 : 0);
740 int final_cut_length = MAX(0, cut_length - offset_chars);
741 int xx = x + offset_xsize;
742 int yy = y + current_line * font_height;
744 buffer[final_cut_length] = '\0';
747 DrawTextExt(drawto, xx, yy, buffer, font_nr, mask_mode);
749 DrawText(xx, yy, buffer, font_nr);
752 int DrawTextBuffer(int x, int y, char *text_buffer, int font_nr,
753 int line_length, int cut_length, int max_lines,
754 int mask_mode, boolean autowrap, boolean centered,
755 boolean parse_comments)
758 int font_width = getFontWidth(font_nr);
759 int font_height = getFontHeight(font_nr);
761 char buffer[line_length + 1];
763 int current_line = 0;
765 if (text_buffer == NULL || *text_buffer == '\0')
768 if (current_line >= max_lines)
771 if (cut_length == -1)
772 cut_length = line_length;
777 while (*text_buffer && current_line < max_lines)
779 char line[MAX_LINE_LEN + 1];
781 boolean last_line_was_empty = TRUE;
783 int num_line_chars = MAX_LINE_LEN;
785 int num_line_chars = (autowrap ? MAX_LINE_LEN : line_length);
789 /* copy next line from text buffer to line buffer (nearly fgets() style) */
790 for (i = 0; i < num_line_chars && *text_buffer; i++)
791 if ((line[i] = *text_buffer++) == '\n')
795 /* prevent 'num_line_chars' sized lines to cause additional empty line */
796 if (i == num_line_chars && *text_buffer == '\n')
799 /* skip comments (lines directly beginning with '#') */
800 if (line[0] == '#' && parse_comments)
804 /* try to read generic token/value pair definition after comment sign */
805 if (getCheckedTokenValueFromString(line + 1, &token, &value))
807 /* if found, flush the current buffer, if non-empty */
808 if (buffer_len > 0 && current_line < max_lines)
810 DrawTextBuffer_Flush(x, y, buffer, font_nr, line_length, cut_length,
811 mask_mode, centered, current_line);
819 if (strEqual(token, ".font"))
820 font_nr = gfx.get_font_from_token_function(value);
821 else if (strEqual(token, ".autowrap"))
822 autowrap = get_boolean_from_string(value);
823 else if (strEqual(token, ".centered"))
824 centered = get_boolean_from_string(value);
825 else if (strEqual(token, ".parse_comments"))
826 parse_comments = get_boolean_from_string(value);
832 /* cut trailing newline and carriage return from input line */
833 for (line_ptr = line; *line_ptr; line_ptr++)
835 if (*line_ptr == '\n' || *line_ptr == '\r')
842 if (strlen(line) == 0) /* special case: force empty line */
847 while (*line_ptr && current_line < max_lines)
849 boolean buffer_filled;
853 buffer_filled = RenderLineToBuffer(&line_ptr, buffer, &buffer_len,
854 line_length, last_line_was_empty);
858 if (strlen(line_ptr) <= line_length)
860 buffer_len = strlen(line_ptr);
861 strcpy(buffer, line_ptr);
865 buffer_len = line_length;
866 strncpy(buffer, line_ptr, line_length);
869 buffer[buffer_len] = '\0';
870 line_ptr += buffer_len;
872 buffer_filled = TRUE;
878 DrawTextBuffer_Flush(x, y, buffer, font_nr, line_length, cut_length,
879 mask_mode, centered, current_line);
881 int offset_chars = (centered ? (line_length - buffer_len) / 2 : 0);
883 (centered ? font_width * (line_length - buffer_len) / 2 : 0);
884 int final_cut_length = MAX(0, cut_length - offset_chars);
885 int xx = x + offset_xsize;
887 buffer[final_cut_length] = '\0';
890 DrawTextExt(drawto, xx, y + current_line * font_height, buffer,
893 DrawText(xx, y + current_line * font_height, buffer, font_nr);
898 last_line_was_empty = (buffer_len == 0);
906 if (buffer_len > 0 && current_line < max_lines)
909 DrawTextBuffer_Flush(x, y, buffer, font_nr, line_length, cut_length,
910 mask_mode, centered, current_line);
912 int offset_chars = (centered ? (line_length - buffer_len) / 2 : 0);
914 (centered ? font_width * (line_length - buffer_len) / 2 : 0);
915 int final_cut_length = MAX(0, cut_length - offset_chars);
916 int xx = x + offset_xsize;
918 buffer[final_cut_length] = '\0';
921 DrawTextExt(drawto, xx, y + current_line * font_height, buffer,
924 DrawText(xx, y + current_line * font_height, buffer, font_nr);
933 int DrawTextFile(int x, int y, char *filename, int font_nr,
934 int line_length, int cut_length, int max_lines,
935 int mask_mode, boolean autowrap, boolean centered,
936 boolean parse_comments)
938 char *text_buffer = GetTextBufferFromFile(filename, MAX_LINES_FROM_FILE);
939 int num_lines_printed = DrawTextBuffer(x, y, text_buffer, font_nr,
940 line_length, cut_length, max_lines,
941 mask_mode, autowrap, centered,
943 checked_free(text_buffer);
945 return num_lines_printed;
949 void DrawTextWrapped(int x, int y, char *text, int font_nr, int line_length,
952 DrawTextBuffer(x, y, text, font_nr, line_length, -1, max_lines, -1, TRUE,
956 void DrawTextToTextArea(int x, int y, char *text, int font_nr, int line_length,
957 int cut_length, int max_lines, int mask_mode)
959 DrawTextBuffer(x, y, text, font_nr, line_length, cut_length, max_lines,
960 mask_mode, FALSE, FALSE, FALSE);