[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] option to prevent EPS backend from creating .tex/.texi/.coun

From: Alexander Kobel
Subject: Re: [PATCH] option to prevent EPS backend from creating .tex/.texi/.count files
Date: Sat, 29 Aug 2009 09:23:30 +0200
User-agent: Thunderbird (X11/20090817)

Werner LEMBERG wrote:
Nice idea.  While you are at it, please investigate why there are
still clipping problems during the EPS->PNG conversion. [...]

As a possible solution, I can imagine that we add an intermediate step
to convert the fonts in an EPS file into PS paths, for example, by
using the `epswrite' device (as demonstrated in the `eps2eps' script
which comes with ghostscript).  This should assure that the bboxes are


some time ago I tried to handle this problem with a little script. (Makefile attached.) However, I only dealt with PDF->PDF fixing.

In short: I couldn't quite manage to get good results with a GhostScript-only version, other than tweaking the BoundingBox entries in an intermediate EPS file for myself, using the GS -sDEVICE=bbox output. Everything I tried with nothing but GS scripts either did not give the bboxes as exact as I wanted them, or actually rasterized the file.

Thus I decided to use pdftops from the libpoppler utilities. Which may be a problem for Windows, but perhaps it's not needed for EPS->x conversion.

Perhaps it will be useful as a template or give some ideas, but it certainly is not thoroughly tested. I have no idea what happens for multipage input files, by the way, but this problem won't come up for EPS->EPS conversion, I guess.


.PHONY: all clean

all:    $(BASENAME).pdf \
        $(BASENAME)-trimmed.pdf \
        $(BASENAME)-trimmed.png \

%-trimmed.pdf:  %.pdf
#       $(GS) -sDEVICE=pswrite -sOutputFile=$* $<;
#       $(GS) -sDEVICE=epswrite -sOutputFile=$*-fixed.eps $*;
#       head -n 1 $*-fixed.eps > $*-trimmed.eps;
#       echo `$(GS) -sDEVICE=bbox $*-fixed.eps 2>&1` > $*.bbox;
#       sed -e 's/ %%HiResBoundingBox/\n%%HiResBoundingBox/' < $*.bbox >> 
#       tail -n +4 $*-fixed.eps >> $*-trimmed.eps;
#       epstopdf --hires $*-trimmed.eps;
#       rm $* $*-fixed.eps $*.bbox;
        cp -f $< $@;
        pdftops $@;
        rm -f $*-trimmed.eps;
        ps2eps -l $*;
        epstopdf $*-trimmed.eps;
        rm -f $*;

        lilypond $<;

#%-trimmed.png: %.png
#       convert -trim $< +repage $@;
%-trimmed.png:  %-trimmed.pdf
        convert -density $(RESOLUTION)x$(RESOLUTION) -units PixelsPerInch 
-colorspace Gray -depth 8 $< $@;

%-trimmed-no-bg.png:    %-trimmed.png
        convert -channel R $< -channel A -size 1x256 gradient:black-none -clut 

        lilypond -dresolution=$(RESOLUTION) --png $<;

clean: $(BASENAME).clean

        rm -f $* $*-fixed.eps $*.bbox;
        rm -f $*.ps $*.pdf $*.png $*-trimmed.eps $*-trimmed.pdf $*-trimmed.png 
$*-trimmed-no-bg.png $*.midi;

reply via email to

[Prev in Thread] Current Thread [Next in Thread]