diff options
Diffstat (limited to 'Master/texmf/scripts/ps2eps/ps2eps.pl')
-rw-r--r-- | Master/texmf/scripts/ps2eps/ps2eps.pl | 47 |
1 files changed, 30 insertions, 17 deletions
diff --git a/Master/texmf/scripts/ps2eps/ps2eps.pl b/Master/texmf/scripts/ps2eps/ps2eps.pl index af12673a2db..fd00ba9faca 100644 --- a/Master/texmf/scripts/ps2eps/ps2eps.pl +++ b/Master/texmf/scripts/ps2eps/ps2eps.pl @@ -4,10 +4,9 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' && eval 'exec perl -S $0 $ # {#!/usr/bin/perl}. # ps2eps - convert PostScript to EPS (Encapsulated PostScript) files # ------------------------------------------------------------------- -# $Id: ps2eps,v 1.54 2004/04/23 07:56:54 bless Exp $ -# (with minor Windows-related modifications for TL) +# $Id: ps2eps,v 1.61 2006/12/28 16:34:06 bless Exp $ # ------------------------------------------------------- -# (C)opyright 1999-2004 Roland Bless +# (C)opyright 1999-2006 Roland Bless # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -24,7 +23,7 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' && eval 'exec perl -S $0 $ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # # Author: Roland Bless -# Send bug reports to roland@bless.de +# Send bug reports to roland <at> bless.de # ------------------------------------------------------------------- # Additional filtering is performed when Windows generated PostScript files # are processed. Some instructions will otherwise lead to bad output @@ -45,20 +44,21 @@ use Getopt::Long; Getopt::Long::Configure("no_ignore_case"); $prgname= "ps2eps"; -if (! -d "/usr/bin/") -{ + +if (! -d "/usr/bin") +{ # we assume that we are running under native windows $ghostscriptname = "gswin32c"; $NULLDEV = "nul"; } else -{ +{ # Unix or cygwin $ghostscriptname = "gs"; - $NULLDEV = "/dev/null"; + $NULLDEV = "/dev/null 2>&1"; } -$bboxver=`bbox >$NULLDEV 2>&1 -V`; +$bboxver=`bbox >$NULLDEV -V`; $bboxname= ($?== -1) ? "" : "bbox"; -$version= '$Id: ps2eps,v 1.54+tl 2004/04/23 07:56:54 bless Exp $'; #' +$version= '$Id: ps2eps,v 1.61 2006/12/28 16:34:06 bless Exp $'; #' $insertPScode= 1; # Insert surrounding Postscript code $infhandle = STDIN; # Standard input is the default input file $outfhandle = STDOUT; # Standard output is default output if STDIN is input @@ -145,7 +145,7 @@ $licensetxt= "\ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\n"; @prgidtxt= ( "$prgname - convert PostScript to EPS (Encapsulated PostScript) files\n", - "(C)opyright 1998-2004 Roland Bless\n\n" ); + "(C)opyright 1998-2006 Roland Bless\n\n" ); @helptxt= ("Version: $ver[2]\n", "Operation:\n", @@ -177,6 +177,7 @@ $licensetxt= "\ " use --size=list to list pre-defined page sizes\n", " -R, --rotate=<direction> rotate resulting EPS. <direction>: +=+90 (clockw.),-=-90 (counter-clockw.) ^=180 degrees\n", " -t, --translate specify x,y offset (may be negative) in postscript points (1/72 dpi)\n", + " -r, --resolution specify dpi resolution to render with ghostscript (default 144)", " -l, --loose expand the original bounding box by one point in each direction\n", " -B, --ignoreBB do not use existing bounding box as page size for rendering\n", " -E, --ignoreEOF do not use %%EOF as hint for end of file\n", @@ -213,6 +214,7 @@ if (defined($ENV{"$envname_gsbbox"})) $opt_t = ''; # for t-option $opt_R = ''; # for R-option +$opt_r = ''; # for r-option $stopnow = 0; die "Wrong option(s), please check usage with $prgname --help\n" unless GetOptions('f|force' => \$forceoverwrite, @@ -230,6 +232,7 @@ GetOptions('f|force' => \$forceoverwrite, 'E|ignoreEOF'=> \$ignoreEOFDSC, 's|size=s' => \$opt_s, 't|translate=s' => \$opt_t, + 'r|resolution=s' => \$opt_r, 'R|rotate=s' => \$opt_R, 'g|gsbbox' => sub { $bboxname=""; }, 'H|nohires' => \$nohires, @@ -263,6 +266,11 @@ $filenames[0]= '-' if (scalar(@filenames) == 0); # no file arguments, use STDIN print STDERR "Input files: @filenames\n" if (!$quiet); +if ($opt_r ne '') +{ + $resolution=$opt_r; +} + # papersize stuff if ($opt_s ne '') { @@ -526,10 +534,10 @@ while ($infname= (shift @filenames)) ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ## -- calculate the bounding box -- ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - if ($translate_x>0 || $translate_y>0) + if ($translate_x!=0 || $translate_y!=0) { $translation="$translate_x $translate_y translate"; - $translatecmd="-c \'$translation\'"; + $translatecmd="-c $translation"; } else { @@ -557,7 +565,9 @@ while ($infname= (shift @filenames)) } else { - print STDERR "...using bbox device of $ghostscriptname..."; + if (!$quiet) { + print STDERR "...using bbox device of $ghostscriptname..."; + } $cmdline = "$ghostscriptname -dSAFER -dBATCH -dNOPAUSE -q $gpar -r$resolution -sDEVICE=bbox -sOutputFile=- -c \"/setpagedevice {pop} def\" $translatecmd -f $tmpfname -c quit 2>&1"; } @@ -568,7 +578,7 @@ while ($infname= (shift @filenames)) if ($debuggs) { print STDERR "Call result: $boundingbox"; } # check result of gs call - if ($boundingbox !~ /^%%BoundingBox/) + if ($boundingbox !~ /^%%BoundingBox/m) { print STDERR "Error: Could not determine bounding box!\n", "I suppose $ghostscriptname had some trouble interpreting the postscript-file\n"; @@ -604,9 +614,12 @@ while ($infname= (shift @filenames)) if ($cBBlly > 0) { $cBBlly--; } $cBBurx++; $cBBury++; } - if (!$quiet && ($cBBllx < 0 || $cBBlly < 0 )) + if ($cBBllx < 0 || $cBBlly < 0) { - print STDERR "WARNING! Your drawing had a negative Bounding Box which is deprecated and may cause problems!. I'll shift it.\n"; + if (!$quiet) + { + print STDERR "WARNING! Your drawing had a negative Bounding Box which is deprecated and may cause problems!. I'll shift it.\n"; + } $translate_x= -int($cBBllx); $translate_y= -int($cBBlly); $cBBllx=0; |