jperon / lyluatex

Alternative à lilypond-book pour lualatex
MIT License
56 stars 11 forks source link

Produce system-wise scores keeping vertical spacing #273

Open uliska opened 5 years ago

uliska commented 5 years ago

This extracts parts of #268 but also relates to #271

With lilypond-book-preamble.ly LilyPond simply crops each system to its extent (we know that it's actually the Y-extent of its content elements because it will cut off elements that have been manually positioned through stencil callbacks or extra-offset). This process scrubs the information about the vertical spacing between the systems: the distance may be too large or too small, depending on the elements protruding in the vertical space (examples in #268).

Discussion on the lilypond-devel thread indicate that LilyPond doesn't "know" about the required values in a way to make this work for us, but one should at least try to either figure out a workaround or improve LilyPond's page layout handling. This issue is intended as a reminder to monitor this discussion over at LilyPond.

I have three basic ideas about possible approaches. Both would require injecting Scheme functionality in LilyPond to provide analysis data (written to aux files).

Analyze the LilyPond Systems

Record the absolute positions

LilyPond vertical spacing variables

For handling the problem of systems that are printed too densely we could make use of LilyPond's vertical spacing variables (and their defaults). If a system does not have protruding elements LilyPond will use these variables to create decent vertical spacing even when it does not have to stretch the systems for vertical justification. So it should probably be possible to have a way to know the minimal distance between two systems, and if the cropped images are smaller than that we could simply add the missing \vspace.


I think these three options are partially interdependent, and if the first two are possible on the LilyPond side (do you have any ideas on this @lemzwerg?) I think we could get pretty far at improving the insert=systems output, which has always been and should IMO remain the bread-and-butter mode for using lyluatex.

But it is probably a fairly complex issue and needs detailed consideration and specification before one can tackle it. Actually I'd say implementing this and #272 would warrant a v1.1 release.

uliska commented 5 years ago

267 is also related but for a different use case.