summaryrefslogtreecommitdiff
path: root/tex/context/base/mkiv/font-dsp.lua
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2017-04-27 01:41:25 +0200
committerContext Git Mirror Bot <phg42.2a@gmail.com>2017-04-27 01:41:25 +0200
commit762562da00d0ec1d50e6d3c2a701156ab42e6d71 (patch)
tree2dc664caa951963a393b0a2a9c9c85d1db6b8e10 /tex/context/base/mkiv/font-dsp.lua
parentf2a20e191bf71094aa21d37dee2ecd2f804dbc56 (diff)
downloadcontext-762562da00d0ec1d50e6d3c2a701156ab42e6d71.tar.gz
2017-04-27 01:06:00
Diffstat (limited to 'tex/context/base/mkiv/font-dsp.lua')
-rw-r--r--tex/context/base/mkiv/font-dsp.lua99
1 files changed, 59 insertions, 40 deletions
diff --git a/tex/context/base/mkiv/font-dsp.lua b/tex/context/base/mkiv/font-dsp.lua
index 1ea6a4908..d43348cdf 100644
--- a/tex/context/base/mkiv/font-dsp.lua
+++ b/tex/context/base/mkiv/font-dsp.lua
@@ -889,7 +889,13 @@ local function readlookuparray(f,noflookups,nofcurrent)
if index > length then
length = index
end
- lookups[index] = readushort(f) + 1
+ local lookup = readushort(f) + 1
+ local list = lookups[index]
+ if list then
+ list[#list+1] = lookup
+ else
+ lookups[index] = { lookup }
+ end
end
for index=1,length do
if not lookups[index] then
@@ -2185,50 +2191,63 @@ do
report_issue(i,what,sequence,"empty")
rule.lookups = nil
else
- -- we can have holes in rlookups
+ -- we can have holes in rlookups flagged false and we can have multiple lookups
+ -- applied (first time seen in seguemj)
local length = #rlookups
for index=1,length do
- local lookupid = rlookups[index]
- if lookupid then
- local h = sublookuphash[lookupid]
- if not h then
- -- here we have a lookup that is used independent as well
- -- as in another one
- local lookup = lookups[lookupid]
- if lookup then
- local d = lookup.done
- if d then
- nofsublookups = nofsublookups + 1
- -- report("registering %i as sublookup %i",lookupid,nofsublookups)
- h = {
- index = nofsublookups, -- handy for tracing
- name = f_lookupname(lookupprefix,"d",lookupid+lookupidoffset),
- derived = true, -- handy for tracing
- steps = d.steps,
- nofsteps = d.nofsteps,
- type = d.lookuptype or "gsub_single", -- todo: check type
- markclass = d.markclass or nil,
- flags = d.flags,
- -- chain = d.chain,
- }
- sublookuplist[nofsublookups] = copy(h) -- we repack later
- sublookuphash[lookupid] = nofsublookups
- sublookupcheck[lookupid] = 1
- h = nofsublookups
+ local lookuplist = rlookups[index]
+ if lookuplist then
+ local length = #lookuplist
+ local found = { }
+ local noffound = 0
+ for index=1,length do
+ local lookupid = lookuplist[index]
+ if lookupid then
+ local h = sublookuphash[lookupid]
+ if not h then
+ -- here we have a lookup that is used independent as well
+ -- as in another one
+ local lookup = lookups[lookupid]
+ if lookup then
+ local d = lookup.done
+ if d then
+ nofsublookups = nofsublookups + 1
+ -- report("registering %i as sublookup %i",lookupid,nofsublookups)
+ h = {
+ index = nofsublookups, -- handy for tracing
+ name = f_lookupname(lookupprefix,"d",lookupid+lookupidoffset),
+ derived = true, -- handy for tracing
+ steps = d.steps,
+ nofsteps = d.nofsteps,
+ type = d.lookuptype or "gsub_single", -- todo: check type
+ markclass = d.markclass or nil,
+ flags = d.flags,
+ -- chain = d.chain,
+ }
+ sublookuplist[nofsublookups] = copy(h) -- we repack later
+ sublookuphash[lookupid] = nofsublookups
+ sublookupcheck[lookupid] = 1
+ h = nofsublookups
+ else
+ report_issue(i,what,sequence,"missing")
+ rule.lookups = nil
+ break
+ end
+ else
+ report_issue(i,what,sequence,"bad")
+ rule.lookups = nil
+ break
+ end
else
- report_issue(i,what,sequence,"missing")
- rule.lookups = nil
- break
+ sublookupcheck[lookupid] = sublookupcheck[lookupid] + 1
+ end
+ if h then
+ noffound = noffound + 1
+ found[noffound] = h
end
- else
- report_issue(i,what,sequence,"bad")
- rule.lookups = nil
- break
end
- else
- sublookupcheck[lookupid] = sublookupcheck[lookupid] + 1
end
- rlookups[index] = h or false
+ rlookups[index] = noffound > 0 and found or false
else
rlookups[index] = false
end
@@ -3388,7 +3407,7 @@ function readers.fvar(f,fontdata,specification)
default = readfixed(f), -- idem
maximum = readfixed(f), -- idem
flags = readushort(f),
- name = lower(extras[readushort(f)]),
+ name = lower(extras[readushort(f)] or "bad name"),
}
local n = sizeofaxis - 20
if n > 0 then