[latex3-commits] [git/LaTeX3-latex3-luaotfload] dev: Fix bug (9e939b2)

Marcel Fabian Krüger tex at 2krueger.de
Mon Apr 6 20:56:52 CEST 2020


Repository : https://github.com/latex3/luaotfload
On branch  : dev
Link       : https://github.com/latex3/luaotfload/commit/9e939b2fc955be31c029e7ad057a607a41f82dfa

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

commit 9e939b2fc955be31c029e7ad057a607a41f82dfa
Author: Marcel Fabian Krüger <tex at 2krueger.de>
Date:   Mon Apr 6 20:52:27 2020 +0200

    Fix bug
    
    Update the current node reference when a discretionary node is expanded
    to contain the first node of the run which does not happen to coincide
    with the head of the token list (#141)


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

9e939b2fc955be31c029e7ad057a607a41f82dfa
 src/luaotfload-harf-plug.lua | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/src/luaotfload-harf-plug.lua b/src/luaotfload-harf-plug.lua
index d6ea271..4d7f359 100644
--- a/src/luaotfload-harf-plug.lua
+++ b/src/luaotfload-harf-plug.lua
@@ -260,7 +260,7 @@ local function makesub(run, codes, nodelist)
   if nodelist == 0 then -- FIXME: This shouldn't happen
     nodelist = nil
   end
-  nodelist, glyphs = shape(nodelist, nodelist, subrun)
+  nodelist, nodelist, glyphs = shape(nodelist, nodelist, subrun)
   return { glyphs = glyphs, run = subrun, head = nodelist }
 end
 
@@ -283,7 +283,8 @@ local function printnodes(label, head, after)
 end
 -- Main shaping function that calls HarfBuzz, and does some post-processing of
 -- the output.
-function shape(head, node, run)
+function shape(head, firstnode, run)
+  local node = firstnode
   local codes = run.codes
   local offset = run.start
   local nodeindex = offset
@@ -510,6 +511,9 @@ function shape(head, node, run)
               local predisc = getprev(disc)
               setnext(predisc, rep)
               setprev(rep, predisc)
+              if firstnode == startnode then
+                firstnode = disc
+              end
               if startnode == head then
                 head = disc
               else
@@ -540,10 +544,10 @@ function shape(head, node, run)
         end
       end
     end
-    return head, glyphs, run.len - len
+    return head, firstnode, glyphs, run.len - len
   end
 
-  return head, {}, 0
+  return head, firstnode, {}, 0
 end
 
 local function color_to_rgba(color)
@@ -871,7 +875,7 @@ local function shape_run(head, current, run)
     -- Font loaded with our loader and an HarfBuzz face is present, do our
     -- shaping.
     local glyphs, offset
-    head, glyphs, offset = shape(head, current, run)
+    head, current, glyphs, offset = shape(head, current, run)
     return offset, tonodes(head, current, run, glyphs)
   else
     return 0, head, run.after





More information about the latex3-commits mailing list.