diff options
-rw-r--r-- | generic/tkBind.c | 4 | ||||
-rw-r--r-- | generic/tkEntry.c | 10 | ||||
-rw-r--r-- | generic/tkFont.c | 10 | ||||
-rw-r--r-- | generic/tkIcu.c | 22 | ||||
-rw-r--r-- | generic/tkInt.h | 8 | ||||
-rw-r--r-- | generic/tkText.c | 4 | ||||
-rw-r--r-- | generic/tkTextDisp.c | 2 | ||||
-rw-r--r-- | generic/tkTextIndex.c | 8 | ||||
-rw-r--r-- | generic/tkUtil.c | 73 | ||||
-rw-r--r-- | generic/ttk/ttkEntry.c | 8 | ||||
-rw-r--r-- | macosx/tkMacOSXKeyboard.c | 2 | ||||
-rw-r--r-- | unix/Makefile.in | 2 | ||||
-rw-r--r-- | unix/tkUnixFont.c | 18 | ||||
-rw-r--r-- | unix/tkUnixKey.c | 2 | ||||
-rw-r--r-- | unix/tkUnixMenu.c | 2 | ||||
-rw-r--r-- | unix/tkUnixRFont.c | 4 | ||||
-rw-r--r-- | win/Makefile.in | 2 | ||||
-rw-r--r-- | win/makefile.vc | 2 | ||||
-rw-r--r-- | win/tkWinFont.c | 10 | ||||
-rw-r--r-- | win/tkWinKey.c | 4 | ||||
-rw-r--r-- | win/tkWinMenu.c | 2 |
21 files changed, 67 insertions, 132 deletions
diff --git a/generic/tkBind.c b/generic/tkBind.c index acd982b..d62666f 100644 --- a/generic/tkBind.c +++ b/generic/tkBind.c @@ -5300,7 +5300,7 @@ TkStringToKeysym( #endif /* REDO_KEYSYM_LOOKUP */ int keysym; - size_t len = TkUtfToUniChar(name, &keysym); + size_t len = Tcl_UtfToUniChar(name, &keysym); if (name[len] == '\0') { if (!Tcl_UniCharIsPrint(keysym)) { /* This form not supported */ @@ -5384,7 +5384,7 @@ TkKeysymToString( && ((unsigned)(keysym - 0x100007F) > 0x20)) { char buf[10]; if (Tcl_UniCharIsPrint(keysym-0x1000000)) { - buf[TkUniCharToUtf(keysym - 0x1000000, buf)] = '\0'; + buf[Tcl_UniCharToUtf(keysym - 0x1000000, buf)] = '\0'; } else if (keysym >= 0x1010000) { snprintf(buf, sizeof(buf), "U%08X", (int)(keysym - 0x1000000)); } else { diff --git a/generic/tkEntry.c b/generic/tkEntry.c index 6601d65..6da9e40 100644 --- a/generic/tkEntry.c +++ b/generic/tkEntry.c @@ -2002,8 +2002,8 @@ EntryComputeGeometry( * resulting string. */ - TkUtfToUniChar(entryPtr->showChar, &ch); - size = TkUniCharToUtf(ch, buf); + Tcl_UtfToUniChar(entryPtr->showChar, &ch); + size = Tcl_UniCharToUtf(ch, buf); entryPtr->numDisplayBytes = entryPtr->numChars * size; p = (char *)ckalloc(entryPtr->numDisplayBytes + 1); @@ -3584,7 +3584,7 @@ ExpandPercents( before++; /* skip over % */ if (*before != '\0') { - before += TkUtfToUniChar(before, &ch); + before += Tcl_UtfToUniChar(before, &ch); } else { ch = '%'; } @@ -3604,7 +3604,7 @@ ExpandPercents( string = Tk_PathName(entryPtr->tkwin); break; default: - length = TkUniCharToUtf(ch, numStorage); + length = Tcl_UniCharToUtf(ch, numStorage); numStorage[length] = '\0'; string = numStorage; break; @@ -3664,7 +3664,7 @@ ExpandPercents( string = Tk_PathName(entryPtr->tkwin); break; default: - length = TkUniCharToUtf(ch, numStorage); + length = Tcl_UniCharToUtf(ch, numStorage); numStorage[length] = '\0'; string = numStorage; break; diff --git a/generic/tkFont.c b/generic/tkFont.c index 844ed78..e67be4e 100644 --- a/generic/tkFont.c +++ b/generic/tkFont.c @@ -576,7 +576,7 @@ Tk_FontObjCmd( if (charPtr != NULL) { const char *string = Tcl_GetString(charPtr); - size_t len = TkUtfToUniChar(string, &uniChar); + size_t len = Tcl_UtfToUniChar(string, &uniChar); if (len != (size_t)charPtr->length) { resultPtr = Tcl_NewStringObj( @@ -1744,14 +1744,14 @@ Tk_PostscriptFontName( src++; upper = 1; } - src += TkUtfToUniChar(src, &ch); + src += Tcl_UtfToUniChar(src, &ch); if (upper) { ch = Tcl_UniCharToUpper(ch); upper = 0; } else { ch = Tcl_UniCharToLower(ch); } - dest += TkUniCharToUtf(ch, dest); + dest += Tcl_UniCharToUtf(ch, dest); } *dest = '\0'; Tcl_DStringSetLength(dsPtr, dest - Tcl_DStringValue(dsPtr)); @@ -2789,7 +2789,7 @@ Tk_CharBbox( } if (widthPtr != NULL) { int ch; - Tk_MeasureChars(tkfont, end, TkUtfToUniChar(end, &ch), -1, 0, &w); + Tk_MeasureChars(tkfont, end, Tcl_UtfToUniChar(end, &ch), -1, 0, &w); } goto check; } @@ -3335,7 +3335,7 @@ Tk_TextLayoutToPostscript( * international postscript fonts. */ - p += TkUtfToUniChar(p, &ch); + p += Tcl_UtfToUniChar(p, &ch); if ((ch == '(') || (ch == ')') || (ch == '\\') || (ch < 0x20)) { /* * Tricky point: the "03" is necessary in the snprintf below, diff --git a/generic/tkIcu.c b/generic/tkIcu.c index 5639336..237daf8 100644 --- a/generic/tkIcu.c +++ b/generic/tkIcu.c @@ -92,13 +92,13 @@ startEndOfCmd( str = Tcl_GetStringFromObj(objv[1], &len); Tcl_UtfToChar16DString(str, len, &ds); len = Tcl_DStringLength(&ds)/2; - if (TkGetIntForIndex(objv[2], len-1, 0, &idx) != TCL_OK) { + Tcl_Size ulen = Tcl_GetCharLength(objv[1]); + if (TkGetIntForIndex(objv[2], ulen-1, 0, &idx) != TCL_OK) { Tcl_DStringFree(&ds); Tcl_SetObjResult(interp, Tcl_ObjPrintf("bad index \"%s\": must be integer?[+-]integer?, end?[+-]integer?, or \"\"", Tcl_GetString(objv[2]))); Tcl_SetErrorCode(interp, "TK", "ICU", "INDEX", NULL); return TCL_ERROR; } - it = icu_open((UBreakIteratorTypex)(flags&3), locale, NULL, -1, &errorCode); if (it != NULL) { @@ -112,6 +112,14 @@ startEndOfCmd( Tcl_SetErrorCode(interp, "TK", "ICU", "CANNOTOPEN", NULL); return TCL_ERROR; } + if (idx > 0 && len != ulen) { + /* The string contains codepoints > \uFFFF. Determine UTF-16 index */ + Tcl_Size newIdx = 1; + for (Tcl_Size i = 1; i < idx; i++) { + newIdx += 1 + (((ustr[newIdx-1]&0xFFC0) == 0xD800) && ((ustr[newIdx]&0xFFC0) == 0xDC00)); + } + idx = newIdx; + } if (flags & FLAG_FOLLOWING) { if ((idx < 0) && (flags & FLAG_WORD)) { idx = 0; @@ -122,7 +130,7 @@ startEndOfCmd( } } else if (idx > 0) { if (!(flags & FLAG_WORD)) { - idx += 1 + (((ustr[idx]&0xFFC0) == 0xD800) && ((ustr[idx+1]&0xFFC0) == 0xDC00)); + idx += 1 + (((ustr[idx]&0xFFC0) == 0xD800) && ((ustr[idx+1]&0xFFC0) == 0xDC00)); } idx = icu_preceding(it, idx); if (idx == 0 && (flags & FLAG_WORD)) { @@ -146,6 +154,14 @@ startEndOfCmd( icu_close(it); Tcl_DStringFree(&ds); if (idx != TCL_INDEX_NONE) { + if (idx > 0 && len != ulen) { + /* The string contains codepoints > \uFFFF. Determine UTF-16 index */ + Tcl_Size newIdx = 1; + for (Tcl_Size i = 1; i < idx; i++) { + if (((ustr[i-1]&0xFFC0) != 0xD800) || ((ustr[i]&0xFFC0) != 0xDC00)) newIdx++; + } + idx = newIdx; + } Tcl_SetObjResult(interp, TkNewIndexObj(idx)); } return TCL_OK; diff --git a/generic/tkInt.h b/generic/tkInt.h index d503e95..9b76898 100644 --- a/generic/tkInt.h +++ b/generic/tkInt.h @@ -1437,14 +1437,6 @@ MODULE_SCOPE void TkpCopyRegion(TkRegion dst, TkRegion src); # define c_class class #endif -#if TCL_UTF_MAX > 3 -# define TkUtfToUniChar(src, ch) (size_t)(((int (*)(const char *, int *))Tcl_UtfToUniChar)(src, ch)) -# define TkUniCharToUtf(ch, src) (size_t)(((int (*)(int, char *))Tcl_UniCharToUtf)(ch, src)) -#else - MODULE_SCOPE size_t TkUtfToUniChar(const char *, int *); - MODULE_SCOPE size_t TkUniCharToUtf(int, char *); -#endif - #if defined(_WIN32) && !defined(STATIC_BUILD) && TCL_MAJOR_VERSION < 9 # define tcl_CreateFileHandler reserved9 #endif diff --git a/generic/tkText.c b/generic/tkText.c index 83d2d49..51fa2a0 100644 --- a/generic/tkText.c +++ b/generic/tkText.c @@ -4607,7 +4607,7 @@ TkTextGetTabs( * There may be a more efficient way of getting this. */ - TkUtfToUniChar(Tcl_GetString(objv[i+1]), &ch); + Tcl_UtfToUniChar(Tcl_GetString(objv[i+1]), &ch); if (!Tcl_UniCharIsAlpha(ch)) { continue; } @@ -6186,7 +6186,7 @@ SearchCore( } } else { firstOffset = p - startOfLine + - TkUtfToUniChar(startOfLine+matchOffset,&ch); + Tcl_UtfToUniChar(startOfLine+matchOffset,&ch); } } } while (searchSpecPtr->all); diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c index b3096f9..5ad4509 100644 --- a/generic/tkTextDisp.c +++ b/generic/tkTextDisp.c @@ -7703,7 +7703,7 @@ TkTextCharLayoutProc( if (bytesThatFit + 1 <= maxBytes) { if ((bytesThatFit == 0) && noCharsYet) { int ch; - int chLen = TkUtfToUniChar(p, &ch); + int chLen = Tcl_UtfToUniChar(p, &ch); #ifdef TK_LAYOUT_WITH_BASE_CHUNKS bytesThatFit = CharChunkMeasureChars(chunkPtr, line, diff --git a/generic/tkTextIndex.c b/generic/tkTextIndex.c index 2449a12..b0a5c94 100644 --- a/generic/tkTextIndex.c +++ b/generic/tkTextIndex.c @@ -451,7 +451,7 @@ TkTextMakeByteIndex( start = segPtr->body.chars + (byteIndex - index); p = Tcl_UtfPrev(start, segPtr->body.chars); - p += TkUtfToUniChar(p, &ch); + p += Tcl_UtfToUniChar(p, &ch); indexPtr->byteIndex += p - start; } break; @@ -1665,7 +1665,7 @@ TkTextIndexForwChars( if (segPtr->typePtr == &tkTextCharType) { start = segPtr->body.chars + byteOffset; end = segPtr->body.chars + segPtr->size; - for (p = start; p < end; p += TkUtfToUniChar(p, &ch)) { + for (p = start; p < end; p += Tcl_UtfToUniChar(p, &ch)) { if (charCount == 0) { dstPtr->byteIndex += (p - start); goto forwardCharDone; @@ -2397,7 +2397,7 @@ StartEnd( if (segPtr->typePtr == &tkTextCharType) { int ch; - chSize = TkUtfToUniChar(segPtr->body.chars + offset, &ch); + chSize = Tcl_UtfToUniChar(segPtr->body.chars + offset, &ch); if (!Tcl_UniCharIsWordChar(ch)) { break; } @@ -2442,7 +2442,7 @@ StartEnd( if (segPtr->typePtr == &tkTextCharType) { int ch; - TkUtfToUniChar(segPtr->body.chars + offset, &ch); + Tcl_UtfToUniChar(segPtr->body.chars + offset, &ch); if (!Tcl_UniCharIsWordChar(ch)) { break; } diff --git a/generic/tkUtil.c b/generic/tkUtil.c index d3bf058..b4ce9fe 100644 --- a/generic/tkUtil.c +++ b/generic/tkUtil.c @@ -1246,79 +1246,6 @@ Tk_SendVirtualEvent( Tk_QueueWindowEvent(&event.general, TCL_QUEUE_TAIL); } -#if TCL_UTF_MAX < 4 -/* - *--------------------------------------------------------------------------- - * - * TkUtfToUniChar -- - * - * Almost the same as Tcl_UtfToUniChar but using int instead of Tcl_UniChar. - * This function is capable of collapsing a upper/lower surrogate pair to a - * single unicode character. So, up to 6 bytes might be consumed. - * - * Results: - * *chPtr is filled with the Tcl_UniChar, and the return value is the - * number of bytes from the UTF-8 string that were consumed. - * - * Side effects: - * None. - * - *--------------------------------------------------------------------------- - */ - -size_t -TkUtfToUniChar( - const char *src, /* The UTF-8 string. */ - int *chPtr) /* Filled with the Unicode value represented by - * the UTF-8 string. */ -{ - Tcl_UniChar uniChar = 0; - - size_t len = Tcl_UtfToUniChar(src, &uniChar); - if ((uniChar & 0xFC00) == 0xD800) { - Tcl_UniChar low = uniChar; - /* This can only happen if sizeof(Tcl_UniChar)== 2 and src points - * to a character > U+FFFF */ - size_t len2 = Tcl_UtfToUniChar(src+len, &low); - if ((low & 0xFC00) == 0xDC00) { - *chPtr = (((uniChar & 0x3FF) << 10) | (low & 0x3FF)) + 0x10000; - return len + len2; - } - } - *chPtr = uniChar; - return len; -} - -/* - *--------------------------------------------------------------------------- - * - * TkUniCharToUtf -- - * - * Almost the same as Tcl_UniCharToUtf but producing 2 x 3-byte UTF-8 - * sequences for out-of-bmp characters when TCL_UTF_MAX==3. - * So, up to 6 bytes might be produced. - * - * Results: - * *buf is filled with the UTF-8 string, and the return value is the - * number of bytes produced. - * - * Side effects: - * None. - * - *--------------------------------------------------------------------------- - */ - -size_t TkUniCharToUtf(int ch, char *buf) -{ - if ((unsigned)(ch - 0x10000) <= 0xFFFFF) { - /* Spit out a 4-byte UTF-8 character or 2 x 3-byte UTF-8 characters, depending on Tcl - * version and/or TCL_UTF_MAX build value */ - int len = Tcl_UniCharToUtf(0xD800 | ((ch - 0x10000) >> 10), buf); - return len + Tcl_UniCharToUtf(0xDC00 | (ch & 0x7FF), buf + len); - } - return Tcl_UniCharToUtf(ch, buf); -} -#endif /* * Local Variables: * mode: c diff --git a/generic/ttk/ttkEntry.c b/generic/ttk/ttkEntry.c index f0fe2fc..66d6e3d 100644 --- a/generic/ttk/ttkEntry.c +++ b/generic/ttk/ttkEntry.c @@ -300,8 +300,8 @@ static char *EntryDisplayString(const char *showChar, int numChars) int ch; char buf[6]; - TkUtfToUniChar(showChar, &ch); - size = TkUniCharToUtf(ch, buf); + Tcl_UtfToUniChar(showChar, &ch); + size = Tcl_UniCharToUtf(ch, buf); p = displayString = (char *)ckalloc(numChars * size + 1); while (numChars--) { @@ -458,7 +458,7 @@ ExpandPercents( */ ++templ; /* skip over % */ if (*templ != '\0') { - templ += TkUtfToUniChar(templ, &ch); + templ += Tcl_UtfToUniChar(templ, &ch); } else { ch = '%'; } @@ -508,7 +508,7 @@ ExpandPercents( string = Tk_PathName(entryPtr->core.tkwin); break; default: - length = TkUniCharToUtf(ch, numStorage); + length = Tcl_UniCharToUtf(ch, numStorage); numStorage[length] = '\0'; string = numStorage; break; diff --git a/macosx/tkMacOSXKeyboard.c b/macosx/tkMacOSXKeyboard.c index ef0d678..c7127ef 100644 --- a/macosx/tkMacOSXKeyboard.c +++ b/macosx/tkMacOSXKeyboard.c @@ -501,7 +501,7 @@ TkpGetString( macKC.uint = eventPtr->xkey.keycode; if (IS_PRINTABLE(macKC.v.keychar)) { - length = TkUniCharToUtf(macKC.v.keychar, utfChars); + length = Tcl_UniCharToUtf(macKC.v.keychar, utfChars); } utfChars[length] = 0; diff --git a/unix/Makefile.in b/unix/Makefile.in index da17df8..9724995 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -335,7 +335,7 @@ CC_SWITCHES_NO_STUBS = -I${UNIX_DIR} -I${GENERIC_DIR} -I${BMAP_DIR} \ ${@TK_WINDOWINGSYSTEM@_INCLUDES} ${CFLAGS} ${CFLAGS_WARNING} \ ${SHLIB_CFLAGS} -I${TCL_GENERIC_DIR} -I${TCL_PLATFORM_DIR} ${AC_FLAGS} \ ${PROTO_FLAGS} ${SECURITY_FLAGS} ${MEM_DEBUG_FLAGS} ${KEYSYM_FLAGS} \ -${NO_DEPRECATED_FLAGS} -DTCL_UTF_MAX=3 @EXTRA_CC_SWITCHES@ +${NO_DEPRECATED_FLAGS} -DTCL_UTF_MAX=4 @EXTRA_CC_SWITCHES@ CC_SWITCHES = $(CC_SWITCHES_NO_STUBS) @TCL_STUB_FLAGS@ diff --git a/unix/tkUnixFont.c b/unix/tkUnixFont.c index 87863a2..d7e2cff 100644 --- a/unix/tkUnixFont.c +++ b/unix/tkUnixFont.c @@ -393,7 +393,7 @@ ControlUtfProc( result = TCL_CONVERT_NOSPACE; break; } - src += TkUtfToUniChar(src, &ch); + src += Tcl_UtfToUniChar(src, &ch); dst[0] = '\\'; if (((size_t)ch < sizeof(mapChars)) && (mapChars[ch] != 0)) { dst[1] = mapChars[ch]; @@ -843,7 +843,7 @@ Tk_MeasureChars( curX = 0; end = source + numBytes; for (p = source; p < end; ) { - next = p + TkUtfToUniChar(p, &ch); + next = p + Tcl_UtfToUniChar(p, &ch); thisSubFontPtr = FindSubFontForChar(fontPtr, ch, &lastSubFontPtr); if (thisSubFontPtr != lastSubFontPtr) { familyPtr = lastSubFontPtr->familyPtr; @@ -890,7 +890,7 @@ Tk_MeasureChars( * individually. */ - next = source + TkUtfToUniChar(source, &ch); + next = source + Tcl_UtfToUniChar(source, &ch); newX = curX = termX = 0; term = source; @@ -925,7 +925,7 @@ Tk_MeasureChars( break; } - next += TkUtfToUniChar(next, &ch); + next += Tcl_UtfToUniChar(next, &ch); if ((ch < 256) && isspace(ch)) { if (sawNonSpace) { term = p; @@ -950,13 +950,13 @@ Tk_MeasureChars( */ curX = newX; - p += TkUtfToUniChar(p, &ch); + p += Tcl_UtfToUniChar(p, &ch); } if ((flags & TK_AT_LEAST_ONE) && (term == source) && (p < end)) { term = p; termX = curX; if (term == source) { - term += TkUtfToUniChar(term, &ch); + term += Tcl_UtfToUniChar(term, &ch); termX = newX; } } else if ((p >= end) || !(flags & TK_WHOLE_WORDS)) { @@ -1102,7 +1102,7 @@ Tk_DrawChars( needWidth = fontPtr->font.fa.underline + fontPtr->font.fa.overstrike; for (p = source; p <= end; ) { if (p < end) { - next = p + TkUtfToUniChar(p, &ch); + next = p + Tcl_UtfToUniChar(p, &ch); thisSubFontPtr = FindSubFontForChar(fontPtr, ch, &lastSubFontPtr); } else { next = p + 1; @@ -2079,7 +2079,7 @@ FontMapLoadPage( for (i = row << FONTMAP_SHIFT; i < end; i++) { int hi, lo; - if (Tcl_UtfToExternal(NULL, encoding, src, TkUniCharToUtf(i, src), + if (Tcl_UtfToExternal(NULL, encoding, src, Tcl_UniCharToUtf(i, src), TCL_ENCODING_PROFILE_STRICT, NULL, buf, sizeof(buf), NULL, NULL, NULL) != TCL_OK) { continue; @@ -2275,7 +2275,7 @@ CanUseFallback( } nameListOrig = nameList; - srcLen = TkUniCharToUtf(ch, src); + srcLen = Tcl_UniCharToUtf(ch, src); want.fa = fontPtr->font.fa; want.xa = fontPtr->xa; diff --git a/unix/tkUnixKey.c b/unix/tkUnixKey.c index c595fbb..933a690 100644 --- a/unix/tkUnixKey.c +++ b/unix/tkUnixKey.c @@ -196,7 +196,7 @@ TkpGetString( Tcl_DStringValue(&buf)[len] = '\0'; if (len == 1) { - len = TkUniCharToUtf((unsigned char) Tcl_DStringValue(&buf)[0], + len = Tcl_UniCharToUtf((unsigned char) Tcl_DStringValue(&buf)[0], Tcl_DStringValue(dsPtr)); Tcl_DStringSetLength(dsPtr, len); } else { diff --git a/unix/tkUnixMenu.c b/unix/tkUnixMenu.c index 7f9ad7d..c091755 100644 --- a/unix/tkUnixMenu.c +++ b/unix/tkUnixMenu.c @@ -867,7 +867,7 @@ DrawMenuUnderline( label = Tcl_GetString(mePtr->labelPtr); start = Tcl_UtfAtIndex(label, (mePtr->underline < 0) ? mePtr->underline + len : mePtr->underline); - end = start + TkUtfToUniChar(start, &ch); + end = start + Tcl_UtfToUniChar(start, &ch); Tk_GetPixelsFromObj(NULL, menuPtr->tkwin, menuPtr->activeBorderWidthPtr, &activeBorderWidth); diff --git a/unix/tkUnixRFont.c b/unix/tkUnixRFont.c index 72692fc..d295a89 100644 --- a/unix/tkUnixRFont.c +++ b/unix/tkUnixRFont.c @@ -80,7 +80,7 @@ TCL_DECLARE_MUTEX(xftMutex); static int utf8ToUcs4(const char *source, FcChar32 *c, int numBytes) { if (numBytes >= 6) { - return TkUtfToUniChar(source, (int *)c); + return Tcl_UtfToUniChar(source, (int *)c); } return FcUtf8ToUcs4((const FcChar8 *)source, c, numBytes); } @@ -744,7 +744,7 @@ Tk_MeasureChars( while (numBytes > 0) { int unichar; - clen = TkUtfToUniChar(source, &unichar); + clen = Tcl_UtfToUniChar(source, &unichar); c = (FcChar32) unichar; if (clen <= 0) { diff --git a/win/Makefile.in b/win/Makefile.in index 8e2a9dc..a101ac9 100644 --- a/win/Makefile.in +++ b/win/Makefile.in @@ -261,7 +261,7 @@ CC_SWITCHES = ${CFLAGS} ${CFLAGS_WARNING} ${SHLIB_CFLAGS} \ -I"${GENERIC_DIR_NATIVE}" -I"${WIN_DIR_NATIVE}" \ -I"${XLIB_DIR_NATIVE}" -I"${BITMAP_DIR_NATIVE}" \ -I"${TCL_GENERIC_NATIVE}" -I"${TCL_PLATFORM_NATIVE}" \ -${AC_FLAGS} $(NO_DEPRECATED_FLAGS) -DTCL_UTF_MAX=3 -DUSE_TCL_STUBS +${AC_FLAGS} $(NO_DEPRECATED_FLAGS) -DTCL_UTF_MAX=4 -DUSE_TCL_STUBS CC_OBJNAME = @CC_OBJNAME@ CC_EXENAME = @CC_EXENAME@ diff --git a/win/makefile.vc b/win/makefile.vc index 910a0ce..a5347b1 100644 --- a/win/makefile.vc +++ b/win/makefile.vc @@ -337,7 +337,7 @@ PRJ_INCLUDES = -I"$(BITMAPDIR)" -I"$(XLIBDIR)" CONFIG_DEFS =/DHAVE_SYS_TYPES_H=1 /DHAVE_SYS_STAT_H=1 \
/DHAVE_STRING_H=1 /DHAVE_MEMORY_H=1 \
- /DHAVE_STRINGS_H=1 /DTCL_UTF_MAX=3 \
+ /DHAVE_STRINGS_H=1 /DTCL_UTF_MAX=4 \
!if $(TTK_SQUARE_WIDGET)
/DTTK_SQUARE_WIDGET=1 \
!endif
diff --git a/win/tkWinFont.c b/win/tkWinFont.c index dc74aea..85a2249 100644 --- a/win/tkWinFont.c +++ b/win/tkWinFont.c @@ -846,7 +846,7 @@ Tk_MeasureChars( start = source; end = start + numBytes; for (p = start; p < end; ) { - next = p + TkUtfToUniChar(p, &ch); + next = p + Tcl_UtfToUniChar(p, &ch); thisSubFontPtr = FindSubFontForChar(fontPtr, ch, &lastSubFontPtr); if (thisSubFontPtr != lastSubFontPtr) { familyPtr = lastSubFontPtr->familyPtr; @@ -907,7 +907,7 @@ Tk_MeasureChars( familyPtr = lastSubFontPtr->familyPtr; Tcl_DStringInit(&runString); for (p = start; p < end; ) { - next = p + TkUtfToUniChar(p, &ch); + next = p + Tcl_UtfToUniChar(p, &ch); Tcl_UtfToExternal(NULL, familyPtr->encoding, p, (int) (next - p), TCL_ENCODING_PROFILE_TCL8, NULL, buf, sizeof(buf), NULL, &dstWrote, NULL); @@ -962,7 +962,7 @@ Tk_MeasureChars( p = source; ch = ' '; while (p < end) { - next = p + TkUtfToUniChar(p, &ch2); + next = p + Tcl_UtfToUniChar(p, &ch2); if ((ch != ' ') && (ch2 == ' ')) { lastWordBreak = p; } @@ -1479,7 +1479,7 @@ MultiFontTextOut( end = source + numBytes; for (p = source; p < end; ) { - next = p + TkUtfToUniChar(p, &ch); + next = p + Tcl_UtfToUniChar(p, &ch); thisSubFontPtr = FindSubFontForChar(fontPtr, ch, &lastSubFontPtr); /* @@ -2262,7 +2262,7 @@ FontMapLoadPage( end = (row + 1) << FONTMAP_SHIFT; for (i = row << FONTMAP_SHIFT; i < end; i++) { if (Tcl_UtfToExternal(NULL, encoding, src, - TkUniCharToUtf(i, src), TCL_ENCODING_PROFILE_STRICT, NULL, + Tcl_UniCharToUtf(i, src), TCL_ENCODING_PROFILE_STRICT, NULL, buf, sizeof(buf), NULL, NULL, NULL) != TCL_OK) { continue; } diff --git a/win/tkWinKey.c b/win/tkWinKey.c index 5be9e0e..f2230c9 100644 --- a/win/tkWinKey.c +++ b/win/tkWinKey.c @@ -113,7 +113,7 @@ TkpGetString( * Special case for WM_UNICHAR and win2000 multilingual IME input */ - len = TkUniCharToUtf(keyEv->keycode, buf); + len = Tcl_UniCharToUtf(keyEv->keycode, buf); Tcl_DStringAppend(dsPtr, buf, len); } else { /* @@ -125,7 +125,7 @@ TkpGetString( if (((keysym != NoSymbol) && (keysym > 0) && (keysym < 256)) || (keysym == XK_Return) || (keysym == XK_Tab)) { - len = TkUniCharToUtf(keysym & 255, buf); + len = Tcl_UniCharToUtf(keysym & 255, buf); Tcl_DStringAppend(dsPtr, buf, len); } } diff --git a/win/tkWinMenu.c b/win/tkWinMenu.c index 96b3e1c..91d80e2 100644 --- a/win/tkWinMenu.c +++ b/win/tkWinMenu.c @@ -2111,7 +2111,7 @@ DrawMenuUnderline( label = Tcl_GetString(mePtr->labelPtr); start = Tcl_UtfAtIndex(label, mePtr->underline); - end = start + TkUtfToUniChar(start, &ch); + end = start + Tcl_UtfToUniChar(start, &ch); Tk_UnderlineChars(menuPtr->display, d, gc, tkfont, label, x + mePtr->indicatorSpace, y + (height + fmPtr->ascent - fmPtr->descent) / 2, |