diff options
Diffstat (limited to 'Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-context.def')
-rw-r--r-- | Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-context.def | 131 |
1 files changed, 111 insertions, 20 deletions
diff --git a/Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-context.def b/Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-context.def index 784cb59cdc9..08d3bf93c77 100644 --- a/Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-context.def +++ b/Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-context.def @@ -59,7 +59,15 @@ \edef#3{\expandafter\expandafter\expandafter\pgfutil@emu@select\csname\string\color@#1\endcsname}% } -\let\pgfutil@doifcolorelse=\doifcolorelse + +\def\pgfutil@doifcolorelse#1#2#3{% + \expandafter\ifx\csname\string\color@#1\endcsname\relax% + \doifcolorelse{#1}{\let\pgf@next=\pgfutil@firstoftwo}{\let\pgf@next=\pgfutil@secondoftwo}% + \else + \let\pgf@next=\pgfutil@firstoftwo% + \fi% + \pgf@next{#2}{#3}% +} \def\pgfutil@reset@color{% @@ -136,12 +144,12 @@ \edef\pgf@marshal{\noexpand\pgfutil@in@{ g}{\pgf@temp}}% \pgf@marshal% \ifpgfutil@in@% - \expandafter\pgfutil@context@parse@gray\pgf@temp{#1}% + \expandafter\pgfutil@context@parse@gray\pgf@temp\pgf@stop{#1}% \else% \edef\pgf@marshal{\noexpand\pgfutil@in@{ rg}{\pgf@temp}}% \pgf@marshal% \ifpgfutil@in@% - \expandafter\pgfutil@context@parse@rgb\pgf@temp{#1}% + \expandafter\pgfutil@context@parse@rgb\pgf@temp\pgf@stop{#1}% \else% \PackageError{pgf}{Color #1 has an unsupported color model.}{}% \pgfutil@definecolor{#1}{gray}{0} @@ -149,14 +157,16 @@ \fi% } -\def\pgfutil@context@parse@gray#1 g#2{% - \pgfutil@definecolor{#2}{gray}{#1} +\def\pgfutil@context@parse@gray#1 g#2\pgf@stop#3{% + \pgfutil@definecolor{#3}{gray}{#1} } -\def\pgfutil@context@parse@rgb#1 #2 #3 rg#4{% - \pgfutil@definecolor{#4}{rgb}{#1,#2,#3} +\def\pgfutil@context@parse@rgb#1 #2 #3 rg#4\pgf@stop#5{% + \pgfutil@definecolor{#5}{rgb}{#1,#2,#3} } +% Make this command available in general: +\let\colorlet=\pgfutil@colorlet % pgfutil@minipage @@ -174,12 +184,39 @@ \ifx\pdfoutput\@undefined\newcount\pdfoutput\fi \ifx\pdfoutput\relax\newcount\pdfoutput\fi -\ifcase\pdfoutput% - \gdef\Gin@driver{dvips.def}% -\else% - \gdef\Gin@driver{pdftex.def}% -\fi% +\def\pgfutil@guessdriver{ + \ifx\XeTeXversion\@undefined + \ifx\preloadedspecials\@undefined% + \ifcase\pdfoutput% + \def\pgfsysdriver{pgfsys-dvips.def}% + \else% + \def\pgfsysdriver{pgfsys-pdftex.def}% pdfTeX & LuaTeX + \fi% + \else% + \pgfutil@driver@if@in{postscript}{pgfsys-dvips.def} + \pgfutil@driver@if@in{tpd}{pgfsys-pdftex.def} + \pgfutil@driver@if@in{dpm}{pgfsys-dvipdfm.def} + \pgfutil@driver@if@in{dpx}{pgfsys-dvipdfmx.def} + \pgfutil@driver@if@in{xetex}{pgfsys-xetex.def} + \ifx\pgfsysdriver\relax% + \PackageWarning{pgf}{I was not able to discern the driver, the + preloaded specials were \preloadedspecials. I am going to use + pgfsys-dvips.def}% + \def\pgfsysdriver{pgfsys-dvips.def} + \fi% + \fi + \else + \def\pgfsysdriver{pgfsys-xetex.def}% should be right + \fi +} +\def\pgfutil@driver@if@in#1#2{% + \edef\pgf@marshal{\noexpand\pgfutil@in@{#1}{\preloadedspecials}} + \pgf@marshal + \ifpgfutil@in@% + \def\pgfsysdriver{#2}% + \fi% +} % Global colors @@ -191,7 +228,7 @@ % Font stuff -\def\pgfutil@font@tiny{\tfxx} % How to do this correctly? +\def\pgfutil@font@tiny{\tfxx} \def\pgfutil@font@scriptsize{\tfxx} \def\pgfutil@font@footnotesize{\tfx} \def\pgfutil@font@small{\tfx} @@ -204,9 +241,9 @@ \def\pgfutil@font@itshape{\it} \def\pgfutil@font@bfseries{\bf} -\let\pgfutil@font@normalfont=\rm +\let\pgfutil@font@normalfont=\tf -\let\pgfutil@selectfont=\rm +\let\pgfutil@selectfont=\tf % Extra counters, registers, boxes @@ -219,14 +256,68 @@ \newdimen\pgfutil@tempdima \newdimen\pgfutil@tempdimb +\newbox \pgfutil@voidb@x +\newtoks \pgfutil@toks@ + % Module stuff -\def\pgfutil@usemodule#1{\usemodule[#1]} +\long\def\pgfutil@usemodule#1{% + % seems as if \usemodule resets \catcodes... handle that here: + \long\edef\pgf@temp##1{% + \noexpand\usemodule[##1]\noexpand\relax% + \noexpand\catcode`\noexpand\@=\the\catcode`\@\relax + \noexpand\catcode`\noexpand\|=\the\catcode`\|\relax + }% + \pgf@temp{#1}% +} -% End of job stuff +% Adding something at the begin of the current page: + +\let\pgfutil@insertatbegincurrentpagefrombox=\flushatshipout +\let\pgfutil@insertatbegincurrentpage=\flushatshipout +\def\pgfutil@insertatbegineverypage#1{\appendtoks #1 \to \everyshipout} + +% Adding something to the pdf-resources: + +\def\pgfutil@addpdfresource@extgs#1{\appendtoPDFdocumentextgstates{#1}} +\def\pgfutil@addpdfresource@colorspaces#1{\appendtoPDFdocumentcolorspaces{#1}} +\def\pgfutil@addpdfresource@patterns#1{\appendtoPDFdocumentpatterns{#1}} +\def\pgfutil@setuppdfresources{} + +\ifx\appendtoPDFdocumentpatterns\undefined + \let\docuPDFpatterns\empty + \def\checkPDFpatterns + {\ifx\docuPDFpatterns\empty \else + \ifnum\realpageno=\lastpage\relax + \doPDFdictionaryobject{FDF}{docupatterns}{\docuPDFpatterns}% + \fi + \doPDFgetobjectreference{FDF}{docupatterns}\PDFobjectreference + \doPDFpageresource{/Pattern \PDFobjectreference}% + \fi} + \appendtoksonce \checkPDFpatterns \to \everyshipout + \def\appendtoPDFdocumentpatterns#1{\xdef\docuPDFpatterns{\docuPDFpatterns\space#1}} +\fi + +% Collect resources (don't know how to do this otherwise) + +\def\pgf@sys@pdf@check@resources{% + \global\let\pgf@sys@pdf@possible@resources\pgfutil@empty% + \doifobjectreferencefoundelse{FDF}{docushades} + {\doPDFgetobjectreference{FDF}{docushades}\PDFobjectreference + \xdef\pgf@sys@pdf@possible@resources{\pgf@sys@pdf@possible@resources/Shading \PDFobjectreference}}\donothing + \doifobjectreferencefoundelse{FDF}{docuextgstates} + {\doPDFgetobjectreference{FDF}{docuextgstates}\PDFobjectreference + \xdef\pgf@sys@pdf@possible@resources{\pgf@sys@pdf@possible@resources/ExtGState \PDFobjectreference}}\donothing + \doifobjectreferencefoundelse{FDF}{colorspaces} + {\doPDFgetobjectreference{FDF}{colorspaces}\PDFobjectreference + \xdef\pgf@sys@pdf@possible@resources{\pgf@sys@pdf@possible@resources/ColorSpace \PDFobjectreference}}\donothing +} + + +% Do something at the end of a job \appendtoks \the\pgfutil@everybye \to \everybye @@ -237,9 +328,9 @@ % prefixed by pgfutil@): \def\PackageInfo#1#2{} -\def\PackageWarning#1#2{\immediate\write-1{Package #1: Warning! #2.}}% -\def\PackageError#1#2#3{\immediate\write-1{Package #1: Error! #2.}}% +\def\PackageWarning#1#2{\immediate\write17{Package #1: Warning! #2.}}% +\def\PackageError#1#2#3{\immediate\write17{Package #1: Error! #2.}}% \long\def\AtBeginDocument#1{#1}% -\long\def\AtBeginDvi#1{#1}% \endinput +% vi: ft=tex ts=2 sw=2 expandtab |