1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-03 04:22:47 -05:00

Support font fallback even when an X11 server-side font is selected,

by introducing a wrapper around an individual unifont which falls back
to Pango (which already has built-in fallback) in the case where the
selected font doesn't support the glyph in question.

The wrapper itself is a (vestigial) subclass of unifont, to minimise
disturbance at the call sites.

[originally from svn r9293]
This commit is contained in:
Simon Tatham
2011-09-16 19:18:54 +00:00
parent 24bad48f00
commit 92688ff47b
3 changed files with 310 additions and 45 deletions

View File

@ -28,6 +28,14 @@ typedef struct unifont {
* Font dimensions needed by clients.
*/
int width, height, ascent, descent;
/*
* Indicates whether this font is capable of handling all glyphs
* (Pango fonts can do this because Pango automatically supplies
* missing glyphs from other fonts), or whether it would like a
* fallback font to cope with missing glyphs.
*/
int want_fallback;
} unifont;
unifont *unifont_create(GtkWidget *widget, const char *name,
@ -38,6 +46,18 @@ void unifont_draw_text(GdkDrawable *target, GdkGC *gc, unifont *font,
int x, int y, const wchar_t *string, int len,
int wide, int bold, int cellwidth);
/*
* This function behaves exactly like the low-level unifont_create,
* except that as well as the requested font it also allocates (if
* necessary) a fallback font for filling in replacement glyphs.
*
* Return value is usable with unifont_destroy and unifont_draw_text
* as if it were an ordinary unifont.
*/
unifont *multifont_create(GtkWidget *widget, const char *name,
int wide, int bold,
int shadowoffset, int shadowalways);
/*
* Unified font selector dialog. I can't be bothered to do a
* proper GTK subclassing today, so this will just be an ordinary