mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-06 05:52:48 -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:
@ -3397,7 +3397,7 @@ void do_text_internal(Context ctx, int x, int y, wchar_t *text, int len,
|
||||
{
|
||||
struct draw_ctx *dctx = (struct draw_ctx *)ctx;
|
||||
struct gui_data *inst = dctx->inst;
|
||||
int ncombining, combining;
|
||||
int ncombining;
|
||||
int nfg, nbg, t, fontid, shadow, rlen, widefactor, bold;
|
||||
int monochrome =
|
||||
gdk_visual_get_depth(gtk_widget_get_visual(inst->area)) == 1;
|
||||
@ -3494,11 +3494,20 @@ void do_text_internal(Context ctx, int x, int y, wchar_t *text, int len,
|
||||
rlen*widefactor*inst->font_width, inst->font_height);
|
||||
|
||||
draw_set_colour(dctx, nfg);
|
||||
for (combining = 0; combining < ncombining; combining++) {
|
||||
if (ncombining > 1) {
|
||||
assert(len == 1);
|
||||
unifont_draw_combining(&dctx->uctx, inst->fonts[fontid],
|
||||
x*inst->font_width+inst->window_border,
|
||||
(y*inst->font_height+inst->window_border+
|
||||
inst->fonts[0]->ascent),
|
||||
text, ncombining, widefactor > 1,
|
||||
bold, inst->font_width);
|
||||
} else {
|
||||
unifont_draw_text(&dctx->uctx, inst->fonts[fontid],
|
||||
x*inst->font_width+inst->window_border,
|
||||
y*inst->font_height+inst->window_border+inst->fonts[0]->ascent,
|
||||
text + combining, len, widefactor > 1,
|
||||
(y*inst->font_height+inst->window_border+
|
||||
inst->fonts[0]->ascent),
|
||||
text, len, widefactor > 1,
|
||||
bold, inst->font_width);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user