From 16510bf3b9d93aec577b039f861a33fcfb2b359b Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Sun, 3 Sep 2006 14:31:34 +0000 Subject: [PATCH] Support for an alternative mechanism for displaying wide characters under X: instead of having two separate fixed-width fonts one of which is twice the width of the other, you can instead have a single font in which some characters are twice as wide as others. This is implemented very simply: if you specify a wide font, it will be used for wide characters, and if you don't then the normal font will be used for wide characters (so they'd better _be_ wide in that font, or there'll be trouble). I got this idea from Jed, whose latest version supports UTF-8 and requires a font of this type. If there are going to be X fonts like that kicking around, there will doubtless be people who want to use them. [originally from svn r6844] --- unix/gtkwin.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/unix/gtkwin.c b/unix/gtkwin.c index 920d7fe0..5aeeaf02 100644 --- a/unix/gtkwin.c +++ b/unix/gtkwin.c @@ -1998,12 +1998,18 @@ void do_text_internal(Context ctx, int x, int y, wchar_t *text, int len, wcs[i] = text[i]; } + if (inst->fonts[fontid] == NULL && (fontid & 2)) { + /* + * We've been given ATTR_WIDE, but have no wide font. + * Fall back to the non-wide font. + */ + fontid &= ~2; + } + if (inst->fonts[fontid] == NULL) { /* - * The font for this contingency does not exist. - * Typically this means we've been given ATTR_WIDE - * character and have no wide font. So we display - * nothing at all; such is life. + * The font for this contingency does not exist. So we + * display nothing at all; such is life. */ } else if (inst->fontinfo[fontid].is_wide) { /*