- if (fs->preview_pixmap) {
- GdkGC *gc = gdk_gc_new(fs->preview_pixmap);
- gdk_gc_set_foreground(gc, &fs->preview_bg);
- gdk_draw_rectangle(fs->preview_pixmap, gc, 1, 0, 0,
- fs->preview_width, fs->preview_height);
- gdk_gc_set_foreground(gc, &fs->preview_fg);
- if (font) {
- /*
- * The pangram used here is rather carefully
- * constructed: it contains a sequence of very narrow
- * letters (`jil') and a pair of adjacent very wide
- * letters (`wm').
- *
- * If the user selects a proportional font, it will be
- * coerced into fixed-width character cells when used
- * in the actual terminal window. We therefore display
- * it the same way in the preview pane, so as to show
- * it the way it will actually be displayed - and we
- * deliberately pick a pangram which will show the
- * resulting miskerning at its worst.
- *
- * We aren't trying to sell people these fonts; we're
- * trying to let them make an informed choice. Better
- * that they find out the problems with using
- * proportional fonts in terminal windows here than
- * that they go to the effort of selecting their font
- * and _then_ realise it was a mistake.
- */
- info->fontclass->draw_text(fs->preview_pixmap, gc, font,
- 0, font->ascent,
- L"bankrupt jilted showmen quiz convex fogey",
- 41, FALSE, FALSE, font->width);
- info->fontclass->draw_text(fs->preview_pixmap, gc, font,
- 0, font->ascent + font->height,
- L"BANKRUPT JILTED SHOWMEN QUIZ CONVEX FOGEY",
- 41, FALSE, FALSE, font->width);
- /*
- * The ordering of punctuation here is also selected
- * with some specific aims in mind. I put ` and '
- * together because some software (and people) still
- * use them as matched quotes no matter what Unicode
- * might say on the matter, so people can quickly
- * check whether they look silly in a candidate font.
- * The sequence #_@ is there to let people judge the
- * suitability of the underscore as an effectively
- * alphabetic character (since that's how it's often
- * used in practice, at least by programmers).
- */
- info->fontclass->draw_text(fs->preview_pixmap, gc, font,
- 0, font->ascent + font->height * 2,
- L"0123456789!?,.:;<>()[]{}\\/`'\"+*-=~#_@|%&^$",
- 42, FALSE, FALSE, font->width);
- }
- gdk_gc_unref(gc);
- gdk_window_invalidate_rect(fs->preview_area->window, NULL, FALSE);
+#ifdef DRAW_TEXT_GDK
+ if (dctx->type == DRAWTYPE_GDK) {
+ gdk_gc_set_foreground(dctx->u.gdk.gc, &fs->preview_bg);
+ gdk_draw_rectangle(dctx->u.gdk.target, dctx->u.gdk.gc, 1, 0, 0,
+ fs->preview_width, fs->preview_height);
+ gdk_gc_set_foreground(dctx->u.gdk.gc, &fs->preview_fg);
+ }
+#endif
+#ifdef DRAW_TEXT_CAIRO
+ if (dctx->type == DRAWTYPE_CAIRO) {
+ cairo_set_source_rgb(dctx->u.cairo.cr,
+ fs->preview_bg.red / 65535.0,
+ fs->preview_bg.green / 65535.0,
+ fs->preview_bg.blue / 65535.0);
+ cairo_paint(dctx->u.cairo.cr);
+ cairo_set_source_rgb(dctx->u.cairo.cr,
+ fs->preview_fg.red / 65535.0,
+ fs->preview_fg.green / 65535.0,
+ fs->preview_fg.blue / 65535.0);