summaryrefslogtreecommitdiff
path: root/tex/context/base/mkiv/font-nod.lua
diff options
context:
space:
mode:
authorContext Git Mirror Bot <phg42.2a@gmail.com>2016-03-26 13:38:18 +0100
committerContext Git Mirror Bot <phg42.2a@gmail.com>2016-03-26 13:38:18 +0100
commit788487819ccf38a8478cc2afd88e0c0b088d0ec1 (patch)
tree215addbe3b9e293c2958227e7fc8923880b2e71f /tex/context/base/mkiv/font-nod.lua
parentadfe72d5a0c9d7bdc1bd7bc8faabb4d05e21d70a (diff)
downloadcontext-788487819ccf38a8478cc2afd88e0c0b088d0ec1.tar.gz
2016-03-26 13:07:00
Diffstat (limited to 'tex/context/base/mkiv/font-nod.lua')
-rw-r--r--tex/context/base/mkiv/font-nod.lua55
1 files changed, 26 insertions, 29 deletions
diff --git a/tex/context/base/mkiv/font-nod.lua b/tex/context/base/mkiv/font-nod.lua
index e0e0ca377..7f30b6d5c 100644
--- a/tex/context/base/mkiv/font-nod.lua
+++ b/tex/context/base/mkiv/font-nod.lua
@@ -66,6 +66,7 @@ local getsubtype = nuts.getsubtype
local getchar = nuts.getchar
local getlist = nuts.getlist
local getdisc = nuts.getdisc
+local isglyph = nuts.isglyph
local setfield = nuts.setfield
local setbox = nuts.setbox
@@ -117,14 +118,12 @@ function char_tracers.collect(head,list,tag,n)
n = n or 0
local ok, fn = false, nil
while head do
- local id = getid(head)
- if id == glyph_code then
+ local c, id = isglyph(head)
+ if c then
local f = getfont(head)
if f ~= fn then
ok, fn = false, f
end
- local c = getchar(head)
- -- local i = fontidentifiers[f].indices[c] or 0 -- zero anyway as indices is nilled
if not ok then
ok = true
n = n + 1
@@ -360,13 +359,14 @@ function step_tracers.codes(i,command,space)
local c = collection[i]
local function showchar(c)
+ local f = getfont(c)
+ local c = getchar(c)
if command then
- local f, c = getfont(c), getchar(c)
local d = fontdescriptions[f]
local d = d and d[c]
context[command](f,c,d and d.class or "")
else
- context("[%s:U+%05X]",getfont(c),getchar(c))
+ context("[%s:U+%05X]",f,c)
end
end
@@ -478,43 +478,40 @@ local threshold = 65536
local function toutf(list,result,nofresult,stopcriterium)
if list then
for n in traverse_nodes(tonut(list)) do
- local id = getid(n)
- if id == glyph_code then
+ local c, id = isglyph(n)
+ if c then
local components = getfield(n,"components")
if components then
result, nofresult = toutf(components,result,nofresult)
- else
- local c = getchar(n)
- if c > 0 then
- local fc = fontcharacters[getfont(n)]
- if fc then
- local fcc = fc[c]
- if fcc then
- local u = fcc.unicode
- if not u then
- nofresult = nofresult + 1
- result[nofresult] = utfchar(c)
- elseif type(u) == "table" then
- for i=1,#u do
- nofresult = nofresult + 1
- result[nofresult] = utfchar(u[i])
- end
- else
+ elseif c > 0 then
+ local fc = fontcharacters[getfont(n)]
+ if fc then
+ local fcc = fc[c]
+ if fcc then
+ local u = fcc.unicode
+ if not u then
+ nofresult = nofresult + 1
+ result[nofresult] = utfchar(c)
+ elseif type(u) == "table" then
+ for i=1,#u do
nofresult = nofresult + 1
- result[nofresult] = utfchar(u)
+ result[nofresult] = utfchar(u[i])
end
else
nofresult = nofresult + 1
- result[nofresult] = utfchar(c)
+ result[nofresult] = utfchar(u)
end
else
nofresult = nofresult + 1
- result[nofresult] = f_unicode(c)
+ result[nofresult] = utfchar(c)
end
else
nofresult = nofresult + 1
- result[nofresult] = f_badcode(c)
+ result[nofresult] = f_unicode(c)
end
+ else
+ nofresult = nofresult + 1
+ result[nofresult] = f_badcode(c)
end
elseif id == disc_code then
result, nofresult = toutf(getfield(n,"replace"),result,nofresult) -- needed?