diff options
author | dgp <dgp@users.sourceforge.net> | 2019-09-18 16:37:39 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2019-09-18 16:37:39 (GMT) |
commit | 05e5bd41202409d6adc6b3999de853b8de400cd9 (patch) | |
tree | 1180fa188127446a41d8fb953b7ed423bae2e1c1 /win | |
parent | 439139641c44d7d925b3aa2b2aa2a6183dd33ff0 (diff) | |
parent | 250217d618d22baf0222a0f7fa837f0aab916608 (diff) | |
download | tk-05e5bd41202409d6adc6b3999de853b8de400cd9.zip tk-05e5bd41202409d6adc6b3999de853b8de400cd9.tar.gz tk-05e5bd41202409d6adc6b3999de853b8de400cd9.tar.bz2 |
merge 8.6
Diffstat (limited to 'win')
-rw-r--r-- | win/tkWinFont.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/win/tkWinFont.c b/win/tkWinFont.c index 3b51073..35a9941 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]; } @@ -2116,6 +2115,10 @@ FontMapLookup( { int row, bitOffset; + if (ch < 0 || ch >= 0x30000) { + return 0; + } + row = ch >> FONTMAP_SHIFT; if (subFontPtr->fontMap[row] == NULL) { FontMapLoadPage(subFontPtr, row); @@ -2156,12 +2159,14 @@ FontMapInsert( { int row, bitOffset; - row = ch >> FONTMAP_SHIFT; - if (subFontPtr->fontMap[row] == NULL) { - FontMapLoadPage(subFontPtr, row); + if (ch >= 0 && ch < 0x30000) { + row = ch >> FONTMAP_SHIFT; + if (subFontPtr->fontMap[row] == NULL) { + FontMapLoadPage(subFontPtr, row); + } + bitOffset = ch & (FONTMAP_BITSPERPAGE - 1); + subFontPtr->fontMap[row][bitOffset >> 3] |= 1 << (bitOffset & 7); } - bitOffset = ch & (FONTMAP_BITSPERPAGE - 1); - subFontPtr->fontMap[row][bitOffset >> 3] |= 1 << (bitOffset & 7); } /* |