From 30dd9f517c9c093ff3319061647a4555264f7914 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Wed, 28 Dec 2005 00:07:27 +0000 Subject: trunk git-svn-id: svn://tug.org/texlive/trunk@9 c570f23f-e606-0410-a88d-b1316a301751 --- Master/xemtex/gslib/ps2epsi | 78 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 Master/xemtex/gslib/ps2epsi (limited to 'Master/xemtex/gslib/ps2epsi') diff --git a/Master/xemtex/gslib/ps2epsi b/Master/xemtex/gslib/ps2epsi new file mode 100644 index 00000000000..8e349d205a1 --- /dev/null +++ b/Master/xemtex/gslib/ps2epsi @@ -0,0 +1,78 @@ +#!/bin/sh +# $Id: ps2epsi,v 1.7.2.1 2002/04/22 20:18:24 giles Exp $ + +tmpfile=/tmp/ps2epsi$$ + +export outfile + +if [ $# -lt 1 -o $# -gt 2 ]; then + echo "Usage: `basename $0` file.ps [file.epsi]" 1>&2 + exit 1 +fi + +infile=$1; + +if [ $# -eq 1 ] +then + case "${infile}" in + *.ps) base=`basename "${infile}" .ps` ;; + *.cps) base=`basename "${infile}" .cps` ;; + *.eps) base=`basename "${infile}" .eps` ;; + *.epsf) base=`basename "${infile}" .epsf` ;; + *) base=`basename "${infile}"` ;; + esac + outfile=${base}.epsi +else + outfile=$2 +fi + +ls -l "${infile}" | +awk 'F==1 { + cd="%%CreationDate: " $6 " " $7 " " $8; + t="%%Title: " $9; + f="%%For:" U " " $3; + c="%%Creator: Ghostscript ps2epsi from " $9; + next; + } + /^%!/ {next;} + /^%%Title:/ {t=$0; next;} + /^%%Creator:/ {c=$0; next;} + /^%%CreationDate:/ {cd=$0; next;} + /^%%For:/ {f=$0; next;} + !/^%/ { + print "/ps2edict 30 dict def"; + print "ps2edict begin"; + print "/epsititle (" t "\\n) def"; + print "/epsicreator (" c "\\n) def"; + print "/epsicrdt (" cd "\\n) def"; + print "/epsifor (" f "\\n) def"; + print "end"; + exit(0); + } + ' U="$USERNAME$LOGNAME" F=1 - F=2 "${infile}" >$tmpfile + +gs -q -dNOPAUSE -dSAFER -dDELAYSAFER -r72 -sDEVICE=bit -sOutputFile=/dev/null $tmpfile ps2epsi.ps $tmpfile <"${infile}" 1>&2 +rm -f $tmpfile + +( +cat << BEGINEPS +save countdictstack mark newpath /showpage {} def /setpagedevice {pop} def +%%EndProlog +%%Page: 1 1 +%%BeginDocument: ${infile} +BEGINEPS + +cat "${infile}" | +sed -e '/^%%BeginPreview:/,/^%%EndPreview[^!-~]*$/d' -e '/^%!PS-Adobe/d'\ + -e '/^%%[A-Za-z][A-Za-z]*[^!-~]*$/d' -e '/^%%[A-Za-z][A-Za-z]*: /d' + +cat << ENDEPS +%%EndDocument +%%Trailer +cleartomark countdictstack exch sub { end } repeat restore +%%EOF +ENDEPS + +) >> "${outfile}" + +exit 0 -- cgit v1.2.3