diff options
Diffstat (limited to 'unix/tkUnixFont.c')
-rw-r--r-- | unix/tkUnixFont.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/unix/tkUnixFont.c b/unix/tkUnixFont.c index ce4eca9..4a466f1 100644 --- a/unix/tkUnixFont.c +++ b/unix/tkUnixFont.c @@ -35,8 +35,9 @@ static const char *const encodingList[] = { * family": the foundry, face name, and charset. */ -#define FONTMAP_SHIFT 12 -#define FONTMAP_PAGES (1 << (21 - FONTMAP_SHIFT)) +#define FONTMAP_SHIFT 10 + +#define FONTMAP_PAGES (1 << (sizeof(Tcl_UniChar)*8 - FONTMAP_SHIFT)) #define FONTMAP_BITSPERPAGE (1 << FONTMAP_SHIFT) typedef struct FontFamily { @@ -520,7 +521,7 @@ Ucs2beToUtfProc( srcEnd = src + srcLen; dstStart = dst; - dstEnd = dst + dstLen - 4; + dstEnd = dst + dstLen - TCL_UTF_MAX; for (numChars = 0; src < srcEnd; numChars++) { if (dst > dstEnd) { @@ -595,7 +596,7 @@ UtfToUcs2beProc( srcEnd = src + srcLen; srcClose = srcEnd; if (!(flags & TCL_ENCODING_END)) { - srcClose -= 4; + srcClose -= TCL_UTF_MAX; } dstStart = dst; @@ -953,7 +954,7 @@ void TkpGetFontAttrsForChar( Tk_Window tkwin, /* Window on the font's display */ Tk_Font tkfont, /* Font to query */ - int c, /* Character of interest */ + int c, /* Character of interest */ TkFontAttributes *faPtr) /* Output: Font attributes */ { FontAttributes atts; @@ -2209,7 +2210,7 @@ FontMapLoadPage( int row) /* Index of the page to be loaded into the * cache. */ { - char buf[16], src[4]; + char buf[16], src[TCL_UTF_MAX]; int minHi, maxHi, minLo, maxLo, scale, checkLo; int i, end, bitOffset, isTwoByteFont, n; Tcl_Encoding encoding; @@ -2413,7 +2414,7 @@ CanUseFallback( unsigned bestScore[2]; char **nameList; char **nameListOrig; - char src[4]; + char src[TCL_UTF_MAX]; FontAttributes want, got; Display *display; SubFont subFont; |