lilypond-user
[Top][All Lists]
Advanced

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

Re: Understanding the eps bounding box (rounding)


From: Urs Liska
Subject: Re: Understanding the eps bounding box (rounding)
Date: Fri, 2 Mar 2018 15:10:01 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0

Hi Alexander,


Am 02.03.2018 um 11:35 schrieb Alexander Kobel:
...

I'd be glad about any concrete information or other suggestions.

Both slightly more concrete and another suggestion: wouldn't you be better off with using the high-resolution bounding box determined by GS from an actual rendering of the page? E.g.,

  gs -sDEVICE=bbox -q -dBATCH -dNOPAUSE bbox.pdf

gives

  %%BoundingBox: 0 0 480 136
  %%HiResBoundingBox: 0.486000 0.432000 479.510774 135.017433

for your attached file. These numbers are as accurate as they can reasonably expected to be: GS promises that the numbers are conservatively rounded and accurate to 1 unit in the last place. (Subject to theoretical limitations on Turing-complete page description languages, I guess...)

Note that AFAICS the EPS generated by Lilypond has a white background on the integer coordinates, so the values reported by GS will match the numbers in the file. But since you use LuaLaTeX apparently, I assume you include PDFs rather than EPSs, right? No need to work with both formats, then.


HTH and doesn't add a whole lot of confusion,

Indeed it helps, thank you very much.

First I thought this is the solution.
Then the confusion came.
But now I think again that it's the solution :-)

I assume the difference between the BoundingBox and the HiResBoundingBox is exactly what I'm after. Unfortunately the box is shifted to a new origin: the lower left corner now is the origin of the resulting image and not related to the staff symbol anymore.
However, I can
- read the "rough" values from the original .eps file
- run your gs command on the final .pdf
- use the .eps values to shift the rectangle.

$ head -n 3 bbox-1.eps | tail -n 1
%%BoundingBox: -80 -37 400 1
$ gs -sDEVICE=bbox -q -dBATCH -dNOPAUSE bbox-1.pdf
%%BoundingBox: 0 0 480 38
%%HiResBoundingBox: 0.504000 0.522000 479.510774 37.025999

So I have to shift the X coordinates by -80 (the llx) and the Y coordinates by -37 (the lly) to get
-79.504 -36.5222 399.519774 0.025999

I think this is the way to go and should actually be quite manageable.

Thanks everybody for the input!
Urs
Alex





reply via email to

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