Skip to content

Commit

Permalink
Allow customizing color stack for transparancy
Browse files Browse the repository at this point in the history
  • Loading branch information
zauguin committed Jun 7, 2022
1 parent 6985740 commit 402341d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
19 changes: 19 additions & 0 deletions src/luaotfload-colors.lua
Expand Up @@ -453,6 +453,25 @@ end
function luaotfload.set_transparentparser(cb)
custom_parsetransparent = cb
end
function luaotfload.set_transparentstack(stack)
if type(transparent_stack) == 'number' then
tex.error"luaotfload's transparency stack can't be changed after it has been used"
else
local t = type(stack)
if t == 'function' or t == 'number' then
function transparent_stack()
if t == 'function' then
transparent_stack = stack()
else
transparent_stack = stack
end
return transparent_stack
end
else
tex.error("Invalid argument in luaotfload.set_transparentstack")
end
end
end
setmetatable(fonts.handlers.otf.statistics.usedfeatures.color, {
__index = function(t, k)
Expand Down
2 changes: 1 addition & 1 deletion src/luaotfload-l3color.lua
Expand Up @@ -47,7 +47,7 @@ luaotfload.set_colorparser(function (value)
tex.runtoks(function()
token.get_next()
color_export[6] = value
tex.sprint(-1, color_export)
tex.sprint(-2, color_export)
end)
local list = token.scan_list()
if not list.head or list.head.next or list.head.subtype ~= node.subtype'pdf_colorstack' then
Expand Down

0 comments on commit 402341d

Please sign in to comment.