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


  %%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!

lilypond-user mailing list

Reply via email to