diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2019-11-19 15:31:13 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2019-11-19 15:31:13 (GMT) |
commit | b0c0fd5b5c9aa88e74e5a954d9f86423b434d606 (patch) | |
tree | 041b1deba618a2d7ef649d05441923d6f954331d /unix | |
parent | ac36024031479affd0b2b5ada200d04659b61bdc (diff) | |
download | tk-b0c0fd5b5c9aa88e74e5a954d9f86423b434d606.zip tk-b0c0fd5b5c9aa88e74e5a954d9f86423b434d606.tar.gz tk-b0c0fd5b5c9aa88e74e5a954d9f86423b434d606.tar.bz2 |
Experiment: See if this is enough to make Emoji work with Xft on X11
Diffstat (limited to 'unix')
-rw-r--r-- | unix/tkUnixRFont.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/unix/tkUnixRFont.c b/unix/tkUnixRFont.c index 10e5aca..31b28c5 100644 --- a/unix/tkUnixRFont.c +++ b/unix/tkUnixRFont.c @@ -65,6 +65,14 @@ static Tcl_ThreadDataKey dataKey; #define TCL_CFGVAL_ENCODING "ascii" #endif +static int utf8ToUcs4(const char *source, FcChar32 *c, int numBytes) +{ + if (numBytes >= 6) { + return TkUtfToUniChar(source, (int *)c); + } + return FcUtf8ToUcs4((const FcChar8 *)source, c, numBytes); +} + void TkpFontPkgInit( TkMainInfo *mainPtr) /* The application being created. */ @@ -894,7 +902,7 @@ Tk_DrawChars( XftFont *ftFont; FcChar32 c; - clen = FcUtf8ToUcs4((FcChar8 *) source, &c, numBytes); + clen = utf8ToUcs4(source, &c, numBytes); if (clen <= 0) { /* * This should not happen, but it can. @@ -1034,7 +1042,7 @@ TkDrawAngledChars( XftFont *ftFont; FcChar32 c; - clen = FcUtf8ToUcs4((FcChar8 *) source, &c, numBytes); + clen = utf8ToUcs4(source, &c, numBytes); if (clen <= 0) { /* * This should not happen, but it can. @@ -1138,7 +1146,7 @@ TkDrawAngledChars( XftFont *ftFont, *ft0Font; FcChar32 c; - clen = FcUtf8ToUcs4((FcChar8 *) source, &c, numBytes); + clen = utf8ToUcs4(source, &c, numBytes); if (clen <= 0) { /* * This should not happen, but it can. |