[latex3-commits] [git/LaTeX3-latex3-luaotfload] transparent-layer: Don't add invisible layers for color glyphs (3597a0b)

Marcel Fabian Krüger tex at 2krueger.de
Fri Jul 17 16:14:43 CEST 2020


Repository : https://github.com/latex3/luaotfload
On branch  : transparent-layer
Link       : https://github.com/latex3/luaotfload/commit/3597a0b80162215d6886cc74a37e1653a89d7f1b

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

commit 3597a0b80162215d6886cc74a37e1653a89d7f1b
Author: Marcel Fabian Krüger <tex at 2krueger.de>
Date:   Fri Jul 17 16:14:43 2020 +0200

    Don't add invisible layers for color glyphs


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

3597a0b80162215d6886cc74a37e1653a89d7f1b
 src/luaotfload-harf-plug.lua | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/src/luaotfload-harf-plug.lua b/src/luaotfload-harf-plug.lua
index e5ede81..3062fe2 100644
--- a/src/luaotfload-harf-plug.lua
+++ b/src/luaotfload-harf-plug.lua
@@ -718,13 +718,15 @@ local function tonodes(head, node, run, glyphs)
                 -- color, we don’t check for it here explicitly since we will
                 -- get nil anyway.
                 local color = palette[layer.color_index]
-                cmds[5*j - 4] = (color and not prev_color) and save_cmd or nop_cmd
-                cmds[5*j - 3] = prev_color == color and nop_cmd or (color and {"pdf", "page", color_to_rgba(color)} or restore_cmd)
-                cmds[5*j - 2] = push_cmd
-                cmds[5*j - 1] = {"char", layer.glyph + gid_offset}
-                cmds[5*j] = pop_cmd
-                fontglyphs[layer.glyph].used = true
-                prev_color = color
+                if not color or color.alpha ~= 0 then
+                  cmds[5*j - 4] = (color and not prev_color) and save_cmd or nop_cmd
+                  cmds[5*j - 3] = prev_color == color and nop_cmd or (color and {"pdf", "page", color_to_rgba(color)} or restore_cmd)
+                  cmds[5*j - 2] = push_cmd
+                  cmds[5*j - 1] = {"char", layer.glyph + gid_offset}
+                  cmds[5*j] = pop_cmd
+                  fontglyphs[layer.glyph].used = true
+                  prev_color = color
+                end
               end
               cmds[#cmds + 1] = prev_color and restore_cmd
               if not character.colored then





More information about the latex3-commits mailing list.