summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPhilipp Gesang <phg42.2a@gmail.com>2014-07-12 19:05:30 +0200
committerPhilipp Gesang <phg42.2a@gmail.com>2014-07-12 19:12:11 +0200
commit9d92d615262ab0a2286146526db6b935f7a8c980 (patch)
tree42ad7ff9258caa21c76dfa6be35017c5bf5c2bd7 /src
parent821e6aa045ecbb22dbc96d2dafe5f7ae1c839762 (diff)
downloadluaotfload-9d92d615262ab0a2286146526db6b935f7a8c980.tar.gz
[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
Diffstat (limited to 'src')
-rw-r--r--src/luaotfload-colors.lua13
1 files changed, 10 insertions, 3 deletions
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<</ca %s/CA %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