summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
Diffstat (limited to 'Master')
-rw-r--r--Master/texmf-dist/doc/support/pdfcrop/README10
-rwxr-xr-xMaster/texmf-dist/scripts/pdfcrop/pdfcrop.pl59
2 files changed, 51 insertions, 18 deletions
diff --git a/Master/texmf-dist/doc/support/pdfcrop/README b/Master/texmf-dist/doc/support/pdfcrop/README
index b3250ad96b0..0ce9b3f6ccb 100644
--- a/Master/texmf-dist/doc/support/pdfcrop/README
+++ b/Master/texmf-dist/doc/support/pdfcrop/README
@@ -1,4 +1,4 @@
-README for pdfcrop 2010/09/15 v1.30
+README for pdfcrop 2010/09/17 v1.31
TABLE OF CONTENTS
=================
@@ -230,10 +230,14 @@ L. HISTORY
is not found via PATH.
* Windows only: support of spaces in command
names in unrestricted mode.
-2010/09/06 v1.29: * Find the latest Ghostscript version in registry.
+2010/09/06 v1.29: * Find the latest Ghostscript version in registry.
2010/09/15 v1.30: * Warning of pdfTeX because of \pdfobjcompresslevel
avoided when reducing \pdfminorversion.
- * Fix for TeX syntax characters in input file names.
+ * Fix for TeX syntax characters in input file names.
+2010/09/17 v1.31: * Passing the input file name via hex string to TeX.
+ * Again input file names restricted for Ghostscript
+ command line, switch then to symbol link/copy
+ method.
M. TODO
=======
diff --git a/Master/texmf-dist/scripts/pdfcrop/pdfcrop.pl b/Master/texmf-dist/scripts/pdfcrop/pdfcrop.pl
index 1fdd3ab3d8f..5e43ec024fd 100755
--- a/Master/texmf-dist/scripts/pdfcrop/pdfcrop.pl
+++ b/Master/texmf-dist/scripts/pdfcrop/pdfcrop.pl
@@ -21,8 +21,8 @@ $^W=1; # turn warning on
#
my $file = "pdfcrop.pl";
my $program = uc($&) if $file =~ /^\w+/;
-my $version = "1.30";
-my $date = "2010/09/15";
+my $version = "1.31";
+my $date = "2010/09/17";
my $author = "Heiko Oberdiek";
my $copyright = "Copyright (c) 2002-2010 by $author.";
#
@@ -91,6 +91,10 @@ my $copyright = "Copyright (c) 2002-2010 by $author.";
# 2010/09/15 v1.30: * Warning of pdfTeX because of \pdfobjcompresslevel
# avoided when reducing \pdfminorversion.
# * Fix for TeX syntax characters in input file names.
+# 2010/09/17 v1.31: * Passing the input file name via hex string to TeX.
+# * Again input file names restricted for Ghostscript
+# command line, switch then to symbol link/copy
+# method.
### program identification
my $title = "$program $version, $date - $copyright\n";
@@ -602,9 +606,9 @@ $SIG{'__DIE__'} = \&clean;
### Calculation of BoundingBoxes
# use safe file name for use within cmd line of gs (unknown shell: space, ...)
-# and pdfTeX (hash, curly braces, ...)
+# and XeTeX (hash, curly braces, ...)
my $inputfilesafe = $inputfile;
-if ($inputfile =~ /[\s\$~'"#{}]/) {
+if (not $inputfile =~ /^[\w\d\.\-\:\/@]+$/) { # /[\s\$~'"#{}%]/
$inputfilesafe = "$tmp-img.pdf";
push @unlink_files, $inputfilesafe;
my $symlink_exists = eval { symlink("", ""); 1 };
@@ -657,18 +661,51 @@ print TMP <<'END_TMP';
\catcode60 12 % less
\catcode61 12 % equals
\catcode62 12 % greater
+\catcode64 12 % at
\catcode91 12 % left square
\catcode93 12 % right square
\catcode96 12 % back tick
\catcode123 1 % left curly brace
\catcode125 2 % right curly brace
+\catcode126 12 % tilde
\catcode`\#=6 %
\escapechar=92 %
+\def\IfUndefined#1#2#3{%
+ \begingroup\expandafter\expandafter\expandafter\endgroup
+ \expandafter\ifx\csname#1\endcsname\relax
+ #2%
+ \else
+ #3%
+ \fi
+}
END_TMP
-print TMP "\\def\\pdffile{$inputfilesafe}\n";
+my $pdffilehex = unpack 'H*', $inputfilesafe;
+$pdffilehex = "\U$pdffilehex\E";
+print TMP "\\def\\pdffilehex{$pdffilehex}\n";
print TMP <<'END_TMP';
-\def\stripprefix#1>{}
-\edef\pdffile{\expandafter\stripprefix\meaning\pdffile}%
+\IfUndefined{pdfunescapehex}{%
+ \begingroup
+ \gdef\pdffile{}%
+ \def\do#1#2{%
+ \ifx\relax#2\relax
+ \ifx\relax#1\relax
+ \else
+ \errmessage{Invalid hex string, should not happen!}%
+ \fi
+ \else
+ \lccode`0="#1#2\relax
+ \lowercase{%
+ \xdef\pdffile{\pdffile0}%
+ }%
+ \expandafter\do
+ \fi
+ }%
+ \expandafter\do\pdffilehex\relax\relax
+ \endgroup
+}{%
+ \edef\pdffile{\pdfunescapehex{\pdffilehex}}%
+}
+\immediate\write-1{Input file: \pdffile}
END_TMP
if ($::opt_tex eq 'luatex') {
print TMP <<'END_TMP';
@@ -729,14 +766,6 @@ if ($::opt_tex eq 'pdftex' or $::opt_tex eq 'luatex') {
\pdfoutput=1 %
\pdfcompresslevel=9 %
\csname pdfmapfile\endcsname{}
-\def\IfUndefined#1#2#3{%
- \begingroup\expandafter\expandafter\expandafter\endgroup
- \expandafter\ifx\csname#1\endcsname\relax
- #2%
- \else
- #3%
- \fi
-}
\def\setpdfversion#1{%
\IfUndefined{pdfobjcompresslevel}{%
}{%