summaryrefslogtreecommitdiff
path: root/tex/context/base/mkiv/font-oup.lua
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2017-06-30 20:42:23 +0200
committerContext Git Mirror Bot <phg42.2a@gmail.com>2017-06-30 20:42:23 +0200
commit87d82131e6359a9bb3fb4e85e2f26f6864de8ac9 (patch)
treed9a1ff89b1167c926e7c12d0664b5923ba695b6b /tex/context/base/mkiv/font-oup.lua
parent852668a65c878fee10d21fb7cefafb390e083075 (diff)
downloadcontext-87d82131e6359a9bb3fb4e85e2f26f6864de8ac9.tar.gz
2017-06-30 19:51:00
Diffstat (limited to 'tex/context/base/mkiv/font-oup.lua')
-rw-r--r--tex/context/base/mkiv/font-oup.lua38
1 files changed, 34 insertions, 4 deletions
diff --git a/tex/context/base/mkiv/font-oup.lua b/tex/context/base/mkiv/font-oup.lua
index 54ca690d1..5ee6df505 100644
--- a/tex/context/base/mkiv/font-oup.lua
+++ b/tex/context/base/mkiv/font-oup.lua
@@ -15,6 +15,7 @@ local formatters = string.formatters
local sortedkeys = table.sortedkeys
local sortedhash = table.sortedhash
local tohash = table.tohash
+local setmetatableindex = table.setmetatableindex
local report = logs.reporter("otf reader")
@@ -2256,6 +2257,33 @@ function readers.expand(data)
end
end
end
+
+ -- using a merged combined hash as first test saves some 30% on ebgaramond and
+ -- about 15% on arabtype .. then moving the a test also saves a bit (even when
+ -- often a is not set at all so that one is a bit debatable
+
+ local function mergesteps(t,k)
+ if k == "merged" then
+ local merged = { }
+ for i=1,#t do
+ local step = t[i]
+ local coverage = step.coverage
+ for k, v in next, coverage do
+ local m = merged[k]
+ if m then
+ m[2] = i
+ -- m[#m+1] = step
+ else
+ merged[k] = { i, i }
+ -- merged[k] = { step }
+ end
+ end
+ end
+ t.merged = merged
+ return merged
+ end
+ end
+
local function expandlookups(sequences)
if sequences then
-- we also need to do sublookups
@@ -2263,10 +2291,10 @@ function readers.expand(data)
local sequence = sequences[i]
local steps = sequence.steps
if steps then
+
+ setmetatableindex(steps,mergesteps)
+
local kind = sequence.type
--- if kind == "gsub_reversecontextchain" then
--- inspect(sequence)
--- end
local markclass = sequence.markclass
if markclass then
if not markclasses then
@@ -2276,7 +2304,8 @@ function readers.expand(data)
sequence.markclass = markclasses[markclass]
end
end
- for i=1,sequence.nofsteps do
+ local nofsteps = sequence.nofsteps
+ for i=1,nofsteps do
local step = steps[i]
local baseclasses = step.baseclasses
if baseclasses then
@@ -2371,6 +2400,7 @@ function readers.expand(data)
end
end
end
+
expandlookups(sequences)
expandlookups(sublookups)
end