From 3b391191018f67233e593a5d5053d9f1ace4a509 Mon Sep 17 00:00:00 2001
From: Dohyun Kim <nomosnomos@gmail.com>
Date: Mon, 4 May 2015 16:33:31 +0900
Subject: respect beamer (pgf) transparency

---
 src/luaotfload.sty | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

(limited to 'src/luaotfload.sty')

diff --git a/src/luaotfload.sty b/src/luaotfload.sty
index 100fb72..63d98ca 100644
--- a/src/luaotfload.sty
+++ b/src/luaotfload.sty
@@ -33,7 +33,7 @@
 \csname ifluaotfloadloaded\endcsname
 \let\ifluaotfloadloaded\endinput
 \bgroup\expandafter\expandafter\expandafter\egroup
-\expandafter\ifx\csname ProvidesPackage\endcsname\relax
+\expandafter\ifx\csname RequirePackage\endcsname\relax
   \input luatexbase.sty
 \else
   \NeedsTeXFormat{LaTeX2e}
@@ -45,3 +45,13 @@
 \fi
 \RequireLuaModule{luaotfload-main}
 
+% for compatibility with beamer class, which loads pgf package.
+% under non-beamer class, tikz (pgf) should be loaded before luaotfload.
+\ifcsname pgf@sys@pgf@resource@list@extgs\endcsname\else\endinput\fi
+\count255=\the\catcode`@\relax
+\catcode`@=11\relax
+\newtoks\pgf@sys@pgf@resource@list@extgs@toks
+\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}}
+\catcode`@=\the\count255\relax
-- 
cgit v1.2.3


From df9882e83b16b3ae3695b9bb10deacdbd5bb204d Mon Sep 17 00:00:00 2001
From: Dohyun Kim <nomosnomos@gmail.com>
Date: Mon, 4 May 2015 21:17:22 +0900
Subject: under latex, order of package loading is irrelevant

---
 src/luaotfload.sty | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

(limited to 'src/luaotfload.sty')

diff --git a/src/luaotfload.sty b/src/luaotfload.sty
index 63d98ca..7bcde64 100644
--- a/src/luaotfload.sty
+++ b/src/luaotfload.sty
@@ -46,7 +46,16 @@
 \RequireLuaModule{luaotfload-main}
 
 % for compatibility with beamer class, which loads pgf package.
-% under non-beamer class, tikz (pgf) should be loaded before luaotfload.
+\ifcsname AtBeginDocument\endcsname
+\AtBeginDocument{
+  \@ifpackageloaded{pgf}{
+    \newtoks\pgf@sys@pgf@resource@list@extgs@toks
+    \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}}
+  }{}}
+\endinput\fi
+% under plain tex, tikz (pgf) should be loaded before luaotfload.
 \ifcsname pgf@sys@pgf@resource@list@extgs\endcsname\else\endinput\fi
 \count255=\the\catcode`@\relax
 \catcode`@=11\relax
-- 
cgit v1.2.3


From a3476613318cc7c815bb889011dfa73eaee4eb2c Mon Sep 17 00:00:00 2001
From: Dohyun Kim <nomosnomos@gmail.com>
Date: Mon, 4 May 2015 22:01:59 +0900
Subject: fix prev commit

---
 src/luaotfload.sty | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

(limited to 'src/luaotfload.sty')

diff --git a/src/luaotfload.sty b/src/luaotfload.sty
index 7bcde64..e89ce86 100644
--- a/src/luaotfload.sty
+++ b/src/luaotfload.sty
@@ -33,7 +33,7 @@
 \csname ifluaotfloadloaded\endcsname
 \let\ifluaotfloadloaded\endinput
 \bgroup\expandafter\expandafter\expandafter\egroup
-\expandafter\ifx\csname RequirePackage\endcsname\relax
+\expandafter\ifx\csname selectfont\endcsname\relax
   \input luatexbase.sty
 \else
   \NeedsTeXFormat{LaTeX2e}
@@ -46,10 +46,10 @@
 \RequireLuaModule{luaotfload-main}
 
 % for compatibility with beamer class, which loads pgf package.
-\ifcsname AtBeginDocument\endcsname
+\expandafter\newtoks\csname pgf@sys@pgf@resource@list@extgs@toks\endcsname
+\ifcsname selectfont\endcsname
 \AtBeginDocument{
   \@ifpackageloaded{pgf}{
-    \newtoks\pgf@sys@pgf@resource@list@extgs@toks
     \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}}
@@ -59,7 +59,6 @@
 \ifcsname pgf@sys@pgf@resource@list@extgs\endcsname\else\endinput\fi
 \count255=\the\catcode`@\relax
 \catcode`@=11\relax
-\newtoks\pgf@sys@pgf@resource@list@extgs@toks
 \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}}
-- 
cgit v1.2.3


From b745a78abc326c70e7b8495e6a1657dedc91bb5c Mon Sep 17 00:00:00 2001
From: Dohyun Kim <nomosnomos@gmail.com>
Date: Tue, 5 May 2015 00:31:45 +0900
Subject: more fix of prev commit

---
 src/luaotfload.sty | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

(limited to 'src/luaotfload.sty')

diff --git a/src/luaotfload.sty b/src/luaotfload.sty
index e89ce86..ad0800f 100644
--- a/src/luaotfload.sty
+++ b/src/luaotfload.sty
@@ -46,10 +46,9 @@
 \RequireLuaModule{luaotfload-main}
 
 % for compatibility with beamer class, which loads pgf package.
-\expandafter\newtoks\csname pgf@sys@pgf@resource@list@extgs@toks\endcsname
 \ifcsname selectfont\endcsname
-\AtBeginDocument{
-  \@ifpackageloaded{pgf}{
+  \AtBeginDocument{\@ifpackageloaded{pgf}{
+    \csname newtoks\endcsname\pgf@sys@pgf@resource@list@extgs@toks
     \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}}
@@ -59,6 +58,7 @@
 \ifcsname pgf@sys@pgf@resource@list@extgs\endcsname\else\endinput\fi
 \count255=\the\catcode`@\relax
 \catcode`@=11\relax
+\newtoks\pgf@sys@pgf@resource@list@extgs@toks
 \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}}
-- 
cgit v1.2.3


From 0092480f01e16c50a81b2cbe6bacde51d746802a Mon Sep 17 00:00:00 2001
From: Dohyun Kim <nomosnomos@gmail.com>
Date: Tue, 5 May 2015 00:42:10 +0900
Subject: pgfsys package, not pgf.

---
 src/luaotfload.sty | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'src/luaotfload.sty')

diff --git a/src/luaotfload.sty b/src/luaotfload.sty
index ad0800f..6ea4c0a 100644
--- a/src/luaotfload.sty
+++ b/src/luaotfload.sty
@@ -47,7 +47,7 @@
 
 % for compatibility with beamer class, which loads pgf package.
 \ifcsname selectfont\endcsname
-  \AtBeginDocument{\@ifpackageloaded{pgf}{
+  \AtBeginDocument{\@ifpackageloaded{pgfsys}{
     \csname newtoks\endcsname\pgf@sys@pgf@resource@list@extgs@toks
     \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
-- 
cgit v1.2.3

