summaryrefslogtreecommitdiff
path: root/tex/context/base/mkiv/font-oup.lua
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2017-06-22 00:05:31 +0200
committerContext Git Mirror Bot <phg42.2a@gmail.com>2017-06-22 00:05:31 +0200
commit5c9b859165af46407543b25589ce8852ee079620 (patch)
tree28998698986312e101e15ca57e55e944200a3d8f /tex/context/base/mkiv/font-oup.lua
parentd11a1200ed28c6e0058990a621d7404f821ac7fd (diff)
downloadcontext-5c9b859165af46407543b25589ce8852ee079620.tar.gz
2017-06-21 23:09:00
Diffstat (limited to 'tex/context/base/mkiv/font-oup.lua')
-rw-r--r--tex/context/base/mkiv/font-oup.lua51
1 files changed, 21 insertions, 30 deletions
diff --git a/tex/context/base/mkiv/font-oup.lua b/tex/context/base/mkiv/font-oup.lua
index bf9682a8f..54ca690d1 100644
--- a/tex/context/base/mkiv/font-oup.lua
+++ b/tex/context/base/mkiv/font-oup.lua
@@ -2024,48 +2024,37 @@ local function mergesteps_2(lookup,strict) -- pairs
return nofsteps - 1
end
+-- we could have a coverage[first][second] = { } already here (because eventually
+-- we also have something like that after loading)
local function mergesteps_3(lookup,strict) -- marks
local steps = lookup.steps
local nofsteps = lookup.nofsteps
- local first = steps[1]
report("merging %a steps of %a lookup %a",nofsteps,lookup.type,lookup.name)
- local baseclasses = { }
- local coverage = { }
- local used = { }
+ -- check first
+ local coverage = { }
for i=1,nofsteps do
- local offset = i*10
- local step = steps[i]
- for k, v in sortedhash(step.baseclasses) do
- baseclasses[offset+k] = v
- end
- for k, v in next, step.coverage do
- local tk = coverage[k]
+ for k, v in next, steps[i].coverage do
+ local tk = coverage[k] -- { class, { x, y } }
if tk then
- for k, v in next, v do
- if not tk[k] then
- tk[k] = v
- local c = offset + v[1]
- v[1] = c
- if not used[c] then
- used[c] = true
- end
- end
- end
+ report("quitting merge due to multiple checks")
+ return nofsteps
else
coverage[k] = v
- local c = offset + v[1]
- v[1] = c
- if not used[c] then
- used[c] = true
- end
end
end
end
- for k, v in next, baseclasses do
- if not used[k] then
- baseclasses[k] = nil
- report("discarding not used baseclass %i",k)
+ -- merge indeed
+ local first = steps[1]
+ local baseclasses = { } -- let's assume sparse step.baseclasses
+ for i=1,nofsteps do
+ local offset = i*10 -- we assume max 10 classes per step
+ local step = steps[i]
+ for k, v in sortedhash(step.baseclasses) do
+ baseclasses[offset+k] = v
+ end
+ for k, v in next, step.coverage do
+ v[1] = offset + v[1]
end
end
first.baseclasses = baseclasses
@@ -2370,6 +2359,8 @@ function readers.expand(data)
local cu = coverage[unic]
if not cu then
coverage[unic] = rulehash -- can now be done cleaner i think
+ else
+ -- we can have a problem
end
end
end