summaryrefslogtreecommitdiffstats
path: root/unix
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2019-11-19 15:31:13 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2019-11-19 15:31:13 (GMT)
commitb0c0fd5b5c9aa88e74e5a954d9f86423b434d606 (patch)
tree041b1deba618a2d7ef649d05441923d6f954331d /unix
parentac36024031479affd0b2b5ada200d04659b61bdc (diff)
downloadtk-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.c14
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.