ssb22 / jianpu-ly

Jianpu in Lilypond
http://ssb22.user.srcf.net/mwrhome/jianpu-ly.html
Apache License 2.0
70 stars 18 forks source link

[Feature] Do not stretch last line #46

Closed suntong closed 10 months ago

suntong commented 11 months ago

It's inevitable that some music/song will have the last line only containing a few notes. The current behavior is to stretch these few notes to the whole length on the last line, which looks very odd comparing to all above lines.

Please consider leaving the last line taking the normal space, not stretching it. thx.

ssb22 commented 10 months ago

Which version of Lilypond are you using, and what is your input?

Lilypond shouldn't stretch out the last line. It should even-out the spacing across the whole score. So as you add more music, it first of all squashes in as much as possible (reducing the spacing), and when that doesn't work anymore, it adds a new line, and then lets the reduced spacing of the whole score bounce back a bit so there's a decent amount of material on that new line.

You can see this happen: on A4 paper, default margins, Lilypond 2.24.2, if you put echo 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 | python jianpu-ly.py it gets you 12 bars on 1 line (squashed up as much as possible), then add one more 1 2 3 4 to the command and suddenly you get 2 lines of 6 bars and 7 bars.

So you should never see a stretched-out last line with just 1 bar in it, unless (a) you're using a version of Lilypond that doesn't do this layout so well (an old version perhaps?) or (b) you have unusual input (like really long lyrics in some bars) that's making it difficult for Lilypond to do its job normally. Which is why I'm wondering which Lilypond version and what input.

It is possible to tell Lilypond not to space out the last line in any way by putting ragged-last = ##t in the \layout block, but before we do that we should be looking at why it's a problem in the first place when it shouldn't be. But I could add a "ragged last" option of some kind (not on by default because normally this situation isn't supposed to happen....)

suntong commented 10 months ago

Ah, Got it. Here is how/why I need such feature:

https://github.com/jianpu-ly/jianpu-st/blob/master/yydjtz.jp

It first ends up only about less than half of a page, so I added \breaks myself, and when it comes to repeating the last time, I tried to put the repeated line (one or two verses) on the next line, which get evened out the spaces across the whole page-width.

Adding a "ragged last" option of some kind would be really helpful is such case. thanks.

ssb22 commented 10 months ago

Ah yes, if you're using manual \break then Lilypond is going to rely on your manual decisions a lot more .. let's do a RaggedLast option (you might want to take out the 3rd \break when you use it)