diff options
author | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2016-01-13 23:17:20 +0000 |
---|---|---|
committer | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2016-01-13 23:17:20 +0000 |
commit | 3f1054970ca1ba37c765f5a63d74b221e37120a7 (patch) | |
tree | ee350d7ead2f08f11c67eeb0704232c2ca95bba8 /Build | |
parent | 9580e6ab00cfd29e95ce12a2b69ba4ef165b7221 (diff) |
web2c/luatexdir: sync with the upstream
git-svn-id: svn://tug.org/texlive/trunk@39378 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build')
-rw-r--r-- | Build/source/texk/web2c/luatexdir/font/luafont.w | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/Build/source/texk/web2c/luatexdir/font/luafont.w b/Build/source/texk/web2c/luatexdir/font/luafont.w index 4c26ca5137d..6843cef5cd0 100644 --- a/Build/source/texk/web2c/luatexdir/font/luafont.w +++ b/Build/source/texk/web2c/luatexdir/font/luafont.w @@ -1050,16 +1050,15 @@ static void font_char_from_lua(lua_State * L, internal_font_number f, int i, int u = lua_tointeger(L,-1); if (u < 0) { set_charinfo_tounicode(co, NULL); - } else if (u < 0x10000) { + } else if (u < 0xD7FF || (u > 0xDFFF && u <= 0xFFFF)) { char *s = malloc(5); sprintf(s,"%04X",(unsigned int) u); set_charinfo_tounicode(co,s); - } else if (u < 0x1FFFFFFFFF) { + } else { char *s = malloc(9); - sprintf(s,"%04X%04X",(unsigned int) (floor(u/1024)),(unsigned int) (u%1024+0xDC00)); + u = u - 0x10000; + sprintf(s,"%04X%04X",(unsigned int) (floor(u/1024)+0xD800),(unsigned int) (u%1024+0xDC00)); set_charinfo_tounicode(co,s); - } else { - set_charinfo_tounicode(co, NULL); } } else if (u == LUA_TTABLE) { n = lua_rawlen(L,-1); @@ -1076,14 +1075,10 @@ static void font_char_from_lua(lua_State * L, internal_font_number f, int i, int u = -1; lua_pop(L, 1); break; - } else if (u < 0x10000) { + } else if (u < 0xD7FF || (u > 0xDFFF && u <= 0xFFFF)) { u = u + 4; - } else if (u < 0x1FFFFFFFFF) { - u = u + 8; } else { - u = -1; - lua_pop(L, 1); - break; + u = u + 8; } lua_pop(L, 1); } @@ -1093,11 +1088,12 @@ static void font_char_from_lua(lua_State * L, internal_font_number f, int i, int for (k = 1; k <= n; k++) { lua_rawgeti(L, -1, k); u = lua_tointeger(L,-1); - if (u < 0x10000) { + if (u < 0xD7FF || (u > 0xDFFF && u <= 0xFFFF)) { sprintf(t,"%04X",(unsigned int) u); t += 4; } else { - sprintf(t,"%04X%04X",(unsigned int) (floor(u/1024)),(unsigned int) (u%1024+0xDC00)); + u = u - 0x10000; + sprintf(t,"%04X%04X",(unsigned int) (floor(u/1024)+0xD800),(unsigned int) (u%1024+0xDC00)); t += 8; } lua_pop(L, 1); |