summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--otfl-font-msc.lua12
1 files changed, 9 insertions, 3 deletions
diff --git a/otfl-font-msc.lua b/otfl-font-msc.lua
index bb04927..6ebf31d 100644
--- a/otfl-font-msc.lua
+++ b/otfl-font-msc.lua
@@ -172,11 +172,17 @@ function luaotfload.node_colorize(head)
end
function luaotfload.colorize(head)
- local h = luaotfload.node_colorize(head)
+ -- check if our page resources existed in the previous run
+ -- and remove it to avoid duplicating it later
if res then
local r = "/ExtGState<<"..res..">>"
- local s = tex.pdfpageresources:find(r) and "" or r
- tex.pdfpageresources = tex.pdfpageresources..s
+ tex.pdfpageresources = tex.pdfpageresources:gsub(r, "")
+ end
+ local h = luaotfload.node_colorize(head)
+ -- now append our page resources
+ if res and not res:is_empty() then
+ local r = "/ExtGState<<"..res..">>"
+ tex.pdfpageresources = tex.pdfpageresources..r
end
return h
end