humdrum-tools / verovio-humdrum-viewer

Verovio Humdrum Viewer
http://verovio.humdrum.org
36 stars 9 forks source link

line break in tempo marking interaction with square brackets #869

Open craigsapp opened 5 months ago

craigsapp commented 5 months ago

In this example:

**kern
*clefF4
!!LO:TX:tempo:a:t=Più mosso\n[quarter-dot]=66
*M3/8
=38
4C
4D/
4E
4F
=
1G
==
*-
Screenshot 2024-01-12 at 09 23 27

There should be a line break after mosso, but the square bracket is preventing the linebreak:

**kern
*clefF4
!!LO:TX:tempo:a:t=Più mosso\nquarter-dot]=66
*M3/8
=38
4C
4D/
4E
4F
=
1G
==
*-
Screenshot 2024-01-12 at 09 24 09
craigsapp commented 5 months ago

Commit https://github.com/rism-digital/verovio/commit/55ec0f8222ec4e95a30a59276c992de2f5bf935d forces text with newline (<lb>) to be enclosed in a <rend>. This may be required (although this now seems to be optional in verovio).

However there is a strange behavior in verovio: when converting from Humdrum into verovio directly, the <lb> is ignored whether the text is enclosed in a <rend> or not.

When converting Humdrum data into MEI and then loading that MEI data into verovio, the <lb> is not ignored (whether the text is enclosed in a <rend> or not.

Example:

**kern
!LO:TX:a:t=Allegro\n[quarter]=120
1c
*-

Direct rendering with verovio:

Screenshot 2024-01-22 at 22 55 01
Click to view MEI data for above example (output conversion from Humdrum data) ```xml </titleStmt> <pubStmt> <unpub>This MEI file was created by Verovio's Humdrum converter. When published, this unpub element should be removed, and the enclosing pubStmt element should be properly filled out.</unpub> </pubStmt> </fileDesc> <encodingDesc> <appInfo> <application isodate="2024-01-22T22:55:51" version="4.2.0-dev-80ec72d"> <name>Verovio</name> <p>Transcoded from Humdrum</p> </application> </appInfo> </encodingDesc> <extMeta> <frames xmlns="http://www.humdrum.org/ns/humxml" /> </extMeta> </meiHead> <music> <body> <mdiv xml:id="m1h8vudq"> <score xml:id="scqoc7k"> <scoreDef xml:id="sls267m" midi.bpm="400.000000"> <staffGrp xml:id="stnyj44"> <staffDef xml:id="staffdef-L1F1" n="1" lines="5"> <clef xml:id="cpnl3w7" shape="G" line="2" /> </staffDef> </staffGrp> </scoreDef> <section xml:id="section-L1F1"> <measure xml:id="measure-L1" right="invis"> <staff xml:id="staff-L1F1" n="1"> <layer xml:id="layer-L1F1N1" n="1"> <note xml:id="note-L3F1" dur="1" oct="4" pname="c" accid.ges="n" /> </layer> </staff> <tempo xml:id="tempo-L3F1" place="above" staff="1" tstamp="1.000000"> <rend xml:id="rgi3w8m">Allegro<lb xml:id="lsqb6fi" /> <symbol xml:id="swk2v3e" glyph.auth="smufl" glyph.name="metNoteQuarterUp" fontsize="70.00%" /> = 120</rend> </tempo> </measure> </section> </score> </mdiv> </body> </music> </mei> ``` </details> <p>If the converted MEI is then loaded into verovio, the line break is present as expected in the output SVG:</p> <img width="313" alt="Screenshot 2024-01-22 at 22 57 25" src="https://github.com/humdrum-tools/verovio-humdrum-viewer/assets/3487289/17bedf8a-2dc4-45d0-8a66-94d8ac2a79ad"> <p>If a space is added before the <code>[quarter]</code> symbol in the Humdrum data:</p> <pre><code class="language-tsv">**kern !LO:TX:a:t=Allegro\n [quarter]=120 1c *-</code></pre> <p>The direct conversion from Humdrum to SVG with verovio will add the linebreak:</p> <img width="263" alt="Screenshot 2024-01-22 at 22 58 52" src="https://github.com/humdrum-tools/verovio-humdrum-viewer/assets/3487289/4081f1d1-8cb4-4fa7-afa4-ab050216d8ed"> <details> <summary> Click to view MEI conversion of above Humdrum data </summary> ```xml <?xml version="1.0" encoding="UTF-8"?> <?xml-model href="https://music-encoding.org/schema/5.0/mei-all.rng" type="application/xml" schematypens="http://relaxng.org/ns/structure/1.0"?> <?xml-model href="https://music-encoding.org/schema/5.0/mei-all.rng" type="application/xml" schematypens="http://purl.oclc.org/dsdl/schematron"?> <mei xmlns="http://www.music-encoding.org/ns/mei" meiversion="5.0"> <meiHead> <fileDesc> <titleStmt> <title /> </titleStmt> <pubStmt> <unpub>This MEI file was created by Verovio's Humdrum converter. When published, this unpub element should be removed, and the enclosing pubStmt element should be properly filled out.</unpub> </pubStmt> </fileDesc> <encodingDesc> <appInfo> <application isodate="2024-01-22T23:01:11" version="4.2.0-dev-80ec72d"> <name>Verovio</name> <p>Transcoded from Humdrum</p> </application> </appInfo> </encodingDesc> <extMeta> <frames xmlns="http://www.humdrum.org/ns/humxml" /> </extMeta> </meiHead> <music> <body> <mdiv xml:id="m18tw7lh"> <score xml:id="s1ssfxay"> <scoreDef xml:id="svpalys" midi.bpm="400.000000"> <staffGrp xml:id="seln8j8"> <staffDef xml:id="staffdef-L1F1" n="1" lines="5"> <clef xml:id="c1iou3zg" shape="G" line="2" /> </staffDef> </staffGrp> </scoreDef> <section xml:id="section-L1F1"> <measure xml:id="measure-L1" right="invis"> <staff xml:id="staff-L1F1" n="1"> <layer xml:id="layer-L1F1N1" n="1"> <note xml:id="note-L3F1" dur="1" oct="4" pname="c" accid.ges="n" /> </layer> </staff> <tempo xml:id="tempo-L3F1" place="above" staff="1" tstamp="1.000000"> <rend xml:id="rjuj5r1">Allegro<lb xml:id="lg8e0nj" /> <symbol xml:id="s1royt93" glyph.auth="smufl" glyph.name="metNoteQuarterUp" fontsize="70.00%" /> = 120</rend> </tempo> </measure> </section> </score> </mdiv> </body> </music> </mei> ``` </details> <hr /> <p>The converted <code><tempo></code> contents for the first example:</p> <pre><code class="language-xml"> <tempo xml:id="tempo-L3F1" place="above" staff="1" tstamp="1.000000"> <rend xml:id="rgi3w8m">Allegro<lb xml:id="lsqb6fi" /> <symbol xml:id="swk2v3e" glyph.auth="smufl" glyph.name="metNoteQuarterUp" fontsize="70.00%" /> = 120</rend> </tempo></code></pre> <p>And the converted <code><tempo></code> contents for the second example with the added whitespace before the symbol:</p> <pre><code class="language-xml"> <tempo xml:id="tempo-L3F1" place="above" staff="1" tstamp="1.000000"> <rend xml:id="rjuj5r1">Allegro<lb xml:id="lg8e0nj" /> <symbol xml:id="s1royt93" glyph.auth="smufl" glyph.name="metNoteQuarterUp" fontsize="70.00%" /> = 120</rend> </tempo></code></pre> <p>One possible solution is to force a space after a newline when processing Humdrum data, although that will shift the text on the second line slightly to the right.</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/craigsapp"><img src="https://avatars.githubusercontent.com/u/3487289?v=4" />craigsapp</a> commented <strong> 5 months ago</strong> </div> <div class="markdown-body"> <p>See issue <a href="https://github.com/rism-digital/verovio/issues/3576">https://github.com/rism-digital/verovio/issues/3576</a></p> </div> </div> <div class="page-bar-simple"> </div> <div class="footer"> <ul class="body"> <li>© <script> document.write(new Date().getFullYear()) </script> Githubissues.</li> <li>Githubissues is a development platform for aggregating issues.</li> </ul> </div> <script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.min.js"></script> <script src="/githubissues/assets/js.js"></script> <script src="/githubissues/assets/markdown.js"></script> <script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.4.0/build/highlight.min.js"></script> <script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.4.0/build/languages/go.min.js"></script> <script> hljs.highlightAll(); </script> </body> </html>