[tex-live] pgfsys-luatex.def file

Norbert Preining preining at logic.at
Sat Apr 30 15:44:38 CEST 2016


Dear all,

I have taken a second look at pgfsys-luatex.def and have replaced
(using perl) all the occurrences of old macros/primitives that have
been replaced in newer luatex.

I have tested the file with several of my documents containing pgf/tikz
drawing, all without any problem.

I attach the file, and if some other people could test it it would be
great.

Send also to the pgf bug report.

All the best

Norbert

------------------------------------------------------------------------
PREINING, Norbert                               http://www.preining.info
JAIST, Japan                                 TeX Live & Debian Developer
GPG: 0x860CDC13   fp: F7D8 A928 26E3 16A1 9FA0  ACF0 6CAC A448 860C DC13
------------------------------------------------------------------------
-------------- next part --------------
% Copyright 2006 by Till Tantau
%
% This file may be distributed and/or modified
%
% 1. under the LaTeX Project Public License and/or
% 2. under the GNU Public License.
%
% See the file doc/generic/pgf/licenses/LICENSE for more details.

\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/systemlayer/pgfsys-luatex.def,v 1.35 2014/10/11 09:23:31 vibrovski Exp $


% Driver commands for pdf

%
% Load common pdf commands:
%
\input pgfsys-common-pdf.def

%
% pdftex-specific stuff:
%
\def\pgfsys at invoke#1{\pdfextension literal{#1}}

% Synced hboxes
\def\pgfsys at hboxsynced#1{%
  {%
    \pgfsys at beginscope%
    \setbox\pgf at hbox=\hbox{%
      \hskip\pgf at pt@x%
      \raise\pgf at pt@y\hbox{%
        \pgf at pt@x=0pt%
        \pgf at pt@y=0pt%
        \pgflowlevelsynccm% 
        \pgfsys at hbox#1}%
      \hss%
    }%
    \wd\pgf at hbox=0pt%
    \ht\pgf at hbox=0pt%
    \dp\pgf at hbox=0pt%
    \box\pgf at hbox%
    \pgfsys at endscope%
  }%
}



\def\pgfsys at imagesuffixlist{.pdf:.jpg:.jpeg:.png:}
\def\pgfsys at defineimage{% width, height, page number
  \ifx\pgf at imagewidth\pgfutil at empty\else\edef\pgf at imagewidth{ width \pgf at imagewidth }\fi%
  \ifx\pgf at imageheight\pgfutil at empty\else\edef\pgf at imageheight{ height \pgf at imageheight }\fi%
  \ifx\pgf at imagepage\pgfutil at empty\else\edef\pgf at imagepage{ page \pgf at imagepage }\fi%
  \ifx\saveimageresource\@undefined% old version of lualatex
    \ifx\pgf at imagepage\pgfutil at empty\else%
      \pgfwarning{Page selection not supported. Ignoring page selection}%
    \fi%
    \setbox\pgfutil at tempboxa=\hbox{%
      \pdfimage \pgf at imageheight \pgf at imagewidth {\pgf at filename}}%
    \pdfform\pgfutil at tempboxa%
    \edef\pgf at image{\noexpand\pdfrefform\the\pdflastform}%
  \else% new version
    {\saveimageresource \pgf at imageheight \pgf at imagewidth attr
      {/Interpolate \pgf at imageinterpolate\space\pgf at imagemask} \pgf at imagepage
      {\pgf at filename}}%
    \edef\pgf at image{\noexpand\useimageresource\the\lastsavedimageresourceindex}%
  \fi
}%
\def\pgfsys at definemask#1{%
  \ifx\pgf at maskmatte\pgfutil at empty%
  \else%
    \edef\pgf at maskmatte{/Matte [\pgf at maskmatte]}%
  \fi%
  \edef\pgf at attr{{\pgf at maskmatte\space /Decode [1 0]}}%
  \immediate\saveimageresource attr \pgf at attr {\pgf at filename}%
  \edef\pgf at mask{/SMask \the\lastsavedimageresourceindex\space 0 R}%
}
\def\pgfsys at horishading#1#2#3{%
  {%
    \pgf at parsefunc{#3}%
    \pgfmathparse{#2}%
    \setbox\pgfutil at tempboxa=\hbox to\pgf at max{\vbox to\pgfmathresult pt{\vfil\pgfsys at invoke{/Sh sh}}\hfil}%
    \pgf at process{\pgfpoint{\pgf at max}{#2}}%
    \immediate\saveboxresource resources {%
      /Shading << /Sh << /ShadingType 2
      /ColorSpace /DeviceRGB
      /Domain [\pgf at pdfparseddomain]
      /Coords [\pgf at doma\space0 \pgf at domb\space0]
      /Function \pgf at pdfparsedfunction
      /Extend [false false] >> >>}\pgfutil at tempboxa% <<
    \expandafter\xdef\csname @pgfshading#1!\endcsname{\leavevmode\noexpand\useboxresource\the\lastsavedboxresourceindex}% 
  }%
}
\def\pgfsys at vertshading#1#2#3{%
  {%
    \pgf at parsefunc{#3}%
    \pgfmathparse{#2}%
    \setbox\pgfutil at tempboxa=\hbox to\pgfmathresult pt{\vbox to\pgf at max{\vfil\pgfsys at invoke{/Sh sh}}\hfil}%
    \pgf at process{\pgfpoint{#2}{\pgf at max}}%
    \immediate\saveboxresource resources {%
      /Shading << /Sh << /ShadingType 2
      /ColorSpace /DeviceRGB
      /Domain [\pgf at pdfparseddomain]
      /Coords [0 \pgf at doma\space0 \pgf at domb]
      /Function \pgf at pdfparsedfunction
      /Extend [false false] >> >>}\pgfutil at tempboxa% <<
    \expandafter\xdef\csname @pgfshading#1!\endcsname{\leavevmode\noexpand\useboxresource\the\lastsavedboxresourceindex}%
  }%
}
\def\pgfsys at radialshading#1#2#3{%
  {%
    \pgf at parsefunc{#3}%
    \setbox\pgfutil at tempboxa=\hbox to2\pgf at max{\vbox to2\pgf at max{\vfil\pgfsys at invoke{/Sh sh}}\hfil}%
    \pgf at process{#2}%
    \pgf at xa=\pgf at x%
    \pgf at ya=\pgf at y%
    \pgf at process{\pgfpoint{\pgf at max}{\pgf at max}}%
    \advance\pgf at xa by \pgf at x%
    \advance\pgf at ya by \pgf at y%
    \pgf at sys@bp at correct{\pgf at x}%
    \pgf at sys@bp at correct{\pgf at y}%
    \pgf at sys@bp at correct{\pgf at xa}%
    \pgf at sys@bp at correct{\pgf at ya}%
    \immediate\saveboxresource resources {%
      /Shading << /Sh << /ShadingType 3
      /ColorSpace /DeviceRGB
      /Domain [\pgf at pdfparseddomain]
      /Coords [\pgf at sys@tonumber{\pgf at xa} \pgf at sys@tonumber{\pgf at ya} \pgf at doma\space \pgf at sys@tonumber{\pgf at x} \pgf at sys@tonumber{\pgf at y} \pgf at domb]
      /Function \pgf at pdfparsedfunction
      /Extend [true false] >> >>}\pgfutil at tempboxa% <<
    \expandafter\xdef\csname @pgfshading#1!\endcsname{\leavevmode\noexpand\useboxresource\the\lastsavedboxresourceindex}%
  }%
}%
\def\pgfsys at functionalshading#1#2#3#4{%
  {%
    \pgf at process{#2}%
    \pgf at xa=\pgf at x%
    \pgf at ya=\pgf at y%
    \pgf at process{#3}%
    \pgf at xb=\pgf at x%
    \pgf at yb=\pgf at y%
    \advance\pgf at x by-\pgf at xa%
    \advance\pgf at y by-\pgf at ya%
    \setbox\pgfutil at tempboxa=\hbox to\pgf at x{\vbox to\pgf at y{\vfil\pgfsys at invoke{/Sh sh}}\hfil}%
    \pgf at sys@bp at correct{\pgf at xa}%
    \pgf at sys@bp at correct{\pgf at ya}%
    \pgf at sys@bp at correct{\pgf at xb}%
    \pgf at sys@bp at correct{\pgf at yb}%
    \pgf at xc=-\pgf at xa%
    \pgf at yc=-\pgf at ya%
    % Now build the function
    \pdfextension obj 
    stream
    attr
    {
      /FunctionType 4
      /Domain [\pgf at sys@tonumber{\pgf at xa}\space\pgf at sys@tonumber{\pgf at xb}\space\pgf at sys@tonumber{\pgf at ya}\space\pgf at sys@tonumber{\pgf at yb}]
      /Range [0 1 0 1 0 1]
    }
    {{#4}}%
    \edef\pgf at temp@num{\the\numexpr\pdffeedback lastobj\relax}%
    \saveboxresource resources {%
      /Shading << /Sh << /ShadingType 1
      /ColorSpace /DeviceRGB
      /Matrix [1 0 0 1 \pgf at sys@tonumber{\pgf at xc}\space\pgf at sys@tonumber{\pgf at yc}]
      /Domain [\pgf at sys@tonumber{\pgf at xa}\space\pgf at sys@tonumber{\pgf at xb}\space\pgf at sys@tonumber{\pgf at ya}\space\pgf at sys@tonumber{\pgf at yb}]
      /Function \pgf at temp@num\space 0 R 
      >> >>}\pgfutil at tempboxa% <<
    \expandafter\xdef\csname @pgfshading#1!\endcsname{%
      \leavevmode%
      \noexpand\useboxresource\the\lastsavedboxresourceindex%
      \noexpand\pdfextension refobj \pgf at temp@num%
    }%
  }%
}



% Patterns

\def\pgfsys at declarepattern#1#2#3#4#5#6#7#8#9{%
  % Start building the pattern dictionary:
  \pgf at xa=#2\relax%
  \pgf at ya=#3\relax% 
  \pgf at xb=#4\relax%
  \pgf at yb=#5\relax%
  \pgf at xc=#6\relax%
  \pgf at yc=#7\relax%
  \pgf at sys@bp at correct\pgf at xa%
  \pgf at sys@bp at correct\pgf at ya%
  \pgf at sys@bp at correct\pgf at xb%
  \pgf at sys@bp at correct\pgf at yb%
  \pgf at sys@bp at correct\pgf at xc%
  \pgf at sys@bp at correct\pgf at yc%
  % Now create the pattern object:
  \immediate\pdfextension obj  stream
  attr
  {
    /Type /Pattern
    /PatternType 1
    /PaintType \ifnum#9=0 2 \else 1 \fi
    /TilingType 1
    /BBox [\pgf at sys@tonumber\pgf at xa\space\pgf at sys@tonumber\pgf at ya\space\pgf at sys@tonumber\pgf at xb\space\pgf at sys@tonumber\pgf at yb]
    /XStep \pgf at sys@tonumber\pgf at xc\space
    /YStep \pgf at sys@tonumber\pgf at yc\space
    /Resources << >> %<<
  }
  {#8}% 
  \pgfutil at addpdfresource@patterns{/pgfpat#1\space \the\numexpr\pdffeedback lastobj\relax\space 0 R}%
}

\def\pgfsys at setpatternuncolored#1#2#3#4{%
  \pgfsysprotocol at literal{/pgfprgb cs #2 #3 #4 /pgfpat#1\space scn}%
}

\def\pgfsys at setpatterncolored#1{%
  \pgfsysprotocol at literal{/Pattern cs /pgfpat#1\space scn}%
}

% System layer for meta patterns
% Takes 15(!) arguments
% #1    pattern name
% #2 #3 bounding box lower left
% #4 #5 bounding box upper right
% #6 #7 tile size
% #8 #9 #10 #11 #12 #13 transformation matrix
% #14   protocoled text
% #15   pattern type
\def\pgfsys at declarepattern@meta#1#2#3#4#5#6#7{%
  % Start building the pattern dictionary:
  \pgf at xa=#2\relax%
  \pgf at ya=#3\relax% 
  \pgf at xb=#4\relax%
  \pgf at yb=#5\relax%
  \pgf at xc=#6\relax%
  \pgf at yc=#7\relax%
  \pgf at sys@bp at correct\pgf at xa%
  \pgf at sys@bp at correct\pgf at ya%
  \pgf at sys@bp at correct\pgf at xb%
  \pgf at sys@bp at correct\pgf at yb%
  \pgf at sys@bp at correct\pgf at xc%
  \pgf at sys@bp at correct\pgf at yc%
  \pgfsys@@declarepattern at meta{#1}}

\def\pgfsys@@declarepattern at meta#1#2#3#4#5#6#7#8#9{%
   \pgfutil at tempdima=#6\relax%
   \pgfutil at tempdimb=#7\relax%
   \pgf at sys@bp at correct\pgf at xa%
   \pgf at sys@bp at correct\pgf at ya%
   % Now create the pattern object:
   \immediate\pdfextension obj  stream
   attr
   {
     /Type /Pattern
     /PatternType 1
     /PaintType \ifnum#9=0 2 \else 1 \fi
     /TilingType 1
     /BBox [\pgf at sys@tonumber\pgf at xa\space\pgf at sys@tonumber\pgf at ya\space\pgf at sys@tonumber\pgf at xb\space\pgf at sys@tonumber\pgf at yb]
     /XStep \pgf at sys@tonumber\pgf at xc\space
     /YStep \pgf at sys@tonumber\pgf at yc\space
     /Matrix [#2\space#3\space#4\space#5\space\pgf at sys@tonumber\pgfutil at tempdima\space\pgf at sys@tonumber\pgfutil at tempdimb]
     /Resources << >> %<<
   }
   {#8}% 
   \pgfutil at addpdfresource@patterns{/pgfpat#1\space \the\numexpr\pdffeedback lastobj\relax\space 0 R}%
 }



\def\pgfsys at papersize#1#2{\pageheight#2\relax\pagewidth#1\relax}

\def\pgfsys at global@papersize#1#2{\global\pageheight#2\relax\global\pagewidth#1\relax}

\ifx\paperheight\@undefined
  \def\pgfsys at thepageheight{\pageheight}
  \def\pgfsys at thepagewidth{\pagewidth}
\fi


%
% Position tracking
%
\def\pgfsys at markposition#1{%
  \savepos%
  \edef\pgf at temp{#1}%
  \expandafter\pgfutil at writetoaux\expandafter{%
    \expandafter\noexpand\expandafter\pgfsyspdfmark\expandafter{\pgf at temp}{\the\lastxpos}{\the\lastypos}}%
}

\def\pgfsyspdfmark#1#2#3{%
  \expandafter\gdef\csname pgf at sys@pdf at mark@pos@#1\endcsname{\pgfqpoint{#2sp}{#3sp}}%
  \pgfutil at check@rerun{#1}{{#2}{#3}}%
}

\def\pgfsys at getposition#1#2{%
  \edef\pgf at marshal{\let\noexpand#2=\expandafter\noexpand\csname pgf at sys@pdf at mark@pos@#1\endcsname}%
  \pgf at marshal%
}

\def\pgf at sys@pdf at mark@pos at pgfpageorigin{\pgfqpoint{\hoffset}{\voffset}}


%
% Opacity masks
%
\def\pgfsys at fadingfrombox#1#2{%
  {%
    \pgf at sys@pdf at check@resources%
    \pgf at x=-.5\wd#2%
    \pgf at y=-.5\ht#2%
    \advance\pgf at y by.5\dp#2%
    \expandafter\xdef\csname pgfsmasktrans@#1\endcsname{%
      \noexpand\pgftransformcm{1}{0}{0}{1}{\noexpand\pgfqpoint{\the\pgf at x}{\the\pgf at y}}}%
    \saveboxresource resources { \pgf at sys@pdf at possible@resources } #2%
    \expandafter\xdef\csname pgfsmaskxform@#1\endcsname{\the\lastsavedboxresourceindex}%
  }%
}
\def\pgfsys at usefading#1#2#3#4#5#6#7{%
  \expandafter\ifx\csname pgfsmaskxform@#1\endcsname\relax%
    \pgferror{Undefined fading '#1'}%
  \else%
    {%
      \expandafter\ifx\csname pgfsmaks@#1\endcsname\relax%
        \pgf at sys@pdf at install@mask{#1}%
      \fi%
      \pgftransformreset%
      \pgftransformcm{#2}{#3}{#4}{#5}{\pgfpoint{#6}{#7}}%
      \csname pgfsmasktrans@#1\endcsname%
      {%
        \pgflowlevelsynccm%
        \pgfsys at invoke{/pgfsmask\csname pgfsmask@#1\endcsname\space gs}%
      }%
      \pgftransforminvert%
      \pgflowlevelsynccm%
    }%
  \fi
}

\def\pgf at sys@pdf at install@mask#1{%
  \setbox\pgfutil at tempboxa=\hbox{\useboxresource\csname pgfsmaskxform@#1\endcsname}
  \immediate\saveboxresource%
    attr {
    /Group
    <<
      /S /Transparency
      /CS /DeviceGray
    >>
  }% <<
  \pgfutil at tempboxa% 
  \pgfutil at addpdfresource@extgs{%
    /pgfsmask\the\lastsavedboxresourceindex\space
    <<
      /SMask
      <<
        /S /Luminosity
        /G \the\lastsavedboxresourceindex\space 0 R
      >>
    >> } %<<
  \expandafter\xdef\csname pgfsmask@#1\endcsname{\the\lastsavedboxresourceindex}%
}

%
% Transparency groups
%
\def\pgfsys at transparencygroupfrombox#1{%
  \pgf at sys@pdf at check@resources%
  \saveboxresource
  attr { /Group << /S /Transparency
    /I \ifpgfsys at transparency@group at isolated true \else false \fi
    /K \ifpgfsys at transparency@group at knockout true \else false \fi >> } %<<
  resources { \pgf at sys@pdf at possible@resources }
  #1%
  \setbox#1=\hbox{\useboxresource\lastsavedboxresourceindex}%
}




%
% Resource management
%

\def\pgf at sys@setuppdfresources at plain{%
  % This command will setup pdf resource in plain and in latex
  % mode. ConTeXt has its own handler
  % Page resources (they are kept in objects and only written at the
  % very end)
  \pdfextension obj  reserveobjnum \edef\pgf at sys@pdf at extgs@objnum{\the\numexpr\pdffeedback lastobj\relax}
  \pdfextension obj  reserveobjnum \edef\pgf at sys@pdf at pattern@objnum{\the\numexpr\pdffeedback lastobj\relax}
  \pdfextension obj  reserveobjnum \edef\pgf at sys@pdf at colrospaces@objnum{\the\numexpr\pdffeedback lastobj\relax}
  \def\pgf at sys@pdf at possible@resources{%
    /ColorSpace \pgf at sys@pdf at colrospaces@objnum\space 0 R
    /Pattern    \pgf at sys@pdf at pattern@objnum\space 0 R
    /ExtGState  \pgf at sys@pdf at extgs@objnum\space 0 R
  }
  \let\pgf at sys@pdf at check@resources=\relax%
  \def\pgf at sys@pdf at install@pageresources{
    {
      \edef\temp{
        \pgf at sys@pdf at possible@resources
      }
      \expandafter\global\expandafter\pdfvariable pageresources\expandafter{\temp}
    }
  }
  \pgf at sys@pdf at install@pageresources
  \expandafter\pgfutil at everybye\expandafter{%
    \the\pgfutil at everybye%
    \immediate \pdfextension obj  useobjnum \pgf at sys@pdf at extgs@objnum {<<\pgf at sys@pgf at resource@list at extgs>>}%<<
    \immediate \pdfextension obj  useobjnum \pgf at sys@pdf at pattern@objnum {<<\pgf at sys@pgf at resource@list at patterns>>}%<<
    \immediate \pdfextension obj  useobjnum \pgf at sys@pdf at colrospaces@objnum {<<\pgf at sys@pgf at resource@list at colorspaces>>}%<<
  }
  \let\pgf at sys@pgf at resource@list at extgs=\pgfutil at empty%
  \let\pgf at sys@pgf at resource@list at patterns=\pgfutil at empty%
  \let\pgf at sys@pgf at resource@list at colorspaces=\pgfutil at empty%
  \def\pgf at sys@addpdfresource at extgs@plain##1{\xdef\pgf at sys@pgf at resource@list at extgs{\pgf at sys@pgf at resource@list at extgs\space##1}}
  \def\pgf at sys@addpdfresource at patterns@plain##1{\xdef\pgf at sys@pgf at resource@list at patterns{\pgf at sys@pgf at resource@list at patterns\space##1}}
  \def\pgf at sys@addpdfresource at colorspaces@plain##1{\xdef\pgf at sys@pgf at resource@list at colorspaces{\pgf at sys@pgf at resource@list at colorspaces\space##1}}
}
\pgfutil at setuppdfresources % possibly call the above

\pgfutil at addpdfresource@colorspaces{ /pgfprgb [/Pattern /DeviceRGB] }

\def\pgfsys at color@unstacked#1{%
	\pdfextension literal{\csname\string\color@#1\endcsname}%
}

\endinput


%%% Local Variables: 
%%% mode: latex
%%% End: 


More information about the tex-live mailing list