On Tue, 2023-12-12 at 16:10 -0800, Stefano Antonelli wrote:
> I'm producing muliple pngs with a single staff each.  When I 'flip'
> through these pngs, the staff appears to move up and down on the
> page.
> 
> I can set
> 
> top-system-spacing.basic-distance = #7

It turns out I need exactly 

top-system-spacing.basic-distance = #6

To get the middle staff line positioned at the vertical centre.  See
attached.

The paper-height is 14.8 and the centre should be at 7.4 "systems
spacing".  If I want to put the middle staff line there I need:

top-system-spacing.basic-distance = paper-height/2 - 1.4

That 1.4 is referenced to the "vertical center of the nearest
StaffSymbol when there is no markup between the system and the top
margin".  As it is in my case.

The StaffSymbol, is just the 5 (by default) lines of the staff
according to here:

<http://lilypond.org/doc/v2.25/Documentation/internals/staffsymbol>

If the vertical centre was really the vertical centre (ie. the middle
staff line), then my calculation would change to:

top-system-spacing.basic-distance = paper-height/2

And life would be good.  Even if it were the top staff line:

top-system-spacing.basic-distance = paper-height/2 - 2

would do it.

I don't understand where 1.4 comes from or how to calculate it based on
the staff-size.

Is there a way to ask lilypond what the "vertical center of the nearest
StaffSymbol" is?

This seems like a roundabout way to get the middle staff line to the
vertical centre of the page.  Is there an easier way?

The vertical centre has the advantage/disadvantage of equal space for
beams above and below the staff.  If the beams don't fit one way or the
other the page height has to be increased.  And that's a trial and
error approach.

Ideally, the max height of the systems on all pages would be considered
and all the systems could be placed so that there is the maximum amount
of available space for beams, where they are needed, over the whole
score.  This could probably be done by running lilypond once with #one-
line-auto-height-breaking and dumping certain variables to the screen
or a file.  I don't have time to play with that right now though.

Also related, I can calculate the paper-height in "system spacing" from
the height in mm.  Is there a way to get this number in "system
spacing" directly from lilypond such that I could use it to set top-
system-spacing.basic-distance?

Thanks,
Stef

Reply via email to