summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/mkiv/font-map.lua
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/context/base/mkiv/font-map.lua')
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/font-map.lua160
1 files changed, 31 insertions, 129 deletions
diff --git a/Master/texmf-dist/tex/context/base/mkiv/font-map.lua b/Master/texmf-dist/tex/context/base/mkiv/font-map.lua
index d931b822e55..66cf2db3996 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/font-map.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/font-map.lua
@@ -168,73 +168,44 @@ local function tounicode16sequence(unicodes)
return concat(t)
end
--- local function tounicode(unicode)
--- if type(unicode) == "table" then
--- local t = { }
--- for l=1,#unicode do
--- local u = unicode[l]
--- if u < 0xD7FF or (u > 0xDFFF and u <= 0xFFFF) then
--- t[l] = f_single(u)
--- else
--- u = u - 0x10000
--- t[l] = f_double(rshift(u,10)+0xD800,u%1024+0xDC00)
--- end
--- end
--- return concat(t)
--- else
--- if unicode < 0xD7FF or (unicode > 0xDFFF and unicode <= 0xFFFF) then
--- return f_single(unicode)
--- else
--- unicode = unicode - 0x10000
--- return f_double(rshift(unicode,10)+0xD800,unicode%1024+0xDC00)
--- end
--- end
--- end
+local function tounicode(unicode)
+ if type(unicode) == "table" then
+ local t = { }
+ for l=1,#unicode do
+ local u = unicode[l]
+ if u < 0xD7FF or (u > 0xDFFF and u <= 0xFFFF) then
+ t[l] = f_single(u)
+ else
+ u = u - 0x10000
+ t[l] = f_double(rshift(u,10)+0xD800,u%1024+0xDC00)
+ end
+ end
+ return concat(t)
+ else
+ if unicode < 0xD7FF or (unicode > 0xDFFF and unicode <= 0xFFFF) then
+ return f_single(unicode)
+ else
+ unicode = unicode - 0x10000
+ return f_double(rshift(unicode,10)+0xD800,unicode%1024+0xDC00)
+ end
+ end
+end
-local unknown = f_single(0xFFFD)
+-- no real gain on runs
--- local function tounicode(unicode)
--- if type(unicode) == "table" then
--- local t = { }
--- for l=1,#unicode do
--- t[l] = tounicode(unicode[l])
--- end
--- return concat(t)
--- elseif unicode >= 0x00E000 and unicode <= 0x00F8FF then
--- return unknown
--- elseif unicode >= 0x0F0000 and unicode <= 0x0FFFFF then
--- return unknown
--- elseif unicode >= 0x100000 and unicode <= 0x10FFFF then
--- return unknown
--- elseif unicode < 0xD7FF or (unicode > 0xDFFF and unicode <= 0xFFFF) then
--- return f_single(unicode)
--- else
--- unicode = unicode - 0x10000
--- return f_double(rshift(unicode,10)+0xD800,unicode%1024+0xDC00)
--- end
--- end
-
--- local hash = table.setmetatableindex(function(t,k)
+-- local hash = table.setmetatableindex(function(t,u)
-- local v
--- if k >= 0x00E000 and k <= 0x00F8FF then
--- v = unknown
--- elseif k >= 0x0F0000 and k <= 0x0FFFFF then
--- v = unknown
--- elseif k >= 0x100000 and k <= 0x10FFFF then
--- v = unknown
--- elseif k < 0xD7FF or (k > 0xDFFF and k <= 0xFFFF) then
--- v = f_single(k)
+-- if u < 0xD7FF or (u > 0xDFFF and u <= 0xFFFF) then
+-- v = f_single(u)
-- else
--- local k = k - 0x10000
--- v = f_double(rshift(k,10)+0xD800,k%1024+0xDC00)
+-- u = u - 0x10000
+-- v = f_double(rshift(u,10)+0xD800,u%1024+0xDC00)
-- end
--- t[k] = v
+-- t[u] = v
-- return v
-- end)
--
--- table.makeweak(hash)
---
--- local function tounicode(unicode)
+-- local function tounicode(unicode,name)
-- if type(unicode) == "table" then
-- local t = { }
-- for l=1,#unicode do
@@ -246,69 +217,6 @@ local unknown = f_single(0xFFFD)
-- end
-- end
-local hash = { }
-local conc = { }
-
--- table.makeweak(hash)
-
--- table.setmetatableindex(hash,function(t,k)
--- if type(k) == "table" then
--- local n = #k
--- for l=1,n do
--- conc[l] = hash[k[l]]
--- end
--- return concat(conc,"",1,n)
--- end
--- local v
--- if k >= 0x00E000 and k <= 0x00F8FF then
--- v = unknown
--- elseif k >= 0x0F0000 and k <= 0x0FFFFF then
--- v = unknown
--- elseif k >= 0x100000 and k <= 0x10FFFF then
--- v = unknown
--- elseif k < 0xD7FF or (k > 0xDFFF and k <= 0xFFFF) then
--- v = f_single(k)
--- else
--- local k = k - 0x10000
--- v = f_double(rshift(k,10)+0xD800,k%1024+0xDC00)
--- end
--- t[k] = v
--- return v
--- end)
---
--- local function tounicode(unicode)
--- return hash[unicode]
--- end
-
-table.setmetatableindex(hash,function(t,k)
- if k < 0xD7FF or (k > 0xDFFF and k <= 0xFFFF) then
- v = f_single(k)
- else
- local k = k - 0x10000
- v = f_double(rshift(k,10)+0xD800,k%1024+0xDC00)
- end
- t[k] = v
- return v
-end)
-
-local function tounicode(k)
- if type(k) == "table" then
- local n = #k
- for l=1,n do
- conc[l] = hash[k[l]]
- end
- return concat(conc,"",1,n)
- elseif k >= 0x00E000 and k <= 0x00F8FF then
- return unknown
- elseif k >= 0x0F0000 and k <= 0x0FFFFF then
- return unknown
- elseif k >= 0x100000 and k <= 0x10FFFF then
- return unknown
- else
- return hash[k]
- end
-end
-
local function fromunicode16(str)
if #str == 4 then
return tonumber(str,16)
@@ -523,8 +431,7 @@ function mappings.addtounicode(data,filename,checklookups,forceligatures)
glyph.unicode = unicode
end
else
- local t = { }
- local n = 0
+ local t, n = { }, 0
for l=1,nsplit do
local base = split[l]
local u = unicodes[base] or unicodevector[base] or contextvector[name]
@@ -580,17 +487,12 @@ function mappings.addtounicode(data,filename,checklookups,forceligatures)
missing[du] = true
nofmissing = nofmissing + 1
end
- else
- -- maybe a message or so
end
end
else
local overload = overloads[du]
if overload then
glyph.unicode = overload.unicode
- elseif not glyph.unicode then
- missing[du] = true
- nofmissing = nofmissing + 1
end
end
end