[tex-k] epstopdf: %%BoundingBox: (atend)

Martin von Gagern Martin.vGagern at gmx.net
Tue Aug 25 17:24:02 CEST 2009


Karl Berry wrote:
> My guess is that the current maintainer of epstopdf (Gerben Wierda)
> would accept a clean patch for these things, but is unlikely to write it
> himself.  Any interest?  Anyway, I'll ask him.  (I don't have the
> time/inclination/energy to do it myself either, I'm afraid.)

I wrote a patch, to address this issue and fix some others I noticed in
the passing. Will you forward the patch to Gerben Wierda, or are you
certain that he does follow this list here and will take notice? I don't
have a mail address of him. I have given my new version some cursory
testing, but some more testing would of course be appreciated.

Issues addressed by this patch (also explained in the patch header):

Handling of (atend) BBox used to determine the current input stream
position from the position of the output stream, which is usually a
pipe to ghostscript. tell on pipes doesn't work portably. If some
"binary junk" was stripped from the input, then the output position is
different from the corresponding input position, so the length of this
binary prefix has to be taken into account as well. The patch uses the
newly introduced variable $inputpos to keep track of input
position. The variable $bufarraypos in the previous version did
perform a similar role, but wasn't used any more, so I removed it to
avoid confusion.

The former implementation of (atend) handling did skip over embedded
documents, but failed to consider multiple levels of nested
documents. The new implementation keeps track of nesting depth,
allowing deep nesting hierarchies.

In the case of CR without LF as the line terminator, the old
implementation used to remove those line terminators while splitting
the document, and readded them in a subsequent loop. A look-behind
assertion can split at the zero-length position just after a CR,
leaving the line terminators in place and avoiding the extra loop.

The old implementation would always use \n in any output generated by
the script. If input lines were terminated by \r instead, this would
lead to mixed line endings in the generated postscript, which could in
theory cause trouble for other applications. epstopdf itself, for
example, will behave very poorly if line termination for the input is
inconsistent - a fact that might need to be addressed in the future.
This patch uses $/ instead of \n in postscript output. As $/ will not
get set to \r\n even if input follows that convention, this isn't
perfect, but a bit better than before.

Regular expressions matching those bbox lines will now only be
compiled once, which might lead to a slight performance improvement.

Documentation has been updated to name this new version "2.9.9mvg".

Greetings,
 Martin von Gagern
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: epstopdf-2.9.9mvg.patch
URL: <http://tug.org/pipermail/tex-k/attachments/20090825/c8d57304/attachment.asc>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 261 bytes
Desc: OpenPGP digital signature
URL: <http://tug.org/pipermail/tex-k/attachments/20090825/c8d57304/attachment.bin>


More information about the tex-k mailing list