From b0a00d3509297a53ffb5618cee122e1b1d995f42 Mon Sep 17 00:00:00 2001 From: Context Git Mirror Bot Date: Thu, 14 Jan 2016 10:15:07 +0100 Subject: 2016-01-14 09:57:00 --- tex/generic/context/luatex/luatex-fonts-merged.lua | 34 +++++++++------------- 1 file changed, 14 insertions(+), 20 deletions(-) (limited to 'tex/generic') diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 5f138d407..c1e2902c6 100644 --- a/tex/generic/context/luatex/luatex-fonts-merged.lua +++ b/tex/generic/context/luatex/luatex-fonts-merged.lua @@ -1,6 +1,6 @@ -- merged file : c:/data/develop/context/sources/luatex-fonts-merged.lua -- parent file : c:/data/develop/context/sources/luatex-fonts.lua --- merge date : 01/13/16 15:10:24 +-- merge date : 01/14/16 09:55:22 do -- begin closure to overcome local limits and interference @@ -5489,25 +5489,22 @@ end local f_single=formatters["%04X"] local f_double=formatters["%04X%04X"] local function tounicode16(unicode,name) - if unicode<0x10000 then + if unicode<0xD7FF or (unicode>0xDFFF and unicode<=0xFFFF) then return f_single(unicode) - elseif unicode<0x1FFFFFFFF then - return f_double(floor(unicode/1024),unicode%1024+0xDC00) else - report_fonts("can't convert %a in %a into tounicode",unicode,name) + unicode=unicode-0x10000 + return f_double(floor(unicode/1024)+0xD800,unicode%1024+0xDC00) end end local function tounicode16sequence(unicodes,name) local t={} for l=1,#unicodes do local u=unicodes[l] - if u<0x10000 then + if u<0xD7FF or (u>0xDFFF and u<=0xFFFF) then t[l]=f_single(u) - elseif unicode<0x1FFFFFFFF then - t[l]=f_double(floor(u/1024),u%1024+0xDC00) else - report_fonts ("can't convert %a in %a into tounicode",u,name) - return + u=u-0x10000 + t[l]=f_double(floor(u/1024)+0xD800,u%1024+0xDC00) end end return concat(t) @@ -5517,23 +5514,20 @@ local function tounicode(unicode,name) local t={} for l=1,#unicode do local u=unicode[l] - if u<0x10000 then + if u<0xD7FF or (u>0xDFFF and u<=0xFFFF) then t[l]=f_single(u) - elseif u<0x1FFFFFFFF then - t[l]=f_double(floor(u/1024),u%1024+0xDC00) else - report_fonts ("can't convert %a in %a into tounicode",u,name) - return + u=u-0x10000 + t[l]=f_double(floor(u/1024)+0xD800,u%1024+0xDC00) end end return concat(t) else - if unicode<0x10000 then + if unicode<0xD7FF or (unicode>0xDFFF and unicode<=0xFFFF) then return f_single(unicode) - elseif unicode<0x1FFFFFFFF then - return f_double(floor(unicode/1024),unicode%1024+0xDC00) else - report_fonts("can't convert %a in %a into tounicode",unicode,name) + unicode=unicode-0x10000 + return f_double(floor(unicode/1024)+0xD800,unicode%1024+0xDC00) end end end @@ -5542,7 +5536,7 @@ local function fromunicode16(str) return tonumber(str,16) else local l,r=match(str,"(....)(....)") - return (tonumber(l,16))*0x400+tonumber(r,16)-0xDC00 + return 0x10000+(tonumber(l,16)-0xD800)*0x400+tonumber(r,16)-0xDC00 end end mappings.makenameparser=makenameparser -- cgit v1.2.3