+#if defined(TARGET_SDL)
+ /* second step: draw masked inverted character */
+ SDLCopyInverseMasked(src_bitmap, dst_bitmap, src_x, src_y,
+ font_width, font_height, dst_x, dst_y);
+#else
+ /* second step: draw masked black rectangle (use "space" character) */
+ SetClipOrigin(src_bitmap, src_bitmap->stored_clip_gc,
+ dst_x - src_x, dst_y - src_y);
+ BlitBitmapMasked(src_bitmap, dst_bitmap, 0, 0,
+ font_width, font_height, dst_x, dst_y);
+#endif
+ }
+ else if (mask_mode == BLIT_MASKED || mask_mode == BLIT_ON_BACKGROUND)
+ {
+ if (mask_mode == BLIT_ON_BACKGROUND)
+ {
+ /* clear font character background */
+ ClearRectangleOnBackground(dst_bitmap, dst_x, dst_y,
+ font_width, font_height);
+ }
+
+#if defined(TARGET_X11_NATIVE_PERFORMANCE_WORKAROUND)
+ /* use special font tile clipmasks */
+ {
+ int font_pos = getFontCharPosition(font_nr, c);
+
+ SetClipMask(src_bitmap, font_clip_gc, font->clip_mask[font_pos]);
+ SetClipOrigin(src_bitmap, font_clip_gc, dst_x, dst_y);
+ }
+#else
+ SetClipOrigin(src_bitmap, src_bitmap->stored_clip_gc,
+ dst_x - src_x, dst_y - src_y);
+#endif
+
+ BlitBitmapMasked(src_bitmap, dst_bitmap, src_x, src_y,
+ font_width, font_height, dst_x, dst_y);
+ }
+ else /* normal, non-masked font blitting */
+ {
+ BlitBitmap(src_bitmap, dst_bitmap, src_x, src_y,
+ font_width, font_height, dst_x, dst_y);
+ }
+
+ dst_x += font_width;
+ }
+}
+
+void DrawTextToTextArea(int x, int y, char *text, int font_nr, int line_length,
+ int area_xsize, int area_ysize, int mask_mode)
+{
+ int area_line = 0;
+ int font_height = getFontHeight(font_nr);
+
+ if (text == NULL)