Support for an alternative mechanism for displaying wide characters
authorsimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Sun, 3 Sep 2006 14:31:34 +0000 (14:31 +0000)
committersimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Sun, 3 Sep 2006 14:31:34 +0000 (14:31 +0000)
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.

git-svn-id: svn://svn.tartarus.org/sgt/putty@6844 cda61777-01e9-0310-a592-d414129be87e

unix/gtkwin.c

index 920d7fe..5aeeaf0 100644 (file)
@@ -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) {
            /*