ChordPro / chordpro

Reference implementation of the ChordPro standard for musical lead sheets.
Other
324 stars 51 forks source link

Layout oddity - maybe line wrapping doesn't allow for inline chords? #344

Open gwyndaf opened 9 months ago

gwyndaf commented 9 months ago

I've noticed for a while that some long song lines overlap chord diagrams (on the right), rather than wrapping to avoid them.

I finally dug a bit deeper, and think it might arise when a song has inline chords, which the line-wrapping process maybe doesn't take into account: Line_wrap.pdf

Thing is, I'm a bit reluctant to report this, as it might get fixed!

Here's why: I find it quite useful that song lines run into the chord diagram column on the right, as it helps me make best use of the page space to accommodate a song with long lines: Please_Mr_Postman (Guitar) git.pdf

If the lower part of the diagram column is unused, that's handy space for long lines, and I'll sometimes even chance them overlapping diagrams. For example, if the line stops short of diagrams on guitar and ukulele versions (most players), I don't mind a bit of overlap with wider keyboard diagrams.

So, if this is an issue that needs fixing, here's a couple of thoughts (if my assumptions above are correct):

  1. Might there be a way of wrapping around a chord diagram block, rather than column? That is, if there are no chord diagrams to the right of a line, it wraps at the right margin (not diagrams column). I'm guessing this might be tricky to achieve.
  2. A config setting (in pdf.?) to turn line-wrapping off. Page layout could get messy, but it gives users greater control (and risk). I suppose we then get into the question of whether this is global, or needs separate settings for songlines and ToC entries.

So, flagging this for information, but I'm in no rush for the current behaviour to change :)

sciurius commented 9 months ago

It is not often that users do not want a bug to be fixed ☺.

The current wrapping algorithm is designed for chords above, and indeed yields wrong wrapping when chords are embedded. The whole formatting implementation should be redesigned, a.o. to allow for decent wrapping. I'm not yet looking forward to do that.

I'll consider the suggestion to add a 'do not wrap' setting. It may be useful in specific cases and allows you to anticipate a potential wrapping redesign.