[latex3-commits] [git/LaTeX3-latex3-luaotfload] dev: Fix ordering when last cluster has more output than input glyphs (73a96c1)

Marcel Fabian Krüger tex at 2krueger.de
Thu Sep 9 16:22:57 CEST 2021


Repository : https://github.com/latex3/luaotfload
On branch  : dev
Link       : https://github.com/latex3/luaotfload/commit/73a96c104b4bf9234d06708f692bf2232d15774e

>---------------------------------------------------------------

commit 73a96c104b4bf9234d06708f692bf2232d15774e
Author: Marcel Fabian Krüger <tex at 2krueger.de>
Date:   Thu Sep 9 16:08:45 2021 +0200

    Fix ordering when last cluster has more output than input glyphs


>---------------------------------------------------------------

73a96c104b4bf9234d06708f692bf2232d15774e
 src/luaotfload-harf-plug.lua | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/luaotfload-harf-plug.lua b/src/luaotfload-harf-plug.lua
index 9d2409b..b0f2936 100644
--- a/src/luaotfload-harf-plug.lua
+++ b/src/luaotfload-harf-plug.lua
@@ -774,9 +774,15 @@ local function tonodes(head, node, run, glyphs)
       nodeindex = glyph.cluster + 1
     elseif nextcluster + 1 == nodeindex then -- Oops, we went too far
       nodeindex = nodeindex - 1
-      local new = inherit(glyph_t, getprev(node), lastprops)
-      setfont(new, fontid)
-      head, node = insertbefore(head, node, new)
+      if node then
+        local new = inherit(glyph_t, getprev(node), lastprops)
+        head, node = insertbefore(head, node, new)
+      else
+        node = tail(head)
+        local new = inherit(glyph_t, node, lastprops)
+        head, node = insertafter(head, node, new)
+      end
+      setfont(node, fontid)
     end
     local gid = glyph.codepoint
     local char = nominals[gid] or gid_offset + gid





More information about the latex3-commits mailing list.