summaryrefslogtreecommitdiffstats
path: root/unix/tkUnixFont.c
diff options
context:
space:
mode:
authora_kovalenko <a_kovalenko@noemail.net>2002-06-05 22:11:09 (GMT)
committera_kovalenko <a_kovalenko@noemail.net>2002-06-05 22:11:09 (GMT)
commit24f7233c237622aca5353ef0a7ca4e1ddf65287f (patch)
tree70fedb18a0c8081f1ad8feef9d286fe59067e965 /unix/tkUnixFont.c
parent476c58c661f2bfa0bc75b6f0aaf2f8a2c7032b77 (diff)
downloadtk-24f7233c237622aca5353ef0a7ca4e1ddf65287f.zip
tk-24f7233c237622aca5353ef0a7ca4e1ddf65287f.tar.gz
tk-24f7233c237622aca5353ef0a7ca4e1ddf65287f.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] FossilOrigin-Name: bc358b934e8a2165d575175e4920c9422a76d602
Diffstat (limited to 'unix/tkUnixFont.c')
-rw-r--r--unix/tkUnixFont.c26
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);
}
}
+
+
+
/*
*-------------------------------------------------------------------------