| 1 |
|
| 2 |
\ifdefined \minimpdfresourcesloaded |
| 3 |
\wlog{(skipped)} |
| 4 |
\expandafter\endinput\fi |
| 5 |
\chardef\minimpdfresourcesloaded=\catcode`\: |
| 6 |
\catcode`\:=11 |
| 7 |
|
| 8 |
% at the moment, this file only deals with pgf compatibility. if you do not use |
| 9 |
% pgf, you only need the lua module. |
| 10 |
|
| 11 |
\directlua{ require 'minim-pdfresources' } |
| 12 |
|
| 13 |
% 1 pgf compatibility |
| 14 |
|
| 15 |
% this ballet inserts our fix directly at the end of pgfsys-luatex.def |
| 16 |
% (see the \ProvidesFile redefinition in minim-alloc.tex) |
| 17 |
\expandafter\def\csname minim:intercept:pgfsys-luatex.def\endcsname |
| 18 |
{\wlog{minim: applying pgf patches...}\newtoks\minim:pgf:fix:toks |
| 19 |
\minim:pgf:fix:toks\csname pgfutil@everybye\endcsname |
| 20 |
\let\endinput=\minim:pgf:fix:endinput} |
| 21 |
\def\minim:pgf:fix:endinput{% |
| 22 |
\begincsname minim:pgf:fix:\minim:currentfile\endcsname |
| 23 |
\minim:endinput} |
| 24 |
\expandafter\def\csname minim:pgf:fix:pgfsys-luatex.def\endcsname{% |
| 25 |
\csname pgfutil@everybye\endcsname\minim:pgf:fix:toks \minim:pgf:fix:common |
| 26 |
\let\endinput=\minim:endinput \wlog{minim: done applying pgf patches}} |
| 27 |
|
| 28 |
\def\minim:pgf:fix:common{\directlua{% |
| 29 |
local pdfres = require 'minim-pdfresources' |
| 30 |
pdfres.add_global_resource('ExtGState', nil, |
| 31 |
'\luaescapestring{\csname pgf@sys@pgf@resource@list@extgs\endcsname}') |
| 32 |
pdfres.add_global_resource('Pattern', nil, |
| 33 |
'\luaescapestring{\csname pgf@sys@pgf@resource@list@patterns\endcsname}') |
| 34 |
pdfres.add_global_resource('ColorSpace', nil, |
| 35 |
'\luaescapestring{\csname pgf@sys@pgf@resource@list@colorspaces\endcsname}')} |
| 36 |
\expandafter\let\csname pgf@sys@pdf@possible@resources\endcsname = \empty |
| 37 |
\minim:pgf:fix:luaside \pdfvariable pageresources{}} |
| 38 |
|
| 39 |
% if pgf has already been loaded, copy the already-defined resources |
| 40 |
\ifcsname pgf@sys@pdf@extgs@objnum\endcsname \minim:pgf:fix:common |
| 41 |
% three empty registers will be written at the end. having three unused |
| 42 |
% empty objects in the pdf is not ideal, but will not lead to problems. |
| 43 |
\expandafter\let\csname pgf@sys@pgf@resource@list@extgs\endcsname = \empty |
| 44 |
\expandafter\let\csname pgf@sys@pgf@resource@list@patterns\endcsname = \empty |
| 45 |
\expandafter\let\csname pgf@sys@pgf@resource@list@colorspaces\endcsname = \empty |
| 46 |
\fi |
| 47 |
|
| 48 |
% |
| 49 |
|
| 50 |
\catcode`\:=\minimpdfresourcesloaded |
| 51 |
\endinput |
| 52 |
|