summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManuel Pégourié-Gonnard <mpg@elzevir.fr>2008-04-05 17:20:29 +0000
committerManuel Pégourié-Gonnard <mpg@elzevir.fr>2008-04-05 17:20:29 +0000
commitb0fb3dcb16b825b6d466c6f83fdeaf6b3856d575 (patch)
treed83c17dac4cac533e3f31c6efec661cdc68dbb14
parent5dec94e2c76cbba73cb9218fd077a6566b79b27e (diff)
pdftex-def v 0.04i
git-svn-id: svn://tug.org/texlive/trunk@7322 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Master/texmf-dist/tex/latex/pdftex-def/pdftex.def97
1 files changed, 90 insertions, 7 deletions
diff --git a/Master/texmf-dist/tex/latex/pdftex-def/pdftex.def b/Master/texmf-dist/tex/latex/pdftex-def/pdftex.def
index 6b878bb7cd2..6d61ad41449 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}[2007/06/12 v0.04h Graphics/color for pdfTeX]
+\ProvidesFile{pdftex.def}[2007/12/04 v0.04i Graphics/color for pdfTeX]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
%% LaTeX Colour and Graphics support for PDFTeX
@@ -166,6 +166,8 @@
% 2007/06/12 v0.04h (HO)
% * Fix for \pagecolor: v0.04f uses keyword `page' for \pdfliteral,
% but this keyword is not available before pdfTeX 1.30.0.
+% 2007/12/04 v0.04i (HO)
+% * Fatal error is avoided if image file does not exists.
%
% prefix of internal commands for this file `pdftex.def':
% \GPT@ (Graphics bundle PdfTex driver)
@@ -496,8 +498,13 @@ E \else
%
% Note the magic in front of the file name after \pdfimage, to
% prevent it fouling up with file names starting with "depth".
-\def\Gread@png#1{%
- \setbox\@tempboxa\hbox{\pdfimage\noexpand\noexpand\noexpand\@empty#1\relax}%
+\def\Gread@png{%
+ \GPT@read\Gread@@png
+}
+\def\Gread@@png#1{%
+ \setbox\@tempboxa\hbox{%
+ \pdfimage\noexpand\noexpand\noexpand\@empty#1\relax
+ }%
\def\Gin@llx{0}\let\Gin@lly\Gin@llx
\Gin@defaultbp\Gin@urx{\wd\@tempboxa}%
\Gin@defaultbp\Gin@ury{\ht\@tempboxa}%
@@ -609,6 +616,62 @@ E \else
\AtBeginDocument{\GPT@fix}
%
+% Check for image file existence
+%
+\begingroup\expandafter\expandafter\expandafter\endgroup
+\expandafter\ifx\csname pdffilesize\endcsname\relax
+ \ifnum\driver@release>9 %
+ \RequirePackage{pdftexcmds}\relax
+ \fi
+ \begingroup\expandafter\expandafter\expandafter\endgroup
+ \expandafter\ifx\csname pdf@filesize\endcsname\relax
+ \def\GPT@IfFileExists#1{%
+ \IfFileExists{#1}%
+ }%
+ \else
+ \def\GPT@IfFileExists#1{%
+ \expandafter\expandafter\expandafter\ifx
+ \expandafter\expandafter\expandafter\relax\pdf@filesize{#1}\relax
+ \expandafter\@secondoftwo
+ \else
+ \expandafter\@firstoftwo
+ \fi
+ }%
+ \fi
+\else
+ \def\GPT@IfFileExists#1{%
+ \expandafter\ifx\expandafter\relax\pdffilesize{#1}\relax
+ \expandafter\@secondoftwo
+ \else
+ \expandafter\@firstoftwo
+ \fi
+ }%
+\fi
+
+%
+% Wrapper for \Gread@... that checks image existence first.
+%
+\def\GPT@read#1#2{%
+ \GPT@IfFileExists{#2}%
+ {%
+ #1{#2}%
+ }{%
+ \def\Gin@llx{0}%
+ \let\Gin@lly\Gin@llx
+ \def\Gin@urx{72}%
+ \let\Gin@ury\Gin@urx
+ \ifGin@draft
+ \else
+ \GPT@error{File `#2' not found}{%
+ Using draft setting for this image.\MessageBreak
+ \@ehc
+ }%
+ \Gin@drafttrue
+ \fi
+ }%
+}
+
+%
% mechanism for re-use of objects also
% allows us to get the size by deriving it from the initial storage;
% this works for all graphics types.
@@ -623,7 +686,10 @@ E \else
\GPT@print
\fi
}
-\def\Gread@pdftex#1{%
+\def\Gread@pdftex{%
+ \GPT@read\Gread@@pdftex
+}
+\def\Gread@@pdftex#1{%
% Ensure that option `print' works only on bitmap images.
\ifGPT@IsBitmap
\else
@@ -636,6 +702,18 @@ E \else
\let\GPT@print\@empty
\fi
\fi
+ % Check if print image exists.
+ \ifx\GPT@print\@empty
+ \else
+ \GPT@IfFileExists{\GPT@print}{%
+ }{%
+ \GPT@error{Print image `\GPT@print' not found}{%
+ The print version of the image is ignored.\MessageBreak
+ \@ehc
+ }%
+ \let\GPT@print\@empty
+ }%
+ \fi
% If option `print' is set, the screen image object
% will contain an additional /Alternate entry
% and will therefore not be reused.
@@ -823,7 +901,10 @@ E \else
}
\edef\Gread@MBox{/MediaBox}
-\def\Gread@pdf#1{%
+\def\Gread@pdf{%
+ \GPT@read\Gread@@pdf
+}
+\def\Gread@@pdf#1{%
\begingroup
\@tempcnta\z@
\loop
@@ -862,7 +943,7 @@ E \else
\endgroup
\expandafter\Gread@parse@bb\@gtempa\\%
}
-\long\def\Gread@find@mbox#1 [#2]#3\\{%
+\long\def\Gread@find@mbox#1 [#2]#3\\{% hash-ok
\def\@tempa{#1}%
\ifx\@tempa\Gread@MBox
\gdef\@gtempa{#2 }%
@@ -928,7 +1009,9 @@ E \else
\GPT@ResetColorEnd
}%
}
-\def\Gread@mps{\Gread@eps}
+\def\Gread@mps{%
+ \GPT@read\Gread@eps
+}
\ifnum\driver@release>3 %
\let\Ginclude@png\Ginclude@pdftex
\let\Ginclude@jpg\Ginclude@pdftex