BirminghamConservatoire / JohannesTinctoris

Editing and rendering text and music notation for online edition of music treatises
7 stars 4 forks source link

Ledger lines with Ligatures #10

Closed goursaud closed 3 years ago

goursaud commented 4 years ago

The ledger line does not display correctly here:

<piece: {mensural: void}, {staf: 5, black}> {clef: C10} {solm: 0} {mens: O5} SF mG ma <ll:-1><lig><obl>SF<text>te.</text> sC</obl></lig> b2 <lig>BD <text>Gratias</text> BB BF</lig></ll>PS5 Sa. </piece>

annplaksin commented 4 years ago

Just a note:

The problem seems to be connected to the oblique, because it works without oblique: grafik

<piece: {mensural: void}, {staf: 5, black}> 
<part: 1>
{clef: C10} {solm: 0} {mens: O5} SF mG ma <ll:-1><lig>SF<text>te.</text> sC</lig> b2 <lig>BD <text>Gratias</text> BB BF</lig></ll>PS5 Sa. 
</part>
</piece>
DILewis commented 4 years ago

Ledger lines are carried forwards in the .classList attribute. It's possible that it's not being passed on or is being lost in the Oblique or ObliqueNote object

annplaksin commented 4 years ago

According to the console, ligatures, obliques and oblique notes have the LedgerLineChange in .classList... That seems kind of right to me... might it be a rendering issue instead of a parsing issue?

23: Ligature
  classList: [LedgerLineChange]
  members: Array(1)
    0: Oblique
      classList: [LedgerLineChange]
      members: Array(2)
        0: ObliqueNote
          classList: [LedgerLineChange]
DILewis commented 4 years ago

Actually, I take that back – it's broken in both cases. In the original, the ledger line is being drawn backwards (for me) to the beginning. In the version without the oblique, it extends all the way to the right at the end. That looks like the right position of the ledger line isn't properly set in either case.

DILewis commented 4 years ago

Ok, it looks like a bounding box error. The decision about where to end a ledger line is in LedgerLineChange.finishLines. It's calculated as the maximum of where the current x co-ordinate is and the largest extent of the preceding object (e2). That's calculated based on getBBox() being run on element e2. For these ligatures, at least, the bounding box is wrong. It's a chunk right (this may be related to margin effects).

annplaksin commented 4 years ago

So, I hope this works now... @goursaud Would you please find some time to test ledger lines with and without text underlay? But ledger lines with variants still won't work..

I played around with that:


<piece: {mensural: void}, {staf: 5, black}> 
<part: 1>
{clef: C10} {solm: 0} {mens: O5} SF mG ma <ll:-1><lig>SF<text>te.</text> sC</lig> b2 <lig>BD <text>First</text> BB BF</lig></ll>PS5 Sa. 
</part>
<part: 2>
{staf: 5, black} {clef: C10} {solm: 0} {mens: O5} SF mG ma <ll:-1><lig><obl>SF<text>te.</text> sC</obl></lig> b2 <lig>BD <text>Second</text> BB BF</lig></ll>PS5 Sa. 
</part>
<part: 3>
{staf: 5, black} {clef: C10} {solm: 0} {mens: O5} SF mG ma <ll:-1>SF<text>te.</text> sC b2 BD <text>Second</text> BB BF</ll>PS5 Sa. 
</part>
</piece>```