[latex3-commits] [git/LaTeX3-latex3-luaotfload] dev: Fix inheritance of attributes/properties for ActualText nodes (26a0ae9)

Marcel Fabian Krüger tex at 2krueger.de
Tue May 3 18:25:59 CEST 2022


Repository : https://github.com/latex3/luaotfload
On branch  : dev
Link       : https://github.com/latex3/luaotfload/commit/26a0ae95758091fdffab3cda68e59ad583e25f45

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

commit 26a0ae95758091fdffab3cda68e59ad583e25f45
Author: Marcel Fabian Krüger <tex at 2krueger.de>
Date:   Tue May 3 18:25:31 2022 +0200

    Fix inheritance of attributes/properties for ActualText nodes


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

26a0ae95758091fdffab3cda68e59ad583e25f45
 src/luaotfload-harf-plug.lua | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/luaotfload-harf-plug.lua b/src/luaotfload-harf-plug.lua
index ca0de24..ed9311e 100644
--- a/src/luaotfload-harf-plug.lua
+++ b/src/luaotfload-harf-plug.lua
@@ -136,8 +136,8 @@ local function setprop(n, prop, value)
   props[prop] = value
 end
 
-local function inherit(t, base, properties)
-  local n = newnode(t)
+local function inherit(t, sub, base, properties)
+  local n = newnode(t, sub)
   setattrs(n, getattrs(base))
   if properties then
     setproperty(n, setmetatable({}, {__index = properties}))
@@ -146,7 +146,7 @@ local function inherit(t, base, properties)
 end
 -- New kern node of amount `v`, inheriting the properties/attributes of `n`.
 local function newkern(v, n)
-  local kern = inherit(kern_t, n, getproperty(n))
+  local kern = inherit(kern_t, 0, n, getproperty(n))
   setkern(kern, v)
   return kern
 end
@@ -782,11 +782,11 @@ local function tonodes(head, node, run, glyphs)
     elseif nextcluster + 1 == nodeindex then -- Oops, we went too far
       nodeindex = nodeindex - 1
       if node then
-        local new = inherit(glyph_t, getprev(node), lastprops)
+        local new = inherit(glyph_t, 0, getprev(node), lastprops)
         head, node = insertbefore(head, node, new)
       else
         node = tail(head)
-        local new = inherit(glyph_t, node, lastprops)
+        local new = inherit(glyph_t, 0, node, lastprops)
         head, node = insertafter(head, node, new)
       end
       setfont(node, fontid)
@@ -1050,8 +1050,8 @@ function process(head, font, _attr, direction)
   return newhead or head
 end
 
-local function pageliteral(data)
-  local n = newnode(whatsit_t, pdfliteral_t)
+local function pageliteral(data, base)
+  local n = inherit(whatsit_t, pdfliteral_t, base, getproperty(base))
   setwhatsitfield(n, "mode", 1) -- page
   setwhatsitfield(n, "data", data) -- page
   return n
@@ -1069,12 +1069,12 @@ local function post_process(head)
 
     if startactual then
       local actualtext = "/Span<</ActualText<FEFF"..startactual..">>>BDC"
-      head = insertbefore(head, n, pageliteral(actualtext))
+      head = insertbefore(head, n, pageliteral(actualtext, n))
       props[startactual_p] = nil
     end
 
     if endactual then
-      head = insertafter(head, n, pageliteral("EMC"))
+      head = insertafter(head, n, pageliteral("EMC", n))
       props[endactual_p] = nil
     end
 





More information about the latex3-commits mailing list.