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

Fix combining character handling in Pango.

The top-level loop in gtkwin.c which draws text was expecting that the
right way to draw a printing character plus combining characters was
to overprint them one by one on top of each other. This is an OK
assumption for X bitmap fonts, but in Pango, it works very badly -
most obviously because asking Pango to display a combining char on its
own causes it to print a dotted circle representing the base char, but
also because surely there will be character combinations where Pango
wants to do something more sophisticated than just printing them each
at a standard offset, and it would be a shame not to let it.

So I've moved the previous overprinting loop down into the x11font
subclass of the unifont mechanism. The top-level gtkwin.c drawing code
now calls a new method unifont_draw_combining, which in the X11 case
does the same loop as before, but in the Pango case, just passes a
whole base+combinings string to Pango in one go and lets it do the
best job it can.
This commit is contained in:
Simon Tatham
2015-09-26 10:18:53 +01:00
parent 431f8db862
commit 854fae843b
3 changed files with 164 additions and 45 deletions

View File

@ -136,6 +136,12 @@ void unifont_destroy(unifont *font);
void unifont_draw_text(unifont_drawctx *ctx, unifont *font,
int x, int y, const wchar_t *string, int len,
int wide, int bold, int cellwidth);
/* Same as unifont_draw_text, but expects 'string' to contain one
* normal char plus combining chars, and overdraws them all in the
* same character cell. */
void unifont_draw_combining(unifont_drawctx *ctx, 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,