diff options
Diffstat (limited to 'Master/bin/powerpc-darwin/ps2eps')
-rwxr-xr-x | Master/bin/powerpc-darwin/ps2eps | 49 |
1 files changed, 32 insertions, 17 deletions
diff --git a/Master/bin/powerpc-darwin/ps2eps b/Master/bin/powerpc-darwin/ps2eps index 920e7398dd3..aeb0e9a8e43 100755 --- a/Master/bin/powerpc-darwin/ps2eps +++ b/Master/bin/powerpc-darwin/ps2eps @@ -1,12 +1,11 @@ -eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' && eval 'exec perl -S $0 $argv:q' # -*-perl-*- - if 0; +#!/usr/bin/env perl # The expression in the previous line replaces the unix specific line # {#!/usr/bin/perl}. # ps2eps - convert PostScript to EPS (Encapsulated PostScript) files # ------------------------------------------------------------------- -# $Id: ps2eps,v 1.54 2004/04/23 07:56:54 bless Exp $ +# $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 @@ -23,7 +22,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 @@ -44,18 +43,21 @@ use Getopt::Long; Getopt::Long::Configure("no_ignore_case"); $prgname= "ps2eps"; -if ($^O =~ /MSWin32/i or $^O =~ /cygwin/i) -{ + +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 2>&1"; } -$bboxver=`bbox >/dev/null 2>&1 -V`; +$bboxver=`bbox >$NULLDEV -V`; $bboxname= ($?== -1) ? "" : "bbox"; -$version= '$Id: ps2eps,v 1.54 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 @@ -142,7 +144,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", @@ -174,6 +176,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", @@ -210,6 +213,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, @@ -227,6 +231,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, @@ -260,6 +265,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 '') { @@ -523,10 +533,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 { @@ -554,7 +564,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"; } @@ -565,7 +577,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"; @@ -601,9 +613,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; |