From af60125ab3fa9e482720f0f46c2143fa08512113 Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Thu, 19 Aug 2021 20:32:31 +0200 Subject: 2021-08-19 19:43:00 --- tex/context/modules/mkiv/s-fonts-tables.lua | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'tex/context/modules/mkiv/s-fonts-tables.lua') diff --git a/tex/context/modules/mkiv/s-fonts-tables.lua b/tex/context/modules/mkiv/s-fonts-tables.lua index c9aa7b801..65725594b 100644 --- a/tex/context/modules/mkiv/s-fonts-tables.lua +++ b/tex/context/modules/mkiv/s-fonts-tables.lua @@ -678,18 +678,28 @@ end local function collectligatures(steps) + -- Mostly the same as s-fonts-features 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) -- cgit v1.2.3