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: Alexander Kobel
Subject: Re: Understanding the eps bounding box (rounding)
Date: Fri, 2 Mar 2018 16:02:45 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0

Hi again,

On 03/02/2018 03:10 PM, Urs Liska wrote:
[...]
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.

Now apparently it's me who's confused. You just want to get the proper line lengths, right? Why do you even need to touch the .eps then? (The more I deal with it, the more I dislike PDF, but apparently I *passionately* dislike EPS - there's even more intricacies in (E)PS, and my PDF swiss army knives seems to be sharper than the EPS ones. (Not talking about insane PDFs with Flash, forms and fireworks and whatever.))

Just compile your file in Lily and inspect the individual PDFs for the systems. Barring unexpected (and anyway unhandled) stuff like marks protuding over left and right margin, you get

% gs -sDEVICE=bbox -q -dBATCH -dNOPAUSE test-?.pdf
%%BoundingBox: 0 0 480 38
%%HiResBoundingBox: 0.504000 0.522000 479.510774 37.025436
%%BoundingBox: 28 0 480 40
%%HiResBoundingBox: 28.709999 0.846000 479.510774 39.995999
%%BoundingBox: 28 0 480 40
%%HiResBoundingBox: 28.709999 0.018000 479.510774 39.005999

(actual values differing slightly, probably due to font handling, Lily version etc. on my system; but ballpark like yours).

So, the corresponding line lengths are
    (479.510774-0.504000) bp
  = 479.006774 bp (TeX "big point" / PostScript point)
  = 477.217209 pt (TeX's and Lily's point; 72.27 pt = 72 bp)
  = 6.652872 in (1 in = 72 bp)
for the first system, including instrumentName, and
  (479.510774-28.709999) bp = 6.261122 in
for the second and third, including shortInstrumentName.

That should be enough to figure out the required line length / indent settings.

Once you compiled your final output, include the pdfs directly, and if you want sub-bp accuracy for alignment (or are worried about margins that are set too loose by Lily), use the crop/trim/bb/bb* options of \includegraphics (via the graphicx package) rather than cropping the PDF files separately, or rewriting the EPS. Note that I didn't test the bounding box-options of graphicx yet, only trim; if they don't work for PDF, you need to resort to trim.


HTH,
Alex

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature


reply via email to

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