GS A4 format workaround truncates images

Hiroki Sato hrs at FreeBSD.org
Tue Dec 30 12:44:24 UTC 2003


Tom Rhodes <trhodes at FreeBSD.org> wrote
  in <20031228224305.551990d9.trhodes at FreeBSD.org>:

trhodes> >  I think we can replace ps2epsi with a make target using gs directly.
trhodes> >  Does anyone have other ideas?  I will commit the workaround in a couple
trhodes> >  of days.
trhodes> 
trhodes> So, let me get this straight.  A workaround to a workaround.
trhodes> I like the way it sounds!  :)

 FYI, a patch what I made is attached.

-- 
| Hiroki SATO
-------------- next part --------------
Index: doc.images.mk
===================================================================
RCS file: /home/ncvs/doc/share/mk/doc.images.mk,v
retrieving revision 1.25
diff -d -u -I\$FreeBSD:.*\$ -I\$NetBSD:.*\$ -I\$OpenBSD:.*\$ -I\$Id:.*\$ -I\$hrs:.*\$ -r1.25 doc.images.mk
--- doc.images.mk	8 Dec 2003 02:37:02 -0000	1.25
+++ doc.images.mk	30 Dec 2003 12:42:02 -0000
@@ -144,15 +144,19 @@
 PNMTOPSOPTS?=	-noturn ${PNMTOPSFLAGS}
 EPSTOPDF?=	${PREFIX}/bin/epstopdf
 EPSTOPDFOPTS?=	${EPSTOPDFFLAGS}
-PS2EPS?=	${PREFIX}/bin/ps2epsi
 #
-# ps2epsi in ghostscript built with A4=yes fails to convert
-# grops outputs without -p option.
-PIC2PS?=	${GROFF} -P -p -P a4 -p -S -Wall -mtty-char -man 
+PIC2PS?=	${GROFF} -p -S -Wall -mtty-char -man 
+#
+PS2EPS?=	${PREFIX}/bin/gs
+PS2EPSOPTS?=	-q -dNOPAUSE -dSAFER -dDELAYSAFER \
+		-sPAPERSIZE=letter -r72 -sDEVICE=bit \
+		-sOutputFile=/dev/null ${PS2EPSFLAGS} ps2epsi.ps
+#
+SETENV?=	/usr/bin/env
 REALPATH?=	/bin/realpath
 
 # Use suffix rules to convert .scr files to other formats
-.SUFFIXES:	.scr .pic .png .eps .txt
+.SUFFIXES:	.scr .pic .png .ps .eps .txt
 
 .scr.png:
 	${SCR2PNG} ${SCR2PNGOPTS} < ${.IMPSRC} > ${.TARGET}
@@ -184,9 +188,23 @@
 	${EPS2PNG} ${EPS2PNGOPTS} -o ${.TARGET} \
 	`${REALPATH} ${.TARGET:S/.png$/.eps/}`
 
-.pic.eps:
-	${PIC2PS} ${.ALLSRC} > ${.TARGET:S/.eps$/.ps/}
-	${PS2EPS} ${.TARGET:S/.eps$/.ps/} ${.TARGET}
+.pic.ps:
+	${PIC2PS} ${.ALLSRC} > ${.TARGET}
+
+.ps.eps:
+	${SETENV} outfile=${.TARGET} ${PS2EPS} ${PS2EPSOPTS} < ${.ALLSRC} 1>&2
+	echo "save countdictstack mark newpath /showpage {} def /setpagedevice {pop} def" >> ${.TARGET}
+	echo "%%EndProlog" >> ${.TARGET}
+	echo "%%Page: 1 1" >> ${.TARGET}
+	echo "%%BeginDocument: ${.ALLSRC}" >> ${.TARGET}
+	${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' < ${.ALLSRC} >> ${.TARGET}
+	echo "%%EndDocument" >> ${.TARGET}
+	echo "%%Trailer" >> ${.TARGET}
+	echo "cleartomark countdictstack exch sub { end } repeat restore" >> ${.TARGET}
+	echo "%%EOF" >> ${.TARGET}
 
 # We can't use suffix rules to generate the rules to convert EPS to PNG and
 # PNG to EPS.  This is because a .png file can depend on a .eps file, and
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-doc/attachments/20031230/d5d789d1/attachment.sig>


More information about the freebsd-doc mailing list