jperon / lyluatex

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

Automatically determine Y-extent in systems #267

Open uliska opened 5 years ago

uliska commented 5 years ago

https://lists.gnu.org/archive/html/lilypond-user/2019-07/msg00300.html

gave me an idea that might be somewhat complicated and not particularly efficient, but it might be worth taking a look.

It would be nice to know the exact vertical position of the staff symbol(s) in a PDF, which is not possible so far. Use cases: vertically position inline-aligned snippets to the text's baseline, offsetting the first system on a page to have the stafflines align with the text.

It should be possible to have LilyPond record the Y-extent properties of all grobs in a system/Staff, then determine the largest and smallest numbers and store them in an aux file. If we know that the "absolute Y-extent" of a staff's grobs is e.g. #'(-5 . 6.3) we know that the score items go 4.3 staff spaces above and 3 staff spaces below the staff symbol, and we can somehow determine the vertical position of the staff symbol relative to the image file.

NOTE: I'm not sure how that would have to be handled with more than one staff per system, and Dynamics, and lyrics etc.