summaryrefslogtreecommitdiff
path: root/tex/context/modules/mkiv/s-fonts-features.lua
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/modules/mkiv/s-fonts-features.lua')
-rw-r--r--tex/context/modules/mkiv/s-fonts-features.lua22
1 files changed, 17 insertions, 5 deletions
diff --git a/tex/context/modules/mkiv/s-fonts-features.lua b/tex/context/modules/mkiv/s-fonts-features.lua
index 34268c171..eb64e4c8f 100644
--- a/tex/context/modules/mkiv/s-fonts-features.lua
+++ b/tex/context/modules/mkiv/s-fonts-features.lua
@@ -200,6 +200,8 @@ function moduledata.fonts.features.showfeatureset(specification)
end
end
+-- The next one looks a bit like the collector in font-oup.lua.
+
local function collectligatures(tfmdata)
local sequences = tfmdata.resources.sequences
@@ -207,18 +209,28 @@ local function collectligatures(tfmdata)
return
end
+ -- Mostly the same as s-fonts-tables so we should make a helper.
+
local series = { }
local stack = { }
local max = 0
+ local function add(v)
+ local n = #stack
+ if n > max then
+ max = n
+ end
+ series[#series+1] = { v, unpack(stack) }
+ end
+
local function make(tree)
for k, v in sortedhash(tree) do
if k == "ligature" then
- local n = #stack
- if n > max then
- max = n
- end
- series[#series+1] = { v, unpack(stack) }
+ add(v)
+ elseif tonumber(v) then
+ insert(stack,k)
+ add(v)
+ remove(stack)
else
insert(stack,k)
make(v)