1 %% This is file `xetex.def
' for XeTeX,
2 %% based upon other drivers for LaTeX color and graphics support.
4 %% Copyright 2004-2007, 2009, 2013-2016
5 %% Ross Moore <ross@maths.mq.edu.au>
6 %% modified by Jonathan Kew et al.
8 %% Copyright 2016 LaTeX3 project and above named authors.
10 %% This file is not part of the Standard LaTeX `Graphics Bundle'.
11 %% It may be distributed under the terms of the LaTeX Project Public
12 %% License
, as described in lppl.txt in the base LaTeX distribution.
13 %% Either version
1.0 or
, at your option
, any later version.
15 %% This work has the LPPL maintenance status `maintained
'.
17 %% The Current Maintainer of this work is the LaTeX3 Project.
19 %% https://github.com/latex3/graphics-def/issues
22 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
25 %% 2016/07/10 [DPC] [v4.10] \mag test added to all the files
27 %% 2016/07/02 [DPC] [v4.09] support new (no)setpagesize options of
28 %% color and graphics packages.
29 %% revert pagecolor code to match dvips
31 %% 2016/04/06 [AK] [v4.08] Support new suffix .mps (or .MPS) for eps files
32 %% created by MetaPost. In TeX Live 2016, the option --mvorigin
33 %% for [x]dvipdfmx is necessary to include MetaPost-created eps
34 %% files by the usual \Ginclude@eps. This may a bit be inconvenient.
35 %% Thus we introduce a new command \Ginclude@mps for the suffix
36 %% .mps (or .MPS). In \Ginclude@mps, llx, lly, urx, and ury are
37 %% natural compared with those in \Ginclude@eps. Thus the origin
38 %% should not be translated, that is the option --mvorigin should
41 %% 2015/09/11 [AK, NA, TY] [v4.06] Support pagebox=artbox, etc. in xelatex,
42 %% like in pdflatex. It requires new xetex and xdvipdfmx, which
43 %% will be available in TeX Live 2016. Interested users may build
44 %% new binaries by using new sources in the TeX Live repository.
46 %% 2015/03/26 [SH] [v4.04] JPEG 2000 (.jp2, .jpf) support, written for
49 %% 2014/04/28 [KB] [v4.03] \newif outside \def. Skipped 4.02.
51 %% 2014/04/28 [HO] [v4.01] .CAPS extensions.
52 %% [KB] ordering: find .jpeg just after .jpg,
53 %% more like dvipdfmx.def. Also remove .sga/.sgi,
54 %% which were mismatched and never noticed.
55 %% Change version number to match dvipdfmx.def.
57 %% 2014/04/07 [AK] [v0.99] remove spurious spaces.
59 %% 2014/03/24 [AK] [v0.98] non-origin viewport, avoid double bp conversion.
61 %% 2014/03/21 [KB] doc tweaks for project home at puszcza.gnu.org.ua.
63 %% 2013/05/27 [KB] Version v0.97 non-commutative operations.
64 %% (code provided by Bruno Voisin)
66 %% 2013/04/29 [KB] Version v0.96 handle non-origin ll corner.
67 %% (code provided by Bruno Voisin)
69 %% 2013/02/04 [RRM] Version v0.95 added clipping support.
70 %% (code provided by Joseph Wright and Martin Scharrer)
72 %% 2009/11/21 [KB] Version v0.94 merge the two 0.93's.
74 %% 2009/10/28 [RRM
] Version v0.93 fix big
-point incompatibility
;
76 %% 2007/10/25 [JK
] Version v0.93 added EPS support from dvipdfmx.def
77 %% (for use with xdvipdfmx
, default driver in xetex
0.997)
79 %% 2006/08/10 [JK
] Version v0.92 correct type
-check in \G@measure@QTm
;
80 %% remove \G@PDF@ext
, apply \lowercase instead
;
81 %% make \XeTeXquote have catcode
12 rather than
11;
82 %% explicit space after
"filename.ext" (reqd by xetex
0.995)
84 %% 2006/07/19 [JK
] Version v0.91 use \special
{color ...
} rather than
85 %% \special
{x
:textcolor ...
} etc
, for compatibility with
86 %% both xdv2pdf and xdvipdfmx drivers
;
87 %% added .bmp to list of recognized graphics extensions
89 %% 2006/01/09 [JK
] Version v0.9 removed support for XeTeX versions
90 %% prior to
0.6 (when the \XeTeXpicfile parameters were
91 %% modified
), to avoid problem when \XeTeXrevision inc. letters
93 %% 2005/10/12 Version v0.8 removed spurious space in \convertHEX@
94 %% -- found by Morten Hogholm
96 %% 2004/05/09 Version v0.7 changed support for \pagecolor
, adapted
97 %% from pdftex.def
, to put a \special in the \shipout
;
98 %% this driver should now work with miniltx.tex
;
99 %% changed some control
-sequence names
;
100 %% implemented HSB to RGB color conversion
101 %% identified the
redundant (v0.5
) coding more clearly.
103 %% 2004/05/08 Version v0.6 properly implements scaling and rotations
104 %% following the coding used with pdftex.def
;
105 %% implemented `viewport
' and prepared for `clip';
106 %% don
't rely on " to have correct catcode;
107 %% altered the suffix order for graphics, to be:
108 %% .pdf .png .jpg .pict .tif ....
110 %% 2004/04/29 Version v0.5 adapts to the changed names for the
111 %% graphics inclusion primitives, and version strings.
113 %% 2004/04/23 Version v0.41 works with graphics.sty as well as
114 %% graphicx.sty ; \G@pdf@ext is '.pdf
';
115 %% similarly define and use \G@PDF@ext for '.PDF
';
116 %% removed some log-messages.
118 %% 2004/04/22 Version v0.4 designed to work with XeTeX v0.4
120 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
122 \ProvidesFile{xetex.def}
123 [2016/07/02 v4.09 LaTeX color/graphics driver for XeTeX (L3/RRM/JK)]
124 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
126 % make sure we can use " with correct catcode
131 % miniltx.tex does not define \PackageWarning
132 % or \PackageWarningNoLine.
133 \@ifundefined{PackageWarning}{%
134 \def\PackageWarning#1#2{%
138 ^^J(#1)\@spaces\@spaces\@spaces\@spaces
140 \immediate\write16{^^JPackage #1 Warning: #2\on@line.^^J}%
144 \@ifundefined{PackageWarningNoLine}{%
145 \def\PackageWarningNoLine#1#2{%
146 \PackageWarning{#1}{#2\@gobble}%
149 \@ifundefined{on@line}{%
150 \def\on@line{ on input line \the\inputlineno}%
152 \@ifundefined{@spaces}{%
153 \def\@spaces{\space\space\space\space}%
155 \def\GXT@warn{\PackageWarning{xetex.def}}%
156 \ifx\Gin@log\@undefined
157 \def\Gin@log{\message}
160 % Colour Support. The following models may be used.
163 % * gray /-- all passed directly to the driver
165 % * RGB ---- converted to rgb here
170 \ifdim\dimen@<\z@\dimen@\maxdimen\fi
172 \PackageError{color}{Argument `#1' not in range
[0,1]}\@ehd
174 \def\color@gray#
1#
2{%
178 \def\color@cmyk#
1#
2{\c@lor@@cmyk#
2\@@#
1}
179 \def\c@lor@@cmyk#
1,#
2,#
3,#
4\@@#
5{%
184 \edef#
5{cmyk #
1 #
2 #
3 #
4}%
186 \def\color@rgb#
1#
2{\c@lor@@rgb#
2\@@#
1}
187 \def\c@lor@@rgb#
1,#
2,#
3\@@#
4{%
191 \edef#
4{rgb #
1 #
2 #
3}%
193 \def\color@RGB#
1#
2{\c@lor@@RGB#
2\@@#
1}
194 \def\c@lor@@RGB#
1,#
2,#
3\@@#
4{%
195 \c@lor@RGB@rgb
{#
1}\@tempa
196 \c@lor@RGB@rgb
{#
2}\@tempb
197 \c@lor@RGB@rgb
{#
3}\@tempc
198 \c@lor@@rgb\@tempa
,\@tempb
,\@tempc\@@#
4%
200 \def\c@lor@RGB@rgb#
1#
2{%
203 \edef#
2{\strip@pt\dimen@
}}
204 \def\color@hsb#
1#
2{\c@lor@@hsb#
2\@@#
1}
205 \def\c@lor@@hsb#
1,#
2,#
3\@@#
4{%
209 \edef#
4{hsb #
1 #
2 #
3}%
211 \def\color@named#
1#
2{\c@lor@@named#
2,,\@@#
1}
212 \def\c@lor@@named#
1,#
2,#
3\@@#
4{%
213 \@ifundefined
{col@#
1}%
214 {\PackageError
{color
}{Undefined color `#
1'}\@ehd}%
218 \def\current@color{ Black}% Match dvips to reduce test diffs
221 % v0.02t: support for \pagecolor
222 % not used by default but may be re-activated
223 % with \oldxetexpagecolorcode
224 % see http://tug.org/pipermail/xetex/2016-June/026696.html
226 \def\oldxetexpagecolorcode{%
227 \def\set@page@color{%
228 \global\let\current@page@color\current@color
229 \@ifundefined{GXTorg@shipout}{%
230 \global\let\GXTorg@shipout\shipout
232 \afterassignment\GXT@shipout
233 \global\setbox\@cclv=%
237 \aftergroup\GXT@@shipout
240 \GXTorg@shipout\vbox{%
247 \GXTorg@shipout\box\@cclv\relax
249 \gdef\GXT@setpagecolor{%
250 \special{background \current@page@color}%
255 \def\set@page@color{\special{background \current@color}}
257 \def\set@color@stack{%
258 \special{color push \current@color}%
259 \aftergroup\reset@color
261 \def\set@color@nostack{%
262 \special{color \current@color}%
263 \aftergroup\reset@color
265 \def\reset@color@nostack{%
266 \special{color \current@color}%
267 \expandafter\checkfor@moreresets
269 \def\reset@color@stack{%
271 \expandafter\checkfor@moreresets
273 \def\checkfor@moreresets{\futurelet\tmp\checkfor@moreresets@}
274 \def\checkfor@moreresets@{%
275 \ifx\tmp\reset@color\expandafter\gobble@color\fi}
276 \def\gobble@color#1{\checkfor@moreresets}
278 \def\define@color@named#1#2{%
279 \expandafter\edef\csname col@#1\endcsname{#2}}
281 \def\check@for@XeTeX@colorstack{%
282 \expandafter\ifx\csname use@XeTeX@colorstack\endcsname\relax
283 \let\set@color\set@color@stack
284 \let\reset@color\reset@color@stack
285 \let\checkfor@moreresets\relax
287 \let\set@color\set@color@nostack
288 \let\reset@color\reset@color@nostack
292 % use \noXeTeXcolorstack to turn off the color-stack
293 % mechanism; use it within the preamble only.
294 % This may be useful with some packages
295 % e.g. TeXpower which makes partial page-builds.
297 \def\noXeTeXcolorstack{\def\use@XeTeX@colorstack{}}
298 \AtBeginDocument{\check@for@XeTeX@colorstack}
300 % < end of color support for XeTeX >
302 % < graphics inclusion for XeTeX >
304 % PDF is a special case which has extra features
309 \def\GPT@warn{\PackageWarning{xetex.def}}%
311 % \Gin@XeTeX@page: page number of pdf image or \@empty otherwise.
312 % This code adapted from pdftex.def
313 \let\Gin@XeTeX@page\@empty
314 \let\GPT@pagebox\@empty
316 \toks@{\define@key{Gin}{page}{\def\Gin@XeTeX@page{#1}}
317 \define@key{Gin}{pagebox}{%
318 \expandafter\let\expandafter\GPT@pagebox%
319 \csname GPT@pagebox@#1\endcsname
320 \ifx\GPT@pagebox\relax
321 \let\GPT@pagebox\@empty
323 Unknown value `#1' for `pagebox
'.\MessageBreak
324 Supported values:\MessageBreak
325 mediabox, cropbox, bleedbox, trimbox, artbox%
330 \@ifundefined{define@key}{%
331 \edef\x{\endgroup\noexpand\AtBeginDocument{%
332 \noexpand\@ifundefined{define@key}{}{\the\toks@}}%
334 }{\expandafter\endgroup\the\toks@}
336 \def\GPT@pagebox@cropbox{crop}%
337 \def\GPT@pagebox@mediabox{media}%
338 \def\GPT@pagebox@artbox{art}%
339 \def\GPT@pagebox@trimbox{trim}%
340 \def\GPT@pagebox@bleedbox{bleed}%
342 % rotating graphics is supported, but
343 % rotation of arbitrary material is not supported yet
345 \def\GXT@erotate#1#2{\Grot@setangle{#1}\hbox{#2}}%
346 \def\set@GXT@erotate{\let\Gin@erotate\GXT@erotate}
347 %\AtBeginDocument{\set@GXT@erotate}
349 \expandafter\ifx\csname XeTeXpicfile\endcsname\relax
350 \let\picfile@cmd\picfile
351 \let\pdffile@cmd\pdffile
353 \let\picfile@cmd\XeTeXpicfile
354 \let\pdffile@cmd\XeTeXpdffile
357 % all graphics are handled by Apple's QuickTime
359 \def\XeTeX@include@QTm#
1{%
363 \noexpand\lowercase
{%
364 \noexpand\def
\noexpand
\type@ext
{\Gin@ext
}%
367 \ifx
\type@ext\G@pdf@ext
368 \ifx\GPT@pagebox\@empty\else
369 \edef\picpagebox
{ \GPT@pagebox
}\fi
370 \ifx\Gin@XeTeX@page\@empty\else
371 \edef\picpage
{ page\Gin@XeTeX@page
}\fi
372 \def\picfilecommand
{\pdffile@cmd
}%
374 \def\picfilecommand
{\picfile@cmd
}%
376 \edef\picfileargs
{ \XeTeXquote#
1\XeTeXquote\space\picpage\picpagebox
}%
380 \ifx\Gscale@start
\relax
381 \setbox\z@
=\hbox
{\expandafter\picfilecommand\picfileargs
}%
382 \edef
\next
{\box\z@\egroup
383 \def
\noexpand\width
{\the\wd\z@
}\relax
384 \def
\noexpand\height
{\the\ht\z@
}\bgroup
}%
387 \XeTeX@scaleinclude
{#
1}%
390 \def\XeTeX@scaleinclude#
1{%
392 \ifx\Gin@scaley\@tempa
393 \let\Gin@scaley\Gin@scalex
395 \ifx\Gin@scalex\@tempa\let\Gin@scalex\Gin@scaley
\fi
398 \Gscale@box
{\Gin@scalex
}[\Gin@scaley
]{%
399 \@ifundefined
{Gin@vllx
}{%
401 % without viewport
/trim clipping does not make sense
406 \if
!\Gin@vllx\Gin@vlly\Gin@vurx\Gin@vury
!%
408 \let\GXT@clipend\GXT@DoClipEnd
409 \setbox\@tempboxa\hbox
\bgroup
413 \ifdim\Gin@vlly\p@
=\z@
415 \lower\Gin@vlly bp\hbox
\bgroup
417 \ifdim\Gin@vllx\p@
=\z@
419 \hskip
-\Gin@vllx bp
\relax
423 \expandafter\picfilecommand\picfileargs
426 \ifdim\Gin@vlly\p@
=\z@
435 \newif\ifGXT@viewport
437 \let\GXT@clipend
\relax
441 % \Gin@urx and \Gin@ury already contain the correct values
,
442 % so both cases viewport and trim can be handled together
:
444 \advance\dimen@
-\Gin@vllx\p@
445 \wd\@tempboxa\strip@pt\dimen@ bp
\relax
446 % \wd\@tempboxa\dimen@
\relax
448 \advance\dimen@
-\Gin@vlly\p@
449 \ht\@tempboxa\strip@pt\dimen@ bp
\relax
450 % \ht\@tempboxa\dimen@
\relax
451 % Clip box to its official size
452 \GXT@clipbox\@tempboxa
455 % Clipping support added by Martin Scharrer and Joseph Wright
, Nov
2011
456 % under the LPPL v1.0 or later.
459 \Gin@defaultbp\WIDTH
{\wd#
1}%
460 \Gin@defaultbp\DEPTH
{\dp#
1}%
462 \advance\@tempdima\dp#
1%
463 \Gin@defaultbp\TOTALHEIGHT
{\@tempdima
}%
464 \special
{pdf
:content q
}%
467 0 -\DEPTH\space \WIDTH\space \TOTALHEIGHT\space re
469 \special
{pdf
:literal direct W
}%
470 \special
{pdf
:literal direct n
}%
471 \special
{pdf
:literal direct
-1 0 0 -1 0 0 cm
}%
472 \special
{pdf
:content q
}%
473 \special
{pdf
:literal direct
-1 0 0 -1 0 0 cm
}%
475 \special
{pdf
:literal direct Q
}%
476 \special
{pdf
:literal direct Q
}%
479 % End of clipping code
482 \def\Gread@QTm#
1{\IfFileExists
{\Gin@base.bb
}%
483 {\Gread@eps
{\Gin@base.bb
}}%
484 {\G@measure@QTm
{\Gin@base
}{\Gin@ext
}}%
486 \def\G@measure@QTm#
1#
2{%
487 % \@warning
{measuring size of QuickTime graphic #
1#
2}%
490 \noexpand\lowercase
{%
491 \noexpand\def
\noexpand
\type@ext
{#
2}%
494 \ifx
\type@ext\G@pdf@ext
495 \ifx\Gin@XeTeX@page\@empty \def\picpage
{}%
496 \else \edef\picpage
{ page\Gin@XeTeX@page
}\fi
497 \ifx\GPT@pagebox\@empty \def\picpagebox
{}%
498 \else \edef\picpagebox
{ \GPT@pagebox
}\fi
501 \ifx
\type@ext\G@pdf@ext
502 \edef\piccommand
{\noexpand\pdffile@cmd
503 \XeTeXquote#
1#
2\XeTeXquote\space\picpage\picpagebox
}%
505 \edef\piccommand
{\noexpand\picfile@cmd
506 \XeTeXquote#
1#
2\XeTeXquote\space
}%
509 }\dimen0
=\wd0 \dimen2
=\ht0
511 \edef
\noexpand\Gin@urx
{\the\dimen0
}%
512 \edef
\noexpand\Gin@ury
{\the\dimen2
}%
515 \Gin@defaultbp\Gin@llx
{0}%
516 \Gin@defaultbp\Gin@lly
{0}%
517 \expandafter\Gin@defaultbp\expandafter\Gin@urx\expandafter
{\Gin@urx
}%
518 \expandafter\Gin@defaultbp\expandafter\Gin@ury\expandafter
{\Gin@ury
}%
519 % \typeout
{XeTeX
: HiRes BoundingBox
= (0,0)\space
x (\Gin@urx
,\Gin@ury
) }%
520 \Gin@nat@width
=\Gin@urx\p@
521 \Gin@nat@height
=\Gin@ury\p@
522 % these emulate \@begin@tempboxa
523 \edef\width
{\the\Gin@nat@width
}%
524 \edef\height
{\the\Gin@nat@height
}%
526 \let
\totalheight\@ovri
530 \let\Ginclude@QTm\XeTeX@include@QTm
532 % For a new graphics type
, you can include a line here ...
533 \@namedef
{Gin@rule@.pdf
}#
1{{QTm
}{QTm
}{#
1}}
534 \@namedef
{Gin@rule@.PDF
}#
1{{QTm
}{QTm
}{#
1}}
536 \@namedef
{Gin@rule@.eps
}#
1{{eps
}{.eps
}{#
1}}
537 \@namedef
{Gin@rule@.EPS
}#
1{{eps
}{.EPS
}{#
1}}
539 \@namedef
{Gin@rule@.mps
}#
1{{mps
}{.mps
}{#
1}}
540 \@namedef
{Gin@rule@.MPS
}#
1{{mps
}{.MPS
}{#
1}}
542 \@namedef
{Gin@rule@.ps
}#
1{{eps
}{.ps
}{#
1}}
543 \@namedef
{Gin@rule@.PS
}#
1{{eps
}{.PS
}{#
1}}
545 \@namedef
{Gin@rule@.png
}#
1{{QTm
}{QTm
}{#
1}}
546 \@namedef
{Gin@rule@.PNG
}#
1{{QTm
}{QTm
}{#
1}}
548 \@namedef
{Gin@rule@.jpg
}#
1{{QTm
}{QTm
}{#
1}}
549 \@namedef
{Gin@rule@.JPG
}#
1{{QTm
}{QTm
}{#
1}}
550 \@namedef
{Gin@rule@.jpeg
}#
1{{QTm
}{QTm
}{#
1}}
551 \@namedef
{Gin@rule@.JPEG
}#
1{{QTm
}{QTm
}{#
1}}
553 \@namedef
{Gin@rule@.jp2
}#
1{{QTm
}{QTm
}{#
1}}
554 \@namedef
{Gin@rule@.JP2
}#
1{{QTm
}{QTm
}{#
1}}
556 \@namedef
{Gin@rule@.jpf
}#
1{{QTm
}{QTm
}{#
1}}
557 \@namedef
{Gin@rule@.JPF
}#
1{{QTm
}{QTm
}{#
1}}
559 \@namedef
{Gin@rule@.bmp
}#
1{{QTm
}{QTm
}{#
1}}
560 \@namedef
{Gin@rule@.BMP
}#
1{{QTm
}{QTm
}{#
1}}
562 \@namedef
{Gin@rule@.pict
}#
1{{QTm
}{QTm
}{#
1}}
563 \@namedef
{Gin@rule@.PICT
}#
1{{QTm
}{QTm
}{#
1}}
565 \@namedef
{Gin@rule@.psd
}#
1{{QTm
}{QTm
}{#
1}}
566 \@namedef
{Gin@rule@.PSD
}#
1{{QTm
}{QTm
}{#
1}}
568 \@namedef
{Gin@rule@.mac
}#
1{{QTm
}{QTm
}{#
1}}
569 \@namedef
{Gin@rule@.MAC
}#
1{{QTm
}{QTm
}{#
1}}
570 \@namedef
{Gin@rule@.tga
}#
1{{QTm
}{QTm
}{#
1}}
571 \@namedef
{Gin@rule@.TGA
}#
1{{QTm
}{QTm
}{#
1}}
573 \@namedef
{Gin@rule@.gif
}#
1{{QTm
}{QTm
}{#
1}}
574 \@namedef
{Gin@rule@.GIF
}#
1{{QTm
}{QTm
}{#
1}}
576 \@namedef
{Gin@rule@.tif
}#
1{{QTm
}{QTm
}{#
1}}
577 \@namedef
{Gin@rule@.TIF
}#
1{{QTm
}{QTm
}{#
1}}
578 \@namedef
{Gin@rule@.tiff
}#
1{{QTm
}{QTm
}{#
1}}
579 \@namedef
{Gin@rule@.TIFF
}#
1{{QTm
}{QTm
}{#
1}}
581 % movies not supported yet
:
582 %\@namedef
{Gin@rule@.qt
}#
1{{QTm
}{QTm
}{#
1}}
583 %\@namedef
{Gin@rule@.mpg
}#
1{{QTm
}{QTm
}{#
1}}
584 %\@namedef
{Gin@rule@.mov
}#
1{{QTm
}{QTm
}{#
1}}
585 %\@namedef
{Gin@rule@.moov
}#
1{{QTm
}{QTm
}{#
1}}
588 % ... though this default rule will try QuickTime anyway ...
589 \@namedef
{Gin@rule@
*}#
1{{QTm
}{QTm
}{#
1}}
591 % ... and add its extension here
592 \def\Gin@extensions
{% order here is like dvipdfmx.def
, except for PS
593 .pdf
,.PDF
,.eps
,.EPS
,.mps
,.MPS
,.ps
,.PS
,%
594 .png
,.PNG
,.jpg
,.JPG
,.jpeg
,.JPEG
,.jp2
,.JP2
,.jpf
,.JPF
,.bmp
,.BMP
,%
595 .pict
,.PICT
,.psd
,.PSD
,.mac
,.MAC
,.TGA
,.tga
,%
596 .gif
,.GIF
,.tif
,.TIF
,.tiff
,.TIFF
,%
599 % xdvipdfmx is now the default driver
, and can support EPS images
,
600 % so we borrow code for this from dvipdfmx.
def (and add the extensions above
)
602 \def\Ginclude@eps#
1{%
605 \ifx\Undefined\Gin@vllx\else\@trim@vporttrue
\fi
608 \advance\dimen@
-\Gin@llx\p@
610 \advance\dimen@ \Gin@vllx\p@
612 \edef\Gin@urx
{\strip@pt\dimen@
}%
614 \advance\dimen@
-\Gin@lly\p@
616 \advance\dimen@ \Gin@vlly\p@
618 \edef\Gin@ury
{\strip@pt\dimen@
}%
619 \dimen@\Gin@req@width
621 \divide\dimen@\dimen@ii
622 \@tempdima\Gin@req@height
623 \divide\@tempdima\dimen@ii
624 \special
{PSfile
="#1"\space
631 \ifx\Gin@scalex\@tempa\else rwi
=\number\dimen@\space
\fi
632 \ifx\Gin@scaley\@tempa\else rhi
=\number\@tempdima\space
\fi
633 \ifGin@clip clip
\fi
}%
636 % In the above \Ginclude@eps
, llx
, lly
, urx
, and ury are translated to match
637 % the
-dEPSCrop option for Ghostscript to convert eps to pdf.
638 % In the case of eps files created by MetaPost
, the files are included
639 % directly without the help of Ghostscript. That is
, we have to translate
640 % the origin accordingly if we use \Ginclude@eps for eps files created by
641 % MetaPost. In TeX Live
2015, the translation of the origin was the default.
642 % After TeX Live
2016, however
, the translation of the origin is enabled only
643 % if the
--mvorigin option is given for dvipdfmx or xdvipdfmx.
644 % This may be a bit inconvenient
, especially in the case of XeTeX where
645 % xdvipdfmx is usually called as a pipe. Therefore we introduce a new suffix
646 % .
mps(or .MPS
) to support inclusion of eps files created by MetaPost without
647 % the option
--mvorigin.
649 \def\Ginclude@mps#
1{%
653 \dimen@\Gin@req@width
655 \divide\dimen@\dimen@ii
656 \@tempdima\Gin@req@height
657 \divide\@tempdima\dimen@ii
658 \special
{PSfile
="#1"\space
663 \ifx\Gin@scalex\@tempa\else rwi
=\number\dimen@\space
\fi
664 \ifx\Gin@scaley\@tempa\else rhi
=\number\@tempdima\space
\fi
665 \ifGin@clip clip
\fi
}%
669 % supported from xetex v0.6 onwards
672 \def\Grot@start
{\wd\z@\z@
673 \special
{x
:gsave
}\special
{x
:rotate \Grot@angle
}}
674 \def\Grot@end
{\special
{x
:grestore
}}
677 \special
{x
:gsave
}\special
{x
:scale \Gscale@x\space\Gscale@y
}}
678 \let\Gscale@end\Grot@end
682 % (no
)setpagesize option
684 \@ifundefined
{ifGin@setpagesize
}
685 {\expandafter\let\csname ifGin@setpagesize\expandafter\endcsname
686 \csname iftrue\endcsname
}
689 \ifx\paperwidth\@undefined\else
691 % If a package has changed \mag
, assume it knows what it is doing
692 % and leave page size alone
694 \@ifundefined
{stockwidth
}{%
695 \@ifundefined
{paperwidth
}{%
697 \ifdim\paperwidth
>0pt
\relax
698 \ifdim\paperheight
>0pt
\relax
699 \pdfpagewidth
=\paperwidth
700 \pdfpageheight
=\paperheight
705 \ifdim\stockwidth
>0pt
\relax
706 \ifdim\stockheight
>0pt
\relax
707 \pdfpagewidth
=\stockwidth
708 \pdfpageheight
=\stockheight
719 %% End of file `xetex.def
'.