From 04613e21354e8a1c93829f69dd6e0989c925d42a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcel=20Fabian=20Kr=C3=BCger?= Date: Wed, 10 Mar 2021 15:15:44 +0100 Subject: [PATCH] Fix multiple discretionaries at start of run --- src/luaotfload-harf-plug.lua | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/luaotfload-harf-plug.lua b/src/luaotfload-harf-plug.lua index e0fda7e5..d86c1c50 100644 --- a/src/luaotfload-harf-plug.lua +++ b/src/luaotfload-harf-plug.lua @@ -181,7 +181,8 @@ local function itemize(head, fontid, direction) local dirstack = {} local currdir = direction or 0 local lastskip, lastdir = true - local lastrun = {} + local dummyrun = { start = 0, len = 0 } + local lastrun = dummyrun local lastdisc local in_disc @@ -226,9 +227,6 @@ local function itemize(head, fontid, direction) setlink(prev, n) code = nil skip = false - if not prev then - head = n - end else skip = true end @@ -272,6 +270,9 @@ local function itemize(head, fontid, direction) lastrun.len = lastrun.len + 1 elseif disc then if lastdisc then + if lastrun.len == 0 then + runs[#runs - 1].after = n + end lastdisc.next = disc lastdisc = disc else @@ -280,7 +281,7 @@ local function itemize(head, fontid, direction) end end - return head, runs + return dummyrun.after, runs end