summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2019-09-17 08:25:55 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2019-09-17 08:25:55 (GMT)
commit862f1a276482cc4ca6bf3d1f03709ab1e270c349 (patch)
tree2747bb16f7e192e364d16715fd36c74cdfb3bb06 /win
parent487b808fa7ad1096e9ee4112a719c8ed3cd45ff8 (diff)
parent932a496abd3c78e24e4723792850205193d43f4d (diff)
downloadtk-862f1a276482cc4ca6bf3d1f03709ab1e270c349.zip
tk-862f1a276482cc4ca6bf3d1f03709ab1e270c349.tar.gz
tk-862f1a276482cc4ca6bf3d1f03709ab1e270c349.tar.bz2
Fix [a179564826] for Windows/UNIX: It is now possible to display Emoji on Windows/UNIX (characters below /U30000), when compiled against the tip of core-8-6-branch.
On Mac, more work is required, so not closing this ticket yet.
Diffstat (limited to 'win')
-rw-r--r--win/tkWinFont.c21
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);
}
/*