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 | 89c3644f596451964a8d1cead2b6a9f9fdc8c7d8 (patch) | |
tree | 70fedb18a0c8081f1ad8feef9d286fe59067e965 /unix/tkUnixFont.c | |
parent | 58d92604a30257de040aa13dceed23dae1a13b03 (diff) | |
download | tk-89c3644f596451964a8d1cead2b6a9f9fdc8c7d8.zip tk-89c3644f596451964a8d1cead2b6a9f9fdc8c7d8.tar.gz tk-89c3644f596451964a8d1cead2b6a9f9fdc8c7d8.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); } } + + + /* *------------------------------------------------------------------------- |