summaryrefslogtreecommitdiff
path: root/src/luaotfload-colors.lua
diff options
context:
space:
mode:
authorDohyun Kim <nomosnomos@gmail.com>2015-05-04 16:33:31 +0900
committerDohyun Kim <nomosnomos@gmail.com>2015-05-04 16:33:31 +0900
commit3b391191018f67233e593a5d5053d9f1ace4a509 (patch)
tree9f797d01c7cb8b2ab59f4274b565629cea7daaf8 /src/luaotfload-colors.lua
parent1f74982cb8e0980d956f97bd9bbb75391eb67d75 (diff)
downloadluaotfload-3b391191018f67233e593a5d5053d9f1ace4a509.tar.gz
respect beamer (pgf) transparency
Diffstat (limited to 'src/luaotfload-colors.lua')
-rw-r--r--src/luaotfload-colors.lua21
1 files changed, 16 insertions, 5 deletions
diff --git a/src/luaotfload-colors.lua b/src/luaotfload-colors.lua
index 081f0f6..0832083 100644
--- a/src/luaotfload-colors.lua
+++ b/src/luaotfload-colors.lua
@@ -40,6 +40,8 @@ local setattribute = nodedirect.set_attribute
local texset = tex.set
local texget = tex.get
+local texsettoks = tex.settoks
+local texgettoks = tex.gettoks
local stringformat = string.format
@@ -318,7 +320,12 @@ local color_handler = function (head)
-- now append our page resources
if res then
res["1"] = true
- local tpr = texget("pdfpageresources") -- respect other packages. we need a guidance
+ local tpr = texget("pdfpageresources")
+ local pgf_loaded = tpr:find("/ExtGState %d+ 0 R")
+ if pgf_loaded then
+ tpr = texgettoks("pgf@sys@pgf@resource@list@extgs@toks") -- see luaotfload.sty
+ end
+
local t = ""
for k in pairs(res) do
local str = stringformat("/TransGs%s<</ca %s>>", k, k) -- don't touch stroking elements
@@ -327,11 +334,15 @@ local color_handler = function (head)
end
end
if t ~= "" then
- if not tpr:find("/ExtGState<<.*>>") then
- tpr = tpr .. "/ExtGState<<>>"
+ if pgf_loaded then
+ texsettoks("global", "pgf@sys@pgf@resource@list@extgs@toks", tpr..t)
+ else
+ if not tpr:find("/ExtGState<<.*>>") then
+ tpr = tpr .. "/ExtGState<<>>"
+ end
+ tpr = tpr:gsub("/ExtGState<<", "%1"..t)
+ texset("global", "pdfpageresources", tpr)
end
- tpr = tpr:gsub("/ExtGState<<", "%1"..t)
- texset("global", "pdfpageresources", tpr)
end
res = nil -- reset res
end