shithub: riscv

ref: d67596f1bbdce63cd6a053cc17443fde1631ed10
dir: /sys/src/cmd/postscript/cropmarks/cropmarks.rc/

View raw version
#!/bin/rc
# Center pages and put cropmarks at each corner. Physical page size
# is set with -w and -h. The default is 8.5 by 11.0 inches. Device
# dependent code to change paper size (e.g. with setpageparams) goes
# in the prologue. You may need to customize the device dependent
# code that we distribute. By default it only supports variable page
# sizes on Linotronic typesetters, and assumes those typesetters are
# using 12 inch wide paper. Use -d to disable execution of device
# dependent PostScript code.
#
# What's here was written quickly and will likely be very different
# in our next release. It should be part of a more general program!!
# 

POSTLIB=/sys/lib/postscript/prologues
PROLOGUE=$POSTLIB/cropmarks.ps

EXPANDPAGE=true
PAGEWIDTH=8.5
PAGEHEIGHT=11.0
SCALETOFIT=false
XOFFSET=0.0
YOFFSET=0.0

NONCONFORMING=%!PS
ENDPROLOG=%%EndProlog
BEGINSETUP=%%BeginSetup
ENDSETUP=%%EndSetup

while (! ~ $#* 0 && ~ $1 -*) {
	switch ($1) {
	case -d;  EXPANDPAGE=false

	case -h;  shift; PAGEHEIGHT=$1
	case -h*; PAGEHEIGHT=`{echo $1 | sed s/-h//}

	case -s;  SCALETOFIT=true

	case -w;  shift; PAGEWIDTH=$1
	case -w*; PAGEWIDTH=`{echo $1 | sed s/-w//}

	case -x;  shift; XOFFSET=$1
	case -x*; XOFFSET=`{echo $1 | sed s/-x//}

	case -y;  shift; YOFFSET=$1
	case -y*; YOFFSET=`{echo $1 | sed s/-y//}

	case -L;  shift; PROLOGUE=$1
	case -L*; PROLOGUE=`{echo $1 | sed s/-L//}

	case --;

	case -*;  echo '$0: illegal option $1' >[1=2]; exit 1

	}
	shift
}

echo $NONCONFORMING
cat $PROLOGUE
echo $ENDPROLOG
echo $BEGINSETUP
echo 'CropmarkDict begin'
echo '/pageheight '$PAGEHEIGHT' def'
echo '/pagewidth '$PAGEWIDTH' def'
echo '/expandpage '$EXPANDPAGE' def'
echo '/scaletofit '$SCALETOFIT' def'
echo '/xoffset '$XOFFSET' def'
echo '/yoffset '$YOFFSET' def'
echo 'setup'
echo 'end'
echo $ENDSETUP

cat $*