tl2017 luatex discretionaries
[latex2e.git] / latex2e-20170101 / support / xetex.def
blob0c1f78dd4b92e89bbafc6d3fb212996a6a8782bf
1 %% This is file `xetex.def' for XeTeX,
2 %% based upon other drivers for LaTeX color and graphics support.
3 %%
4 %% Copyright 2004-2007, 2009, 2013-2016
5 %% Ross Moore <ross@maths.mq.edu.au>
6 %% modified by Jonathan Kew et al.
7 %%
8 %% Copyright 2016 LaTeX3 project and above named authors.
9 %%
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
21 %%
22 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
23 %% Version History
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
39 %% not be given.
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
47 %% dvipdfmx.
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.
62 %%
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 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
121 % emacs-page
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
127 {\catcode`\"=12
128 \gdef\XeTeXquote{"}%
131 % miniltx.tex does not define \PackageWarning
132 % or \PackageWarningNoLine.
133 \@ifundefined{PackageWarning}{%
134 \def\PackageWarning#1#2{%
135 \begingroup
136 \newlinechar=10 %
137 \def\MessageBreak{%
138 ^^J(#1)\@spaces\@spaces\@spaces\@spaces
140 \immediate\write16{^^JPackage #1 Warning: #2\on@line.^^J}%
141 \endgroup
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.
161 % * rgb \
162 % * cmyk \
163 % * gray /-- all passed directly to the driver
164 % * hsb /
165 % * RGB ---- converted to rgb here
166 % * named
168 \def\c@lor@arg#1{%
169 \dimen@#1\p@
170 \ifdim\dimen@<\z@\dimen@\maxdimen\fi
171 \ifdim\dimen@>\p@
172 \PackageError{color}{Argument `#1' not in range [0,1]}\@ehd
173 \fi}
174 \def\color@gray#1#2{%
175 \c@lor@arg{#2}%
176 \edef#1{gray #2}%
178 \def\color@cmyk#1#2{\c@lor@@cmyk#2\@@#1}
179 \def\c@lor@@cmyk#1,#2,#3,#4\@@#5{%
180 \c@lor@arg{#4}%
181 \c@lor@arg{#1}%
182 \c@lor@arg{#2}%
183 \c@lor@arg{#3}%
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{%
188 \c@lor@arg{#1}%
189 \c@lor@arg{#2}%
190 \c@lor@arg{#3}%
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{%
201 \dimen@#1\p@
202 \divide\dimen@\@cclv
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{%
206 \c@lor@arg{#1}%
207 \c@lor@arg{#2}%
208 \c@lor@arg{#3}%
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}%
215 {\edef#4{ #1}}%
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
231 \gdef\shipout{%
232 \afterassignment\GXT@shipout
233 \global\setbox\@cclv=%
235 \gdef\GXT@shipout{%
236 \ifvoid\@cclv\relax
237 \aftergroup\GXT@@shipout
238 \GXT@setpagecolor
239 \else
240 \GXTorg@shipout\vbox{%
241 \GXT@setpagecolor
242 \box\@cclv
246 \gdef\GXT@@shipout{%
247 \GXTorg@shipout\box\@cclv\relax
249 \gdef\GXT@setpagecolor{%
250 \special{background \current@page@color}%
252 }{}%
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{%
270 \special{color pop}%
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
286 \else
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
305 \def\G@pdf@ext{.pdf}
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
315 \begingroup
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
322 \GPT@warn{%
323 Unknown value `#1' for `pagebox'.\MessageBreak
324 Supported values:\MessageBreak
325 mediabox, cropbox, bleedbox, trimbox, artbox%
327 \fi%
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
352 \else
353 \let\picfile@cmd\XeTeXpicfile
354 \let\pdffile@cmd\XeTeXpdffile
355 \fi
357 % all graphics are handled by Apple's QuickTime
359 \def\XeTeX@include@QTm#1{%
360 \def\picpage{}%
361 \def\picpagebox{}%
362 \edef\type@ext{%
363 \noexpand\lowercase{%
364 \noexpand\def\noexpand\type@ext{\Gin@ext}%
366 }\type@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}%
373 \else
374 \def\picfilecommand{\picfile@cmd}%
376 \edef\picfileargs{ \XeTeXquote#1\XeTeXquote\space\picpage\picpagebox}%
377 \Gin@log{%
378 <use \picfileargs>%
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}%
385 \expandafter\next
386 \else
387 \XeTeX@scaleinclude{#1}%
390 \def\XeTeX@scaleinclude#1{%
391 \def\@tempa{!}%
392 \ifx\Gin@scaley\@tempa
393 \let\Gin@scaley\Gin@scalex
394 \else
395 \ifx\Gin@scalex\@tempa\let\Gin@scalex\Gin@scaley\fi
397 \hbox{%
398 \Gscale@box{\Gin@scalex}[\Gin@scaley]{%
399 \@ifundefined{Gin@vllx}{%
400 \GXT@viewportfalse
401 % without viewport/trim clipping does not make sense
402 % for XeTeX
403 \Gin@clipfalse
404 }{}%
405 \ifGin@clip
406 \if!\Gin@vllx\Gin@vlly\Gin@vurx\Gin@vury!%
407 \else
408 \let\GXT@clipend\GXT@DoClipEnd
409 \setbox\@tempboxa\hbox\bgroup
412 \ifGXT@viewport
413 \ifdim\Gin@vlly\p@=\z@
414 \else
415 \lower\Gin@vlly bp\hbox\bgroup
417 \ifdim\Gin@vllx\p@=\z@
418 \else
419 \hskip-\Gin@vllx bp\relax
423 \expandafter\picfilecommand\picfileargs
425 \ifGXT@viewport
426 \ifdim\Gin@vlly\p@=\z@
427 \else
428 \egroup
430 \GXT@clipend
435 \newif\ifGXT@viewport
436 \GXT@viewporttrue
437 \let\GXT@clipend\relax
438 \def\GXT@DoClipEnd{%
439 \egroup
440 \dp\@tempboxa\z@
441 % \Gin@urx and \Gin@ury already contain the correct values,
442 % so both cases viewport and trim can be handled together:
443 \dimen@\Gin@urx\p@
444 \advance\dimen@ -\Gin@vllx\p@
445 \wd\@tempboxa\strip@pt\dimen@ bp\relax
446 % \wd\@tempboxa\dimen@ \relax
447 \dimen@\Gin@ury\p@
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
453 \box\@tempboxa
455 % Clipping support added by Martin Scharrer and Joseph Wright, Nov 2011
456 % under the LPPL v1.0 or later.
457 \def\GXT@clipbox#1{%
458 \setbox#1=\hbox{%
459 \Gin@defaultbp\WIDTH{\wd#1}%
460 \Gin@defaultbp\DEPTH{\dp#1}%
461 \@tempdima\ht#1%
462 \advance\@tempdima\dp#1%
463 \Gin@defaultbp\TOTALHEIGHT{\@tempdima}%
464 \special{pdf:content q }%
465 \special{%
466 pdf:literal direct
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 }%
474 \box#1%
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}%
488 \bgroup
489 \edef\type@ext{%
490 \noexpand\lowercase{%
491 \noexpand\def\noexpand\type@ext{#2}%
493 }\type@ext
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
500 \setbox0=\hbox{%
501 \ifx\type@ext\G@pdf@ext
502 \edef\piccommand{\noexpand\pdffile@cmd
503 \XeTeXquote#1#2\XeTeXquote\space\picpage\picpagebox}%
504 \else
505 \edef\piccommand{\noexpand\picfile@cmd
506 \XeTeXquote#1#2\XeTeXquote\space}%
508 \piccommand
509 }\dimen0=\wd0 \dimen2=\ht0
510 \edef\next{\egroup
511 \edef\noexpand\Gin@urx{\the\dimen0}%
512 \edef\noexpand\Gin@ury{\the\dimen2}%
514 \next
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}%
525 \def\depth{0pt}%
526 \let\totalheight\@ovri
527 \totalheight\height
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)
601 \newif\if@trim@vport
602 \def\Ginclude@eps#1{%
603 \message{<#1>}%
604 \bgroup
605 \ifx\Undefined\Gin@vllx\else\@trim@vporttrue\fi
606 \def\@tempa{!}%
607 \dimen@\Gin@urx\p@
608 \advance\dimen@ -\Gin@llx\p@
609 \if@trim@vport
610 \advance\dimen@ \Gin@vllx\p@
612 \edef\Gin@urx{\strip@pt\dimen@}%
613 \dimen@\Gin@ury\p@
614 \advance\dimen@ -\Gin@lly\p@
615 \if@trim@vport
616 \advance\dimen@ \Gin@vlly\p@
618 \edef\Gin@ury{\strip@pt\dimen@}%
619 \dimen@\Gin@req@width
620 \dimen@ii.1bp%
621 \divide\dimen@\dimen@ii
622 \@tempdima\Gin@req@height
623 \divide\@tempdima\dimen@ii
624 \special{PSfile="#1"\space
625 \if@trim@vport
626 llx=\Gin@vllx\space
627 lly=\Gin@vlly\space
629 urx=\Gin@urx\space
630 ury=\Gin@ury\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}%
634 \egroup}
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{%
650 \message{<#1>}%
651 \bgroup
652 \def\@tempa{!}%
653 \dimen@\Gin@req@width
654 \dimen@ii.1bp%
655 \divide\dimen@\dimen@ii
656 \@tempdima\Gin@req@height
657 \divide\@tempdima\dimen@ii
658 \special{PSfile="#1"\space
659 llx=\Gin@llx\space
660 lly=\Gin@lly\space
661 urx=\Gin@urx\space
662 ury=\Gin@ury\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}%
666 \egroup}
668 % Rotation & Scaling
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}}
676 \def\Gscale@start{%
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}
688 \ifGin@setpagesize
689 \ifx\paperwidth\@undefined\else
690 \AtBeginDocument{%
691 % If a package has changed \mag, assume it knows what it is doing
692 % and leave page size alone
693 \ifnum\mag=\@m
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
715 \fi
717 \endinput
719 %% End of file `xetex.def'.