From 9d92d615262ab0a2286146526db6b935f7a8c980 Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Sat, 12 Jul 2014 19:05:30 +0200 Subject: [color] fix transparency of colorized fonts Thanks to Robert Schlicht and Will Robertson for the fix. Fixes https://github.com/lualatex/luaotfload/issues/222 [0] http://tex.stackexchange.com/q/185878 --- src/luaotfload-colors.lua | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src/luaotfload-colors.lua') diff --git a/src/luaotfload-colors.lua b/src/luaotfload-colors.lua index 56acfee..476826e 100644 --- a/src/luaotfload-colors.lua +++ b/src/luaotfload-colors.lua @@ -34,6 +34,9 @@ local traverse_nodes = node.traverse local insert_node_before = node.insert_before local insert_node_after = node.insert_after +local texset = tex.set +local texget = tex.get + local stringformat = string.format local stringgsub = string.gsub local stringfind = string.find @@ -276,20 +279,24 @@ local color_handler = function (head) local new_head = node_colorize(head, nil, nil) -- now append our page resources if res then - res["1"] = true - local tpr, t = tex.pdfpageresources, "" + res["1"] = true + local tpr = texget("pdfpageresources") + local t = "" for k in pairs(res) do local str = stringformat("/TransGs%s<>", k, k, k) if not stringfind(tpr,str) then t = t .. str end end + print"" if t ~= "" then + print(">>", tpr, "<<") if not stringfind(tpr,"/ExtGState<<.*>>") then tpr = tpr.."/ExtGState<<>>" end tpr = stringgsub(tpr,"/ExtGState<<","%1"..t) - tex.pdfpageresources = tpr + texset("global", "pdfpageresources", tpr) + print(">>", tpr, "<<") end res = nil -- reset res end -- cgit v1.2.3