| 1 |
% Copyright 2019 by Till Tantau |
| 2 |
% |
| 3 |
% This file may be distributed and/or modified |
| 4 |
% |
| 5 |
% 1. under the LaTeX Project Public License and/or |
| 6 |
% 2. under the GNU Public License. |
| 7 |
% |
| 8 |
% See the file doc/generic/pgf/licenses/LICENSE for more details. |
| 9 |
|
| 10 |
\ProvidesFileRCS{pgfsys-xetex.def} |
| 11 |
|
| 12 |
\input pgfsys-dvipdfmx.def |
| 13 |
|
| 14 |
\def\pgfsys@dvipdfmx@patternobj#1{% |
| 15 |
% I have NO idea why this is necessary for xdvipdfmx - but without |
| 16 |
% it, it crashes. |
| 17 |
\pgfutil@insertatbegincurrentpagefrombox{#1}% |
| 18 |
}% |
| 19 |
|
| 20 |
% XeTeX supports pdftex commands for paper size |
| 21 |
\def\pgfsys@papersize#1#2{% |
| 22 |
\pdfpageheight#2\relax% |
| 23 |
\pdfpagewidth#1\relax} |
| 24 |
|
| 25 |
\def\pgfsys@global@papersize#1#2{% |
| 26 |
\global\pdfpageheight#2\relax% |
| 27 |
\global\pdfpagewidth#1\relax} |
| 28 |
|
| 29 |
|
| 30 |
% Xetex does not support interpolate and not mask |
| 31 |
\def\pgfsys@defineimage{% width, height, page number |
| 32 |
\ifx\includegraphics\undefined |
| 33 |
\ifx\pgf@imagewidth\pgfutil@empty\edef\pgf@imagewidth{1bp}\fi% width? |
| 34 |
\ifx\pgf@imageheight\pgfutil@empty\edef\pgf@imageheight{1bp}\fi% height? |
| 35 |
\ifx\pgf@imagepage\pgfutil@empty\else\edef\pgf@imagepage{ page \pgf@imagepage}\fi% |
| 36 |
\ifx\pgf@imageinterpolate\pgfutil@empty\else\edef\pgf@imageinterpolate{ /Interpolate\space\pgf@imageinterpolate}\fi% |
| 37 |
\ifx\pgf@imagemask\pgfutil@empty\else\xdef\pgf@imagemask{ /SMask @\pgf@imagemask}\fi% |
| 38 |
\edef\pgf@image{\noexpand\hbox to \pgf@imagewidth{\vbox to \pgf@imageheight{\vfil\special{pdf:image width \pgf@imagewidth\space height \pgf@imageheight\space\pgf@imagepage\space(\pgf@filename) <<\pgf@imageinterpolate\pgf@imagemask\space>>}}\hfil}}% |
| 39 |
\else |
| 40 |
\ifx\pgf@imagewidth\pgfutil@empty\else\edef\pgf@imagewidth{width=\pgf@imagewidth,}\fi% |
| 41 |
\ifx\pgf@imageheight\pgfutil@empty\else\edef\pgf@imageheight{height=\pgf@imageheight,}\fi% |
| 42 |
\ifx\pgf@imagepage\pgfutil@empty\else\edef\pgf@imagepage{page=\pgf@imagepage,}\fi% |
| 43 |
\edef\pgf@image{\noexpand\includegraphics[\pgf@imageheight\pgf@imagewidth\pgf@imagepage]{\pgf@filename}}% |
| 44 |
\fi% |
| 45 |
} |
| 46 |
|
| 47 |
% XeTeX supports position tracking, now |
| 48 |
\def\pgfsys@markposition#1{% |
| 49 |
\pdfsavepos% |
| 50 |
\edef\pgf@temp{#1}% |
| 51 |
\expandafter\pgfutil@writetoaux\expandafter{% |
| 52 |
\expandafter\noexpand\expandafter\pgfsyspdfmark\expandafter{\pgf@temp}{\the\pdflastxpos}{\the\pdflastypos}}% |
| 53 |
} |
| 54 |
|
| 55 |
\def\pgfsyspdfmark#1#2#3{% |
| 56 |
\expandafter\gdef\csname pgf@sys@pdf@mark@pos@#1\endcsname{\pgfqpoint{#2sp}{#3sp}}% |
| 57 |
\pgfutil@check@rerun{#1}{{#2}{#3}}% |
| 58 |
} |
| 59 |
|
| 60 |
\def\pgfsys@getposition#1#2{% |
| 61 |
\edef\pgf@marshal{\let\noexpand#2=\expandafter\noexpand\csname pgf@sys@pdf@mark@pos@#1\endcsname}% |
| 62 |
\pgf@marshal% |
| 63 |
} |
| 64 |
|
| 65 |
\ifnum\the\XeTeXversion\expandafter\pgfutil@gobble\XeTeXrevision>0999991\relax |
| 66 |
\def\pgf@sys@pdf@mark@pos@pgfpageorigin{\pgfqpoint{\hoffset}{\voffset}} |
| 67 |
\else |
| 68 |
\def\pgf@sys@pdf@mark@pos@pgfpageorigin{\pgfqpoint{2\hoffset}{0pt}} |
| 69 |
\fi |
| 70 |
|
| 71 |
\ifx\paperheight\@undefined |
| 72 |
\else |
| 73 |
\pdfpagewidth\paperwidth |
| 74 |
\pdfpageheight\paperheight % this is to work around a positioning problem in xetex. |
| 75 |
\fi |
| 76 |
|
| 77 |
|
| 78 |
|
| 79 |
\endinput |