summaryrefslogtreecommitdiffstats
path: root/unix/tkUnixRFont.c
diff options
context:
space:
mode:
authorjenglish <jenglish@flightlab.com>2005-04-19 05:50:04 (GMT)
committerjenglish <jenglish@flightlab.com>2005-04-19 05:50:04 (GMT)
commit4e133576bad75e1a28062fe47dc26bacf38ee324 (patch)
tree331116e569ba29586ff7d992607a396f7847d5ff /unix/tkUnixRFont.c
parent5ead8f9a8a9c1df902da03a5abd29c1a36b8e2ee (diff)
downloadtk-4e133576bad75e1a28062fe47dc26bacf38ee324.zip
tk-4e133576bad75e1a28062fe47dc26bacf38ee324.tar.gz
tk-4e133576bad75e1a28062fe47dc26bacf38ee324.tar.bz2
Tk_MeasureChars: Use Tcl_UtfToUnichar() for lax UTF-8 parsing
instead of strict parsing with FcUtf8ToUcs4() [fix/workaround for #1185640]
Diffstat (limited to 'unix/tkUnixRFont.c')
-rw-r--r--unix/tkUnixRFont.c14
1 files changed, 7 insertions, 7 deletions
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;