summaryrefslogtreecommitdiff
path: root/Master/texmf-dist
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2010-09-13 23:54:32 +0000
committerKarl Berry <karl@freefriends.org>2010-09-13 23:54:32 +0000
commit49a5cc95b952b0ecddf61898e4305819795e35ec (patch)
tree25d180f6e164e5d87c0b760a500ecadaa8c9b3ec /Master/texmf-dist
parenta81b00b60192cde6eceb35cca61ea7f3e08898a5 (diff)
pdftex-def update (13sep10)
git-svn-id: svn://tug.org/texlive/trunk@19718 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r--Master/texmf-dist/tex/latex/pdftex-def/pdftex.def637
1 files changed, 567 insertions, 70 deletions
diff --git a/Master/texmf-dist/tex/latex/pdftex-def/pdftex.def b/Master/texmf-dist/tex/latex/pdftex-def/pdftex.def
index 0b288b87eec..fcb6f0f2b39 100644
--- a/Master/texmf-dist/tex/latex/pdftex-def/pdftex.def
+++ b/Master/texmf-dist/tex/latex/pdftex-def/pdftex.def
@@ -1,4 +1,4 @@
-\ProvidesFile{pdftex.def}[2010/02/14 v0.04n Graphics/color for pdfTeX]
+\ProvidesFile{pdftex.def}[2010/09/09 v0.05a Graphics/color for pdfTeX]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
%% LaTeX Colour and Graphics support for PDFTeX
@@ -6,7 +6,7 @@
%% License
%% =======
%%
-%% Copyright (C) 2000-2009 David Carlisle, Sebastian Rahtz, Hans Hagen,
+%% Copyright (C) 2000-2010 David Carlisle, Sebastian Rahtz, Hans Hagen,
%% Heiko Oberdiek and Martin Schr\"oder
%%
%% This work may be distributed and/or modified under the
@@ -191,6 +191,48 @@
% * \GPT@catcodes extended for xmlTeX (pdftex.def loads
% supp-pdf.mkii at begin document where xmlTeX's catcodes
% are already active).
+% 2010/03/11 v0.04o (HO)
+% * Ensure that \undefined is undefined during loading of
+% ConTeXt files.
+% 2010/03/12 v0.04p (HO)
+% * \undefined is also undefined during conversion of MPS.
+% 2010/04/14 v0.04q (HO)
+% * Optimizations for rotating and scaling:
+% * remove unnecessary identity transformations
+% * numbers are normalized
+% 2010/04/15 v0.04r (HO)
+% * Fix for scale values without integer part.
+% 2010/09/09 v0.05a (HO)
+% * Option `pagebox' added for specifying the pdf page box
+% of the included image. Values are `mediabox', `cropbox',
+% `bleedbox', `trimbox' and `artbox'. Default is `cropbox'. (MS/HO)
+% * Option `interpolate' added for bitmaps, see PDF specification.
+% Values are `true' or `false', default is `false'.
+% * Option `decodearray' added for bitmaps, see PDF specification,
+% key /Decode of image dictionaries. The value for option
+% `decodearray' is the value for /Decode without `[' and ']'.
+% * Option `maskarray' added for bitmaps, see PDF specification,
+% key /Mask of image dictionaries with array as value.
+% The value of `maskarray' is the array value for /Mask
+% without `[' and ']'.
+% * Option `intent' added for the rendering intent of bitmap
+% images, see PDF specification, key /Intent of image
+% dictionaries. The value is a name without a leading slash,
+% the standard names of the PDF specification:
+% `AbsoluteColorimetric', `RelativeColorimetric',
+% `Saturation', `Perceptual'.
+% * Options `ocobjnum' and `ocobjref' are hooks for those who wants
+% to work with optional content. The options can be used for both
+% bitmap and PDF images and are unsupported for MPS.
+% The optional content dictionary is given by an external
+% object. Option `ocobjnum' expects the number of that object
+% (e.g. \pdflastobj). It's a positive integer (greater than zero).
+% Option `ocobjref' takes the full object reference
+% (positive integer, followed by ` 0 R' in case of pdfTeX).
+% Other drivers might support `ocobjref' as well, in case of
+% PostScript/pdfmark drivers, the object is usually referenced by
+% a name in curly braces.
+% * Tiff support removed for driver versions between 1.10a and 1.30.
%
% Prefix of internal commands for this file `pdftex.def':
% \GPT@ (Graphics bundle PdfTex driver)
@@ -205,6 +247,10 @@
\catcode64 11 % @
\def\GPT@catcodes#1{%
\expandafter\edef\csname GPT@restore@#1\endcsname{%
+ \let\noexpand\undefined
+ \expandafter\noexpand\csname GPTorg@#1@undefined\endcsname
+ \let\expandafter\noexpand\csname GPTorg@#1@undefined\endcsname
+ \noexpand\@undefined
\endlinechar \the\endlinechar
\catcode9 \the\catcode9 % tab
\catcode13 \the\catcode13 % ^^M
@@ -280,9 +326,16 @@
\catcode124 12 % |
\catcode125 2 % }
\catcode126 13 % ~
+ \expandafter\let\csname GPTorg@#1@undefined\endcsname\undefined
+ \let\undefined\@undefined
}
\GPT@catcodes{}
+% 1.10a: .tif support was dropped
+% 1.10a: keywords mediabox|cropbox|... for \pdfximage
+% 1.30.0: keyword `page' for \pdfliteral added.
+% 1.40.0: JBIG2 support added in pdfTeX 1.40.0
+
\ifx\pdftexversion\@undefined
\def\driver@release{1}%
\else
@@ -306,14 +359,11 @@
\def\driver@release{7}%
\else
\ifnum\pdftexversion<130 %
- % 1.30.0 adds keyword `page' for \pdfliteral
\def\driver@release{8}%
\else
\ifnum\pdftexversion<140 %
- % .tif support was dropped in pdfTeX 1.10a
\def\driver@release{9}%
\else
- % JBIG2 support added in pdfTeX 1.40.0
\def\driver@release{10}%
\fi
\fi
@@ -544,9 +594,9 @@ E \else
\GPTorg@shipout\box\GPT@outputbox\relax
\fi
}%
- \gdef\GPT@pageliteral{%
+ \pdfliteral\ifnum\driver@release>8 page\else direct\fi{%
\ifGPT@pagecolor
- \pdfliteral\ifnum\driver@release>8 page\else direct\fi{%
+ \GPT@pagecolor@literal{%
q % gsave
\current@page@color\space
n % newpath
@@ -637,6 +687,13 @@ E \else
% \GPT@print: file name for alternate image or \@empty otherwise.
\let\GPT@print\@empty
\let\GPT@xmpfile\@empty
+\let\GPT@pagebox\@empty
+\let\GPT@pagebox@\@empty
+\let\GPT@interpolate\@empty
+\let\GPT@decodearray\@empty
+\let\GPT@mask\@empty
+\let\GPT@intent\@empty
+\let\GPT@ocobjnum\@empty
\newif\ifGPT@ResetColor
\let\GPT@ResetColorEnd\relax
\def\GPT@ResetColorBegin{%
@@ -649,6 +706,32 @@ E \else
\fi
\fi
}
+\begingroup\expandafter\expandafter\expandafter\endgroup
+\expandafter\ifx\csname pdfmatch\endcsname\relax
+ \def\GPT@match#1#2#3#4{}%
+ \def\GPT@pat@real/{}%
+\else
+ \def\GPT@match#1#2{%
+ \ifnum\pdfmatch{#2}{#1}=1 %
+ \expandafter\@firstoftwo
+ \else
+ \expandafter\@secondoftwo
+ \fi
+ }%
+ \def\GPT@pat@real/{%
+ (%
+ 0(\GPT@backslash.[0-9]*)?|%
+ \GPT@backslash.[0-9]+|%
+ 1(\GPT@backslash.0*)?%
+ )%
+ }%
+\fi
+\begingroup
+ \escapechar=-1 %
+ \edef\x{\endgroup
+ \edef\noexpand\GPT@backslash{\string\\}%
+ }%
+\x
\begingroup
\toks@{%
\define@key{Gin}{resetcolor}[true]{%
@@ -684,6 +767,163 @@ E \else
}%
}%
\fi
+ \ifnum\driver@release>7 %
+ % option pagebox
+ \define@key{Gin}{pagebox}{%
+ \expandafter\let\expandafter\GPT@pagebox
+ \csname GPT@pagebox@#1\endcsname
+ \ifx\GPT@pagebox\relax
+ \let\GPT@pagebox\@empty
+ \GPT@warn{%
+ Unknown value `#1' for `pagebox'.\MessageBreak
+ Supported values:\MessageBreak
+ mediabox, cropbox, bleedbox, trimbox, artbox%
+ }%
+ \fi
+ }%
+ \def\GPT@pagebox@mediabox{mediabox}%
+ \let\GPT@pagebox@cropbox\@empty
+ \def\GPT@pagebox@bleedbox{bleedbox}%
+ \def\GPT@pagebox@trimbox{trimbox}%
+ \def\GPT@pagebox@artbox{artbox}%
+ % option interpolate
+ \define@key{Gin}{interpolate}[true]{%
+ \expandafter\let\expandafter\GPT@interpolate
+ \csname GPT@interpolate@#1\endcsname
+ \ifx\GPT@interpolate\relax
+ \let\GPT@interpolate\@empty
+ \GPT@warn{%
+ Unknown value `#1' for `interpolate'.\MessageBreak
+ Supported values: true, false%
+ }%
+ \fi
+ }%
+ \let\GPT@interpolate@false\@empty
+ \def\GPT@interpolate@true{1}% non-empty, value does not matter
+ % option decodearray
+ \define@key{Gin}{decodearray}{%
+ \def\GPT@decodearray{#1}%
+ \ifx\GPT@decodearray\@empty
+ \else
+ \GPT@match\GPT@decodearray{%
+ ((^| )\GPT@pat@real/ \GPT@pat@real/)+$%
+ }{}{%
+ \GPT@warn{%
+ Invalid value (\GPT@decodearray)\MessageBreak
+ for `decodearray' is ignored%
+ }%
+ \let\GPT@decodearray\@empty
+ }%
+ \fi
+ }%
+ % option maskarray
+ \define@key{Gin}{maskarray}{%
+ \def\GPT@mask{#1}%
+ \ifx\GPT@mask\@empty
+ \else
+ \GPT@match\GPT@mask{%
+ ((^| )[0-9]+ [0-9]+)+$%
+ }{}{%
+ \GPT@warn{%
+ Invalid value (\GPT@mask)\MessageBreak
+ for `maskarray' is ignored%
+ }%
+ \let\GPT@mask\@empty
+ }%
+ \ifx\GPT@mask\@empty
+ \else
+ \edef\GPT@mask{[\GPT@mask]}%
+ \fi
+ \fi
+ }%
+ % option intent
+ \define@key{Gin}{intent}{%
+ \def\GPT@intent{#1}%
+ \ifx\GPT@intent\@empty
+ \else
+ \GPT@match\GPT@intent{%
+ ^((Absolute|Relative)Colorimetric|Saturation|Perceptual)$%
+ }{}{%
+ \GPT@match\GPT@intent{%
+ ^[A-Za-z0-9_]+$%
+ }{%
+ \GPT@warn{%
+ Rendering intent `\GPT@intent'\MessageBreak
+ is not a standard name of the PDF specification%
+ }%
+ }{%
+ \GPT@warn{%
+ Ignoring intent `\GPT@intent'\MessageBreak
+ with unusual characters%
+ }%
+ \let\GPT@intent\@empty
+ }%
+ }%
+ \fi
+ }%
+ % option ocobjnum
+ \define@key{Gin}{ocobjnum}{%
+ \edef\GPT@ocobjnum{#1}%
+ \ifx\GPT@ocobjnum\@empty
+ \else
+ \edef\GPT@ocobjnum{\number\GPT@ocobjnum}%
+ \GPT@match\GPT@ocobjnum{^[1-9]+[0-9]*$}{%
+ }{%
+ \GPT@warn{%
+ Invalid value (\GPT@ocobjnum)\MessageBreak
+ for `ocobjnum' is ignored%
+ }%
+ \let\GPT@ocobjnum\@empty
+ }%
+ \ifx\GPT@ocobjnum\@empty
+ \else
+ \edef\GPT@ocobjnum{\number\GPT@ocobjnum}%
+ \fi
+ \fi
+ }%
+ % option ocobjref
+ \define@key{Gin}{ocobjref}{%
+ \edef\GPT@ocobjnum{#1}%
+ \ifx\GPT@ocobjnum\@empty
+ \else
+ \edef\GPT@ocobjnum{%
+ \expandafter\strip@prefix\meaning\GPT@ocobjnum
+ }%
+ \GPT@match\GPT@ocobjnum{^[1-9]+[0-9]* 0 R$}{%
+ }{%
+ \GPT@warn{%
+ Invalid value (\GPT@ocobjnum)\MessageBreak
+ for `ocobjref' is ignored%
+ }%
+ \let\GPT@ocobjnum\@empty
+ }%
+ \ifx\GPT@ocobjnum\@empty
+ \else
+ \begingroup
+ \def\GPT@temp##1 ##2\@nil{\endgroup
+ \def\GPT@ocobjnum{##1}%
+ }%
+ \expandafter\GPT@temp\GPT@ocobjnum\@nil
+ \edef\GPT@ocobjnum{\number\GPT@ocobjnum}%
+ \fi
+ \fi
+ }%
+ \else
+ \def\GPT@temp#1{%
+ \define@key{Gin}{#1}{%
+ \GPT@warn{%
+ pdfTeX >= 1.10a required for option `#1'%
+ }%
+ }%
+ }%
+ \GPT@temp{pagebox}%
+ \GPT@temp{interpolate}%
+ \GPT@temp{decodearray}%
+ \GPT@temp{maskarray}%
+ \GPT@temp{intent}%
+ \GPT@temp{ocobjnum}%
+ \GPT@temp{ocobjref}%
+ \fi
\define@key{Gin}{quiet}[]{%
\let\Gin@log\@gobble
}%
@@ -801,13 +1041,119 @@ E \else
\GPT@print
\fi
}
+\def\GPT@objref{ 0 R}
\def\Gread@pdftex{%
\GPT@read\Gread@@pdftex
}
\def\Gread@@pdftex#1{%
% Ensure that option `print' works only on bitmap images.
+ \let\GPT@Attr\@empty
+ \let\GPT@AttrShort\@empty
+ \ifnum\driver@release>7 %
+ \ifx\GPT@ocobjnum\@empty
+ \else
+ \edef\GPT@AttrShort{\GPT@AttrShort
+ :OC\GPT@ocobjnum
+ }%
+ \edef\GPT@Attr{\GPT@Attr
+ /OC \GPT@ocobjnum\GPT@objref
+ }%
+ \fi
+ \fi
\ifGPT@IsBitmap
+ \let\GPT@page\@empty
+ \let\GPT@pagebox\@empty
+ \ifnum\driver@release>7 %
+ \ifx\GPT@xmpfile\@empty
+ \else
+ \@ifundefined{GPT@XMP@\GPT@xmpfile}{%
+ \GPT@IfFileExists{\GPT@xmpfile}{%
+ \begingroup
+ \pdfcompresslevel=0 %
+ \immediate\pdfobj stream attr{%
+ /Type/Metadata%
+ /Subtype/XML%
+ }file{\GPT@xmpfile}%
+ \expandafter\xdef\csname GPT@XMP@\GPT@xmpfile\endcsname{%
+ \the\pdflastobj
+ }%
+ \endgroup
+ }{%
+ \GPT@warn{Missing XMP file (\GPT@xmpfile)}%
+ }%
+ }{}%
+ \@ifundefined{GPT@XMP@\GPT@xmpfile}{}{%
+ \edef\GPT@Attr{\GPT@Attr
+ /Metadata \@nameuse{GPT@XMP@\GPT@xmpfile}\GPT@objref
+ }%
+ \edef\GPT@AttrShort{\GPT@AttrShort
+ :MD\@nameuse{GPT@XMP@\GPT@xmpfile}%
+ }%
+ }%
+ \fi
+ \ifx\GPT@interpolate\@empty
+ \else
+ \edef\GPT@Attr{\GPT@Attr
+ /Interpolate true%
+ }%
+ \edef\GPT@AttrShort{\GPT@AttrShort
+ :I%
+ }%
+ \fi
+ \ifx\GPT@decodearray\@empty
+ \else
+ \edef\GPT@Attr{\GPT@Attr
+ /Decode[\GPT@decodearray]%
+ }%
+ \edef\GPT@AttrShort{\GPT@AttrShort
+ :D[\GPT@decodearray]%
+ }%
+ \fi
+ \ifx\GPT@mask\@empty
+ \else
+ \edef\GPT@Attr{\GPT@Attr
+ /Mask\GPT@mask
+ }%
+ \edef\GPT@AttrShort{\GPT@AttrShort
+ :M\GPT@mask
+ }%
+ \fi
+ \ifx\GPT@intent\@empty
+ \else
+ \edef\GPT@AttrShort{\GPT@AttrShort
+ :RI\GPT@intent
+ }%
+ \expandafter\ifx\csname pdfescapename\endcsname\relax
+ \expandafter\ifx\csname pdf@escapename\endcsname\relax
+ \else
+ \edef\GPT@intent{\pdf@escapename{\GPT@intent}}%
+ \fi
+ \else
+ \edef\GPT@intent{\pdfescapename{\GPT@intent}}%
+ \fi
+ \edef\GPT@Attr{\GPT@Attr
+ /Intent/\GPT@intent
+ }%
+ \fi
+ \fi
\else
+ \let\GPT@interpolate\@empty
+ \let\GPT@decodearray\@empty
+ \let\GPT@mask\@empty
+ \let\GPT@intent\@empty
+ \ifx\GPT@page\@empty
+ \else
+ \edef\GPT@AttrShort{\GPT@AttrShort
+ :P\GPT@page
+ }%
+ \fi
+ \ifx\GPT@pagebox\@empty
+ \else
+ \edef\GPT@AttrShort{%
+ \GPT@AttrShort
+ :\expandafter\@car\GPT@pagebox{}\@nil b%
+ }%
+ \fi
\ifx\GPT@print\@empty
\else
\GPT@warn{%
@@ -831,35 +1177,14 @@ E \else
\fi
% If option `print' is set, the screen image object
% will contain an additional /Alternate entry
- % and will therefore not be reused.
+ % and will not be reused.
\ifx\GPT@print\@empty
\else
\expandafter\expandafter\expandafter\@firstoftwo\expandafter\@gobbletwo
\fi
- \@ifundefined{#1 image\GPT@page}{%
+ \@ifundefined{#1 image\GPT@AttrShort}{%
\ifnum\driver@release>4 %
\ifnum\driver@release>5 %
- \let\GPT@Attr\@empty
- \ifx\GPT@xmpfile\@empty
- \else
- \@ifundefined{GPT@XMP@\GPT@xmpfile}{%
- \GPT@IfFileExists{\GPT@xmpfile}{%
- \begingroup
- \pdfcompresslevel=0 %
- \immediate\pdfobj stream attr{%
- /Type/Metadata%
- /Subtype/XML%
- }file{\GPT@xmpfile}%
- \expandafter\xdef\csname GPT@XMP@\GPT@xmpfile\endcsname{%
- \the\pdflastobj
- }%
- \endgroup
- }{%
- \GPT@warn{Missing XMP file (\GPT@xmpfile)}%
- }%
- }{}%
- \edef\GPT@Attr{/Metadata \@nameuse{GPT@XMP@\GPT@xmpfile} 0 R}%
- \fi
\ifx\GPT@print\@empty
\ifx\GPT@Attr\@empty
\let\GPT@RuleAttr\@empty
@@ -867,15 +1192,17 @@ E \else
\edef\GPT@RuleAttr{attr{\GPT@Attr}}%
\fi
\else
- \@ifundefined{\GPT@print\space image\GPT@page}{%
+ \@ifundefined{\GPT@print\space image\GPT@AttrShort}{%
\immediate\pdfximage{\GPT@print}%
\setbox\@tempboxa=\hbox{\pdfrefximage\pdflastximage}%
\edef\GPT@PrintObj{\the\pdflastximage}%
\expandafter\xdef\csname\GPT@print\space
- image\GPT@page\endcsname{\pdfrefximage\GPT@PrintObj}%
+ image\GPT@AttrShort\endcsname{%
+ \pdfrefximage\GPT@PrintObj\relax
+ }%
\immediate\pdfobj{%
[<<%
- /Image \GPT@PrintObj\space 0 R%
+ /Image \GPT@PrintObj\GPT@objref
/DefaultForPrinting true%
>>]%
}%
@@ -883,26 +1210,26 @@ E \else
width\wd\@tempboxa height\ht\@tempboxa
attr{%
\GPT@Attr
- /Alternates \the\pdflastobj\space 0 R%
+ /Alternates \the\pdflastobj\GPT@objref
}%
}%
}{%
\edef\GPT@PrintObj{%
\expandafter\expandafter\expandafter\@gobble
- \csname\GPT@print\space image\GPT@page\endcsname
+ \csname\GPT@print\space image\GPT@AttrShort\endcsname
}%
\immediate\pdfobj{%
[<<%
- /Image \GPT@PrintObj \space 0 R%
+ /Image \GPT@PrintObj\GPT@objref
/DefaultForPrinting true%
>>]%
}%
\def\GPT@RuleAttr{%
- width \csname\GPT@print\space width\GPT@page\endcsname
- height \csname\GPT@print\space height\GPT@page\endcsname
+ width \csname\GPT@print\space width\GPT@AttrShort\endcsname
+ height \csname\GPT@print\space height\GPT@AttrShort\endcsname
attr{%
\GPT@Attr
- /Alternates \the\pdflastobj\space 0 R%
+ /Alternates \the\pdflastobj\GPT@objref
}%
}%
}%
@@ -912,6 +1239,7 @@ E \else
\else
page \GPT@page
\fi
+ \GPT@pagebox
{#1}%
\setbox\@tempboxa=\hbox{\pdfrefximage\pdflastximage}%
\else
@@ -925,14 +1253,14 @@ E \else
\def\Gin@llx{0}\let\Gin@lly\Gin@llx
\Gin@defaultbp\Gin@urx{\wd\@tempboxa}%
\Gin@defaultbp\Gin@ury{\ht\@tempboxa}%
- \expandafter\xdef\csname\GPT@ReusedName{#1} width\GPT@page\endcsname{%
+ \expandafter\xdef\csname\GPT@ReusedName{#1} width\GPT@AttrShort\endcsname{%
\the\wd\@tempboxa
}%
- \expandafter\xdef\csname\GPT@ReusedName{#1} height\GPT@page\endcsname{%
+ \expandafter\xdef\csname\GPT@ReusedName{#1} height\GPT@AttrShort\endcsname{%
\the\ht\@tempboxa
}%
\ifnum\driver@release>5 %
- \expandafter\xdef\csname #1 image\GPT@page
+ \expandafter\xdef\csname #1 image\GPT@AttrShort
\ifx\GPT@print\@empty\else!\fi\endcsname{%
\pdfrefximage\the\pdflastximage
}%
@@ -948,6 +1276,8 @@ E \else
\ifnum\driver@release>5 %
\the\pdflastximage
\ifx\GPT@page\@empty\else , page=\GPT@page\fi
+ \ifx\GPT@pagebox\@empty\else, pagebox=\GPT@pagebox\fi
+ \ifx\GPT@interpolate\@empty\else, interpolate=true\fi
\ifx\GPT@print\@empty
\else
, print=\GPT@print, id=\GPT@PrintObj
@@ -960,8 +1290,8 @@ E \else
}%
}{%
\def\Gin@llx{0}\let\Gin@lly\Gin@llx
- \Gin@defaultbp\Gin@urx{\csname#1 width\GPT@page\endcsname}%
- \Gin@defaultbp\Gin@ury{\csname#1 height\GPT@page\endcsname}%
+ \Gin@defaultbp\Gin@urx{\csname#1 width\GPT@AttrShort\endcsname}%
+ \Gin@defaultbp\Gin@ury{\csname#1 height\GPT@AttrShort\endcsname}%
}%
}
\def\Ginclude@pdftex#1{%
@@ -1006,7 +1336,7 @@ E \else
\hskip-\Gin@vllx bp\relax
\fi
\fi
- \csname#1 image\GPT@page
+ \csname#1 image\GPT@AttrShort
\ifx\GPT@print\@empty\else!\fi
\endcsname
\ifGPT@viewport
@@ -1036,7 +1366,14 @@ E \else
% v0.03k \Gin@vlly replaced by \Gin@lly
\advance\dimen@ -\Gin@lly\p@
\ht\@tempboxa\strip@pt\dimen@ bp\relax
- \pdfxform\@tempboxa
+ \let\GPT@temp\@empty
+ \ifnum\driver@release>7 %
+ \ifx\GPT@ocobjnum\@empty
+ \else
+ \edef\GPT@temp{attr{/OC \GPT@ocobjnum\GPT@objref}}%
+ \fi
+ \fi
+ \expandafter\pdfxform\GPT@temp\@tempboxa
\pdfrefxform\pdflastxform
}
\newif\ifGPT@IsBitmap
@@ -1143,7 +1480,9 @@ E \else
\hskip-\Gin@vllx bp\relax
\fi
\fi
+ \GPT@catcodes{mps}%
\convertMPtoPDF{#1}{1}{1}%
+ \GPT@restore@mps
\ifGPT@viewport
\ifdim\Gin@vlly\p@=\z@
\else
@@ -1166,7 +1505,7 @@ E \else
\let\Gread@png\Gread@pdfbitmap
\let\Gread@jpg\Gread@pdfbitmap
\ifnum\driver@release>5 %
- \ifnum\driver@release<9 %
+ \ifnum\driver@release<8 %
\let\Gread@tif\Gread@pdfbitmap
\let\Ginclude@tif\Ginclude@pdftex
\else
@@ -1185,8 +1524,10 @@ E \else
\ifx\Gin@scalex\@tempa\let\Gin@scalex\Gin@scaley\fi
\fi
\hbox{%
+ \GPT@catcodes{pdf}%
\convertPDFtoPDF{#1}{\Gin@scalex}{\Gin@scaley} {0bp} {0bp}%
{\Gin@req@width}{\Gin@req@height}%
+ \GPT@restore@pdf
}%
}%
\fi
@@ -1200,7 +1541,7 @@ E \else
\@namedef{Gin@rule@.JPG}#1{{jpg}{.JPG}{#1}}%
\@namedef{Gin@rule@.JPEG}#1{{jpg}{.JPEG}{#1}}%
\ifnum\driver@release>5 %
- \ifnum\driver@release<9 %
+ \ifnum\driver@release<8 %
\def\Gin@extensions{%
.png,.pdf,.jpg,.mps,.tif,.jpeg,%
.PNG,.PDF,.JPG,.JPEG%
@@ -1233,17 +1574,130 @@ E \else
% slightly hacky, but set width of box 0 to 0pt otherwise
% the CTM gets restored in the wrong place.
+\def\GPT@MatrixIdentity{1 0 0 1}
+\def\GPT@Zero{0}
+\def\GPT@Minus{-}
+\def\GPT@NormalizeNumber#1{%
+ \edef#1{#1}%
+ \edef#1{\GPT@ZapSpace#1}%
+ \edef#1{\expandafter\GPT@ZapPlus#1+\@nil}%
+ \edef#1{\expandafter\GPT@ZapMinusMinus#1--\@nil}%
+ \expandafter\GPT@Split#1..\@nil
+ \ifx\GPT@frac\@empty
+ \else
+ \edef\GPT@frac{%
+ \expandafter\GPT@Reverse\expandafter{\expandafter}\GPT@frac\@nil
+ }%
+ \edef\GPT@frac{%
+ \expandafter\GPT@ZapLeadingZeros\GPT@frac\@empty
+ }%
+ \ifx\GPT@frac\@empty
+ \else
+ \edef\GPT@frac{%
+ \expandafter\GPT@Reverse\expandafter{\expandafter}\GPT@frac\@nil
+ }%
+ \fi
+ \fi
+ \edef\GPT@sign{\expandafter\@car\GPT@int\@empty\@nil}%
+ \ifx\GPT@sign\GPT@Minus
+ \edef\GPT@int{\expandafter\@cdr\GPT@int\@nil}%
+ \else
+ \def\GPT@sign{}%
+ \fi
+ \edef\GPT@int{%
+ \expandafter\GPT@ZapLeadingZeros\GPT@int\@empty
+ }%
+ \edef\GPT@temp{\GPT@int\GPT@frac}%
+ \ifx\GPT@temp\@empty
+ \def#1{0}%
+ \else
+ \edef#1{%
+ \GPT@sign
+ \GPT@int
+ \ifx\GPT@frac\@empty
+ \else
+ .\GPT@frac
+ \fi
+ }%
+ \fi
+}
+\def\GPT@ZapSpace#1{%
+ \expandafter\zap@space#1 \@empty
+}
+\def\GPT@ZapPlus#1+#2\@nil{%
+ #1%
+ \ifx\@empty#2\@empty
+ \expandafter\@gobble
+ \else
+ \expandafter\@firstofone
+ \fi
+ {%
+ \GPT@ZapPlus#2\@nil
+ }%
+}
+\def\GPT@ZapMinusMinus#1--#2\@nil{%
+ #1%
+ \ifx\@empty#2\@empty
+ \expandafter\@gobble
+ \else
+ \expandafter\@firstofone
+ \fi
+ {%
+ \GPT@ZapMinusMinus#2\@nil
+ }%
+}
+\def\GPT@Split#1.#2.#3\@nil{%
+ \def\GPT@int{#1}%
+ \ifx\@empty#2\@empty
+ \let\GPT@frac\@empty
+ \else
+ \def\GPT@frac{#2}%
+ \fi
+}
+\def\GPT@Reverse#1#2#3\@nil{%
+ \ifx\@empty#3\@empty
+ #2#1%
+ \expandafter\@gobble
+ \else
+ \expandafter\@firstofone
+ \fi
+ {%
+ \GPT@Reverse{#2#1}#3\@nil
+ }%
+}
+\def\GPT@ZapLeadingZeros#1{%
+ \ifx0#1%
+ \expandafter\GPT@ZapLeadingZeros
+ \else
+ #1%
+ \fi
+}
\begingroup\expandafter\expandafter\expandafter\endgroup
\expandafter\ifx\csname pdfsetmatrix\endcsname\relax
% Patrick Daly found an error here with doubled minus signs when
% \Grot@sin is negative. Fixed.
\def\Grot@start{%
- \pdfliteral{ %
- q %
+ \GPT@NormalizeNumber\Grot@sin
+ \GPT@NormalizeNumber\Grot@cos
+ \edef\GPT@temp{%
\Grot@cos\space\Grot@sin\space
- \if-\Grot@sin\else-\Grot@sin\fi\space\Grot@cos\space
- 0 0 cm%
+ \if-\GPT@sin
+ \else
+ % avoid negative zero
+ \ifx\Grot@sin\GPT@Zero
+ \GPT@Zero
+ \else
+ -\Grot@sin
+ \fi
+ \fi
+ \space\Grot@cos
}%
+ \ifx\GPT@temp\GPT@MatrixIdentity
+ \def\Grot@end{}%
+ \else
+ \pdfliteral{ q \GPT@temp\space 0 0 cm}%
+ \wd\z@\z@
+ \fi
\wd\z@\z@
}%
\def\Grot@end{%
@@ -1251,43 +1705,86 @@ E \else
}%
% Scaling is OK, as graphics package does it right here.
\def\Gscale@start{%
- \pdfliteral{ q %
- \Gscale@x\space0 0 \Gscale@y\space 0 0 cm%
+ \GPT@NormalizeNumber\Gscale@x
+ \GPT@NormalizeNumber\Gscale@y
+ \edef\GPT@temp{%
+ \Gscale@x\space0 0 \Gscale@y
}%
+ \ifx\GPT@temp\GPT@MatrixIdentity
+ \def\Gscale@end{}%
+ \else
+ \pdfliteral{ q \GPT@temp\space 0 0 cm}%
+ \fi
}%
\else
\def\Grot@start{%
- \pdfsave
- \pdfsetmatrix{%
+ \GPT@NormalizeNumber\Grot@sin
+ \GPT@NormalizeNumber\Grot@cos
+ \edef\GPT@temp{%
\Grot@cos\space\Grot@sin\space
- \if-\Grot@sin\else-\Grot@sin\fi\space\Grot@cos
+ \if-\Grot@sin
+ \else
+ \ifx\Grot@sin\GPT@Zero
+ \GPT@Zero
+ \else
+ -\Grot@sin
+ \fi
+ \fi
+ \space\Grot@cos
}%
- \wd\z@\z@
+ \ifx\GPT@temp\GPT@MatrixIdentity
+ \def\Grot@end{}%
+ \else
+ \pdfsave
+ \pdfsetmatrix{\GPT@temp}%
+ \wd\z@\z@
+ \fi
}%
\def\Grot@end{\pdfrestore}%
\def\Gscale@start{%
- \pdfsave
- \pdfsetmatrix{%
+ \GPT@NormalizeNumber\Gscale@x
+ \GPT@NormalizeNumber\Gscale@y
+ \edef\GPT@temp{%
\Gscale@x\space0 0 \Gscale@y
}%
+ \ifx\GPT@temp\GPT@MatrixIdentity
+ \def\Gscale@end{}%
+ \else
+ \pdfsave
+ \pdfsetmatrix{\GPT@temp}%
+ \fi
}%
\fi
\let\Gscale@end\Grot@end
-% undo the trig.sty `optimisation' so that these 0 1 and -1 values
+% undo the trig.sty `optimization' so that these 0 1 and -1 values
% get written out as digits, not unexpandable TeX primitives.
+% 0.04q: space added to remain consistent with trig.sty.
\AtBeginDocument{%
- \expandafter\def\csname sin(0)\endcsname{0}%
- \expandafter\def\csname cos(0)\endcsname{1}%
- \expandafter\def\csname sin(90)\endcsname{1}%
- \expandafter\def\csname cos(90)\endcsname{0}%
- \expandafter\def\csname sin(-90)\endcsname{-1}%
- \expandafter\def\csname cos(-90)\endcsname{0}%
- \expandafter\def\csname sin(180)\endcsname{0}%
- \expandafter\def\csname cos(180)\endcsname{-1}%
+ \def\GPT@temp#1(#2)=#3 {%
+ \expandafter\def\csname #1(#2)\endcsname{#3 }%
+ }%
+ \GPT@temp sin(0)=0 %
+ \GPT@temp cos(0)=1 %
+ \GPT@temp sin(90)=1 %
+ \GPT@temp cos(90)=0 %
+ \GPT@temp sin(-90)=-1 %
+ \GPT@temp cos(-90)=0 %
+ \GPT@temp sin(180)=0 %
+ \GPT@temp cos(180)=-1 %
+ % added in 0.04q
+ \GPT@temp sin(270)=-1 %
+ \GPT@temp cos(270)=0 %
+ \GPT@temp sin(360)=0 %
+ \GPT@temp cos(360)=1 %
+ \GPT@temp sin(-180)=0 %
+ \GPT@temp cos(-180)=-1 %
+ \GPT@temp sin(-270)=1 %
+ \GPT@temp cos(-270)=0 %
+ \GPT@temp sin(-360)=0 %
+ \GPT@temp cos(-360)=1 %
}
-
% v0.02e: Restore catcodes of context letters.
% Not needed with current version of supp-pdf
% but protects against older versions.