]> asedeno.scripts.mit.edu Git - PuTTY.git/commitdiff
Fix goof in Pango bidi suppression.
authorSimon Tatham <anakin@pobox.com>
Sun, 20 Mar 2016 20:04:26 +0000 (20:04 +0000)
committerSimon Tatham <anakin@pobox.com>
Sun, 20 Mar 2016 20:06:04 +0000 (20:06 +0000)
When we're displaying bidirectionally active text (that is, text that
the Unicode bidi algorithm will fiddle with), we need to suppress
Pango's bidi because we've already done our own. We were doing this by
calling is_rtl() on each character, and if it returned true,
displaying just that character in a separate Pango call.

Except that, ahem, we were only doing this if the _first_ character
encountered during a scan of the display buffer was rtl-sensitive. If
the first one was fine but a subsequent one was rtl-sensitive, then
that one would just get shoved into the buffer we'd already started.

Running pterm -fn 'client:Monospace 12' and displaying
testdata/utf8.txt now works again.

unix/gtkfont.c

index a865121e34aac80882a71a04306136edda3cbda3..ed9888bceaa3b6ba4946ca1c4a9409c1e1896b19 100644 (file)
@@ -1543,7 +1543,8 @@ static void pangofont_draw_internal(unifont_drawctx *ctx, unifont *font,
                            (unsigned char)utfptr[clen] < 0xC0)
                         clen++;
                     n++;
-                    if (pangofont_char_width(layout, pfont,
+                    if (is_rtl(string[n-1]) ||
+                        pangofont_char_width(layout, pfont,
                                              string[n-1], utfptr + oldclen,
                                              clen - oldclen) != desired) {
                         clen = oldclen;