summaryrefslogtreecommitdiff
path: root/tex/context/base/mkiv/font-oup.lua
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2017-08-03 11:46:01 +0200
committerContext Git Mirror Bot <phg42.2a@gmail.com>2017-08-03 11:46:01 +0200
commitab253433729006addd4336870face2facce5f894 (patch)
tree2118e77b8acf88b9bd05724bd130d4b06bfb913d /tex/context/base/mkiv/font-oup.lua
parentfe1ea06fcb9c42c23beaf4211ae3b0a2de60895e (diff)
downloadcontext-ab253433729006addd4336870face2facce5f894.tar.gz
2017-08-03 11:08:00
Diffstat (limited to 'tex/context/base/mkiv/font-oup.lua')
-rw-r--r--tex/context/base/mkiv/font-oup.lua47
1 files changed, 44 insertions, 3 deletions
diff --git a/tex/context/base/mkiv/font-oup.lua b/tex/context/base/mkiv/font-oup.lua
index 3b86cde72..dab746125 100644
--- a/tex/context/base/mkiv/font-oup.lua
+++ b/tex/context/base/mkiv/font-oup.lua
@@ -2145,7 +2145,7 @@ local function mergesteps_1(lookup,strict)
return nofsteps - 1
end
-local function mergesteps_2(lookup,strict) -- pairs
+local function mergesteps_2(lookup) -- pairs
-- this can be tricky as we can have a match on a mark with no marks skip flag
-- in which case with multiple steps a hit can prevent a next step while in the
-- merged case we can hit differently (a messy font then anyway)
@@ -2262,6 +2262,43 @@ local function mergesteps_4(lookup) -- ligatures
return nofsteps - 1
end
+-- so we assume only one cursive entry and exit and even then the first one seems
+-- to win anyway: no exit or entry quite the lookup match and then we take the
+-- next step; this means that we can as well merge them
+
+local function mergesteps_5(lookup) -- cursive
+ 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 target = first.coverage
+ local hash = nil
+ for k, v in next, target do
+ hash = v[1]
+ break
+ end
+ for i=2,nofsteps do
+ for k, v in next, steps[i].coverage do
+ local tk = target[k]
+ if tk then
+ if not tk[2] then
+ tk[2] = v[2]
+ end
+ if not tk[3] then
+ tk[3] = v[3]
+ end
+ else
+ target[k] = v
+ v[1] = hash
+ end
+ end
+ end
+ lookup.nofsteps = 1
+ lookup.merged = true
+ lookup.steps = { first }
+ return nofsteps - 1
+end
+
local function checkkerns(lookup)
local steps = lookup.steps
local nofsteps = lookup.nofsteps
@@ -2432,14 +2469,14 @@ function readers.compact(data)
end
elseif kind == "gpos_pair" then
if merge_pairs then
- merged = merged + mergesteps_2(lookup,true)
+ merged = merged + mergesteps_2(lookup)
end
if compact_pairs then
kerned = kerned + checkpairs(lookup)
end
elseif kind == "gpos_cursive" then
if merge_cursives then
- merged = merged + mergesteps_2(lookup)
+ merged = merged + mergesteps_5(lookup)
end
elseif kind == "gpos_mark2mark" or kind == "gpos_mark2base" or kind == "gpos_mark2ligature" then
if merge_marks then
@@ -2513,7 +2550,11 @@ local function checkflags(sequence,resources)
t[k] = v or false
return v
end)
+ else
+ sequence.skipsome = false
end
+ else
+ sequence.skipsome = false
end
end
end