simon-git: putty (main): Ben Harris
Commits to Tartarus hosted VCS
tartarus-commits at lists.tartarus.org
Mon May 5 23:18:00 BST 2025
TL;DR:
fcadb5fe GTK: use only 16-bit X text drawing calls
a0a92da0 GTK: don't try to use X fonts for characters outside BMP
Repository: https://git.tartarus.org/simon/putty.git
On the web: https://git.tartarus.org/?p=simon/putty.git
Branch updated: main
Committer: Ben Harris <bjh21 at bjh21.me.uk>
Date: 2025-05-05 23:18:00
commit fcadb5fed1fb8cd51a97e4652f3cf12bf4c8fb9e
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=fcadb5fed1fb8cd51a97e4652f3cf12bf4c8fb9e;hp=647d5a49d27fcce41db06ddb847b9c9a8937caee
Author: Ben Harris <bjh21 at bjh21.me.uk>
Date: Mon May 5 13:52:40 2025 +0100
GTK: use only 16-bit X text drawing calls
Xlib and the X protocol provide text handling calls in versions that
take both 8-bit and 16-bit character indices. They are mostly
interchangable, except that of course the 8-bit calls can only access
characters with codes up to 255.
Heretofore, PuTTY used the 16-bit X calls when using a font in the
"iso10646-1" encoding and 8-bit calls otherwise. This led to a lot of
duplicate code, and in particular two large and almost identical
implementations of x11font_cairo_draw*().
Now, PuTTY uses 16-bit calls throughout, even when using an 8-bit font
encoding. This simplifies the code at the expense of needing an
extra bit of conversion to expand the char array that we get from
put_wc_to_mb() into an array of XChar2b when using an 8-bit font.
unix/unifont.c | 156 +++++++++++++++------------------------------------------
1 file changed, 40 insertions(+), 116 deletions(-)
commit a0a92da03547f321b0b293219446f4bebb7d778b
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=a0a92da03547f321b0b293219446f4bebb7d778b;hp=fcadb5fed1fb8cd51a97e4652f3cf12bf4c8fb9e
Author: Ben Harris <bjh21 at bjh21.me.uk>
Date: Mon May 5 18:39:05 2025 +0100
GTK: don't try to use X fonts for characters outside BMP
X fonts are indexed by 16-bit quantities, so even Unicode-capable
fonts can only have characters in the Basic Multilingual Plane (BMP).
PuTTY, however, tried to look up all Unicode characters in X fonts,
and did so by effectively ignoring all but the low-order 16 bits of
the character code. This meant that trying to display a non-BMP
character could get you the corresponding character from the BMP
instead, if that character was in the font.
Now, x11font_has_glyph() always returns false for glyphs outside the
BMP, which should mean that x11font_draw_text() never gets asked to
draw them.
unix/unifont.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
More information about the tartarus-commits
mailing list