Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Produce system-wise scores keeping vertical spacing #273

Open
uliska opened this issue Aug 4, 2019 · 1 comment
Open

Produce system-wise scores keeping vertical spacing #273

uliska opened this issue Aug 4, 2019 · 1 comment

Comments

@uliska
Copy link
Collaborator

uliska commented Aug 4, 2019

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

  • In an after-line-breaking callback iterate over all grobs of a system and calculate their "total" Y-extent
  • Determine the relative positioning of the StaffSymbol within the resulting cropped image file.
  • Problem: How to deal with multiple staves per system?
  • Problem: This may give us information about the protrusion of elements around the staff symbol and an indicator to adjust offsets. But it does not tell us the actual layout decision made by LilyPond

Record the absolute positions

  • I think there should be a way to have LilyPond provide the absolute position of any staff/system.
  • This can of course be used to determine the absolute distance between adjacent systems and to calculate the corresponding vertical distance between the cropped image files.
  • Problem: This is not always what we want:
    • LilyPond may produce ugly results through the vertical justification of too little material (too large spaces)
    • This concept actually makes sense only for a fullpage layout. When we only want to improve the vertical spacing for a couple of systems inserted in the text document this is definitely not what we want.

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
Copy link
Collaborator Author

uliska commented Aug 4, 2019

#267 is also related but for a different use case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant