diff options
-rw-r--r-- | unix/tkUnixFont.c | 8 | ||||
-rw-r--r-- | win/tkWinFont.c | 5 |
2 files changed, 6 insertions, 7 deletions
diff --git a/unix/tkUnixFont.c b/unix/tkUnixFont.c index 41b2df1..c1b1b14 100644 --- a/unix/tkUnixFont.c +++ b/unix/tkUnixFont.c @@ -37,8 +37,8 @@ static const char *const encodingList[] = { #define FONTMAP_SHIFT 10 -#define FONTMAP_PAGES (1 << (sizeof(Tcl_UniChar)*8 - FONTMAP_SHIFT)) #define FONTMAP_BITSPERPAGE (1 << FONTMAP_SHIFT) +#define FONTMAP_PAGES (0x30000 / FONTMAP_BITSPERPAGE) typedef struct FontFamily { struct FontFamily *nextPtr; /* Next in list of all known font families. */ @@ -1972,11 +1972,11 @@ FindSubFontForChar( SubFont *subFontPtr; Tcl_DString ds; - if (FontMapLookup(&fontPtr->subFontArray[0], ch)) { - return &fontPtr->subFontArray[0]; + if (ch > 0x30000) { + ch = 0xfffd; } - for (i = 1; i < fontPtr->numSubFonts; i++) { + for (i = 0; i < fontPtr->numSubFonts; i++) { if (FontMapLookup(&fontPtr->subFontArray[i], ch)) { return &fontPtr->subFontArray[i]; } diff --git a/win/tkWinFont.c b/win/tkWinFont.c index ad7738f..4351f99 100644 --- a/win/tkWinFont.c +++ b/win/tkWinFont.c @@ -28,8 +28,8 @@ #define FONTMAP_SHIFT 10 -#define FONTMAP_PAGES (1 << (sizeof(Tcl_UniChar)*8 - FONTMAP_SHIFT)) #define FONTMAP_BITSPERPAGE (1 << FONTMAP_SHIFT) +#define FONTMAP_PAGES (0x30000 / FONTMAP_BITSPERPAGE) typedef struct FontFamily { struct FontFamily *nextPtr; /* Next in list of all known font families. */ @@ -1943,8 +1943,7 @@ FindSubFontForChar( SubFont *subFontPtr; Tcl_DString ds; - - if ((ch < BASE_CHARS) || (ch >= 0x10000)) { + if ((ch < BASE_CHARS) || (ch >= 0x30000)) { return &fontPtr->subFontArray[0]; } |