diff options
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | unix/tkUnixRFont.c | 14 |
2 files changed, 13 insertions, 7 deletions
@@ -1,3 +1,9 @@ +2003-04-18 Joe English <jenglish@users.sourceforge.net> + + * unix/tkUnixRFont.c(Tk_MeasureChars): Use Tcl_UtfToUnichar() + for lax UTF-8 parsing instead of strict parsing with FcUtf8ToUcs4() + [fix/workaround for #1185640] + 2003-04-18 Vince Darley <vincentdarley@users.sourceforge.net> * library/text.tcl diff --git a/unix/tkUnixRFont.c b/unix/tkUnixRFont.c index 2557ab0..cd4a4f0 100644 --- a/unix/tkUnixRFont.c +++ b/unix/tkUnixRFont.c @@ -8,7 +8,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkUnixRFont.c,v 1.8 2004/11/28 19:00:49 jenglish Exp $ + * RCS: @(#) $Id: tkUnixRFont.c,v 1.9 2005/04/19 05:50:06 jenglish Exp $ */ #include "tkUnixInt.h" @@ -511,15 +511,15 @@ Tk_MeasureChars(tkfont, source, numBytes, maxLength, flags, lengthPtr) curByte = 0; sawNonSpace = 0; while (numBytes > 0) { - clen = FcUtf8ToUcs4((FcChar8 *) source, &c, numBytes); + Tcl_UniChar unichar; + + clen = Tcl_UtfToUniChar(source, &unichar); + c = (FcChar32)unichar; if (clen <= 0) { - /* - * This should not happen, but it can, due to bugs in Tcl - * (i.e., [encoding convertfrom identity]). - */ + /* This can't happen (but see #1185640) */ *lengthPtr = curX; - return ++curByte; + return curByte; } source += clen; |