diff options
author | a_kovalenko <a_kovalenko> | 2002-06-05 22:11:09 (GMT) |
---|---|---|
committer | a_kovalenko <a_kovalenko> | 2002-06-05 22:11:09 (GMT) |
commit | ffa4d901dbca193fb74649d0766f51cc45eda915 (patch) | |
tree | 70fedb18a0c8081f1ad8feef9d286fe59067e965 /unix/tkUnixFont.c | |
parent | 972e97ee22e87ef707a976111cddbfe80b4737fc (diff) | |
download | tk-ffa4d901dbca193fb74649d0766f51cc45eda915.zip tk-ffa4d901dbca193fb74649d0766f51cc45eda915.tar.gz tk-ffa4d901dbca193fb74649d0766f51cc45eda915.tar.bz2 |
* unix/tkUnixFont.c (Tk_DrawChars): Don't assume that
one char is always one byte, and that required
subfont for the last character in any string is
the same as for the previous character
[Bug #559435] [Patch #559437]
Diffstat (limited to 'unix/tkUnixFont.c')
-rw-r--r-- | unix/tkUnixFont.c | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/unix/tkUnixFont.c b/unix/tkUnixFont.c index 6301b30..9bfeef6 100644 --- a/unix/tkUnixFont.c +++ b/unix/tkUnixFont.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkUnixFont.c,v 1.12 2002/04/23 00:20:35 hobbs Exp $ + * RCS: @(#) $Id: tkUnixFont.c,v 1.13 2002/06/05 22:11:09 a_kovalenko Exp $ */ #include "tkUnixInt.h" @@ -1159,6 +1159,7 @@ Tk_DrawChars(display, drawable, gc, tkfont, source, numBytes, x, y) Tcl_UniChar ch; FontFamily *familyPtr; int rx, ry, width, height, border_width, depth; + int do_width; Drawable root; fontPtr = (UnixFont *) tkfont; @@ -1178,18 +1179,20 @@ Tk_DrawChars(display, drawable, gc, tkfont, source, numBytes, x, y) end = source + numBytes; needWidth = fontPtr->font.fa.underline + fontPtr->font.fa.overstrike; - for (p = source; p < end; ) { - next = p + Tcl_UtfToUniChar(p, &ch); - thisSubFontPtr = FindSubFontForChar(fontPtr, ch); + for (p = source; p <= end; ) { + if (p < end) { + next = p + Tcl_UtfToUniChar(p, &ch); + thisSubFontPtr = FindSubFontForChar(fontPtr, ch); + } else { + next = p + 1; + thisSubFontPtr = lastSubFontPtr; + } if ((thisSubFontPtr != lastSubFontPtr) - || (p == end-1) || (p-source > 200)) { - if (p == end-1) { - p++; - } + || (p == end) || (p-source > 200)) { if (p > source) { - int do_width = (needWidth || (p != end-1)) ? 1 : 0; - + do_width = (needWidth || (p != end)) ? 1 : 0; familyPtr = lastSubFontPtr->familyPtr; + Tcl_UtfToExternalDString(familyPtr->encoding, source, p - source, &runString); if (familyPtr->isTwoByteFont) { @@ -1238,6 +1241,9 @@ Tk_DrawChars(display, drawable, gc, tkfont, source, numBytes, x, y) (unsigned) (x - xStart), (unsigned) fontPtr->barHeight); } } + + + /* *------------------------------------------------------------------------- |