summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPhilipp Gesang <phg@phi-gamma.net>2015-06-11 20:04:32 +0200
committerPhilipp Gesang <phg@phi-gamma.net>2015-06-11 20:04:32 +0200
commit956be4dfe34ffc351bf9a9fad8e6ebd1be075046 (patch)
treec360560033804bfb42b63b812b1afa76442ff9f0 /src
parent431c25a1200c7d0e8b7fe55173357d29f7247975 (diff)
parent8a30fe684374af7dd25c8f9a2a97f5c01ea9d7bc (diff)
downloadluaotfload-956be4dfe34ffc351bf9a9fad8e6ebd1be075046.tar.gz
Merge pull request #2 from dohyunkim/phg
check if token register exists using allocation number
Diffstat (limited to 'src')
-rw-r--r--src/luaotfload-colors.lua9
-rw-r--r--src/luaotfload.sty2
2 files changed, 7 insertions, 4 deletions
diff --git a/src/luaotfload-colors.lua b/src/luaotfload-colors.lua
index a151101..ff4dc13 100644
--- a/src/luaotfload-colors.lua
+++ b/src/luaotfload-colors.lua
@@ -321,9 +321,10 @@ local color_handler = function (head)
if res then
res["1"] = true
local tpr = texget("pdfpageresources")
- local pgf_loaded = tpr:find("/ExtGState %d+ 0 R")
+ local no_extgs = not tpr:find("/ExtGState<<.*>>")
+ local pgf_loaded = no_extgs and luaotfload.pgf_loaded
if pgf_loaded then
- tpr = texgettoks("pgf@sys@pgf@resource@list@extgs@toks") -- see luaotfload.sty
+ tpr = texgettoks(pgf_loaded) -- see luaotfload.sty
end
local t = ""
@@ -335,9 +336,9 @@ local color_handler = function (head)
end
if t ~= "" then
if pgf_loaded then
- texsettoks("global", "pgf@sys@pgf@resource@list@extgs@toks", tpr..t)
+ texsettoks("global", pgf_loaded, tpr..t)
else
- if not tpr:find("/ExtGState<<.*>>") then
+ if no_extgs then
tpr = tpr .. "/ExtGState<<>>"
end
tpr = tpr:gsub("/ExtGState<<", "%1"..t)
diff --git a/src/luaotfload.sty b/src/luaotfload.sty
index f183f9a..34f9a87 100644
--- a/src/luaotfload.sty
+++ b/src/luaotfload.sty
@@ -50,6 +50,7 @@
\ifcsname selectfont\endcsname
\AtBeginDocument{\@ifpackageloaded{pgfsys}{
\csname newtoks\endcsname\pgf@sys@pgf@resource@list@extgs@toks
+ \directlua{luaotfload.pgf_loaded=\the\allocationnumber}
\def\pgf@sys@pgf@resource@list@extgs{\the\pgf@sys@pgf@resource@list@extgs@toks}
\def\pgf@sys@addpdfresource@extgs@plain#1{\global\pgf@sys@pgf@resource@list@extgs@toks
\expandafter{\the\pgf@sys@pgf@resource@list@extgs@toks #1}}
@@ -60,6 +61,7 @@
\count255=\the\catcode`@\relax
\catcode`@=11\relax
\newtoks\pgf@sys@pgf@resource@list@extgs@toks
+\directlua{luaotfload.pgf_loaded=\the\allocationnumber}
\def\pgf@sys@pgf@resource@list@extgs{\the\pgf@sys@pgf@resource@list@extgs@toks}
\def\pgf@sys@addpdfresource@extgs@plain#1{\global\pgf@sys@pgf@resource@list@extgs@toks
\expandafter{\the\pgf@sys@pgf@resource@list@extgs@toks #1}}