humdrum-tools / verovio-humdrum-viewer

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

Convert fingerings from <dir> to <fing> #817

Closed craigsapp closed 1 year ago

craigsapp commented 1 year ago

Example:

Screenshot 2023-06-16 at 4 38 52 PM
**kern  **fing
*M4/4   *
=1  =1
!!LO:TX:t=legato:i
8fL 1
8g  2
8a  3
8bJ 4
=   =
*-  *-

Currently the fingerings are translated into <dir> (free-form text elements) in the MEI conversion. This causes them to have equivalent priority to text, and the result in the above is the fingerings above the text. Converting the fingerings to <fing> instead will produce the correct stacking order.

Current conversion to MEI ```xml </titleStmt> <pubStmt /> </fileDesc> <encodingDesc> <appInfo> <application isodate="2023-06-16T16:41:29" version="3.16.0-dev-b62cd9f-dirty"> <name>Verovio</name> <p>Transcoded from Humdrum</p> </application> </appInfo> </encodingDesc> <workList> <work> <title /> </work> </workList> </meiHead> <music> <body> <mdiv xml:id="m5tyvzj"> <score xml:id="s1dgtkgn"> <scoreDef xml:id="s1g57r3i"> <staffGrp xml:id="s1cqqo7a"> <staffDef xml:id="staffdef-L1F1" n="1" lines="5"> <clef xml:id="c1smitfj" shape="G" line="2" /> <meterSig xml:id="metersig-L2F1" count="4" unit="4" /> </staffDef> </staffGrp> </scoreDef> <section xml:id="section-L1F1"> <measure xml:id="measure-L1" n="1"> <staff xml:id="staff-L1F1" n="1"> <layer xml:id="layer-L1F1N1" n="1"> <beam xml:id="beam-L5F1-L8F1"> <note xml:id="note-L5F1" dur="8" oct="4" pname="f" accid.ges="n" /> <note xml:id="note-L6F1" dur="8" oct="4" pname="g" accid.ges="n" /> <note xml:id="note-L7F1" dur="8" oct="4" pname="a" accid.ges="n" /> <note xml:id="note-L8F1" dur="8" oct="4" pname="b" accid.ges="n" /> </beam> </layer> </staff> <dir xml:id="dir-L4F1" place="above" staff="1" tstamp="1.000000"> <rend xml:id="r1v77qe5" fontstyle="italic">legato</rend> </dir> <dir xml:id="dir-L5F2" type="fingering" place="above" staff="1" startid="#note-L5F1"> <rend xml:id="r9ycl90" fontsize="x-small" fontstyle="normal">1</rend> </dir> <dir xml:id="dir-L6F2" type="fingering" place="above" staff="1" startid="#note-L6F1"> <rend xml:id="rxqeypf" fontsize="x-small" fontstyle="normal">2</rend> </dir> <dir xml:id="dir-L7F2" type="fingering" place="above" staff="1" startid="#note-L7F1"> <rend xml:id="rwxcq2i" fontsize="x-small" fontstyle="normal">3</rend> </dir> <dir xml:id="dir-L8F2" type="fingering" place="above" staff="1" startid="#note-L8F1"> <rend xml:id="rr931yv" fontsize="x-small" fontstyle="normal">4</rend> </dir> </measure> </section> </score> </mdiv> </body> </music> </mei> ``` </details> <p>Example fingering:</p> <pre><code class="language-xml"> <dir xml:id="dir-L5F2" type="fingering" place="above" staff="1" startid="#note-L5F1"> <rend xml:id="r9ycl90" fontsize="x-small" fontstyle="normal">1</rend> </dir></code></pre> <p>This should be converted to:</p> <pre><code class="language-xml"> <fing xml:id="dir-L5F2" place="above" staff="1" startid="#note-L5F1"> <rend xml:id="r9ycl90" fontsize="small" >1</rend> </fing></code></pre> <p>Resulting rendering (only fingering "1"):</p> <img width="305" alt="Screenshot 2023-06-16 at 4 44 42 PM" src="https://github.com/humdrum-tools/verovio-humdrum-viewer/assets/3487289/33278a35-5188-4288-91c6-f1d6b5b445ac"> <p>The <code><fing></code> element has a higher stacking priority so now displays as desired below the <code><dir></code> text.</p> <p>The <code><fing></code> is bolder, which is nice. The default size for fingerings are tool large, so the fingerings should be rended in <code>@fontsize="small</code> (previously <code>x-small</code> which results in the new size being the same as the original).</p> <p>Probably allow fontsize control for the <code>**fing</code> spine:</p> <table> <thead> <tr> <th>interpretation</th> <th>meaning</th> </tr> </thead> <tbody> <tr> <td><code>*fs:small</code></td> <td><code>@fontsize="x-small"</code></td> </tr> <tr> <td><code>*fs:100%</code> and/or <code>*fs:normal</code></td> <td><code>@fontsize="small"</code></td> </tr> <tr> <td><code>*fs:large</code></td> <td><code>@fontsize="normal"</code></td> </tr> </tbody> </table> <p><code>@fontstyle="normal"</code> is the default rendering style for fonts in <code><fing></code>, so remove <code>rend@fontstyle</code>.</p> <p>Also remove <code>type="fingering"</code> since the element has changed from <code><dir></code> to <code><fing></code> and is no longer necessary for identifying the function of the text.</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> 1 year ago</strong> </div> <div class="markdown-body"> <p>Implemented in commit <a href="https://github.com/rism-digital/verovio/commit/da7018379b3384d50ff44f83f09f7e2277c31be7">https://github.com/rism-digital/verovio/commit/da7018379b3384d50ff44f83f09f7e2277c31be7</a></p> <p>Above example now renders as desired:</p> <img width="254" alt="Screenshot 2023-06-17 at 11 45 25 AM" src="https://github.com/humdrum-tools/verovio-humdrum-viewer/assets/3487289/252708b0-c530-461d-8af0-f7bd47890733"> <pre><code class="language-tsv">**kern **fing *M4/4 * =1 =1 !!LO:TX:t=legato:i 8fL 1 8g 2 8a 3 8bJ 4 = = *- *-</code></pre> <p>Example of currently available stylings:</p> <img width="1210" alt="Screenshot 2023-06-17 at 11 42 20 AM" src="https://github.com/humdrum-tools/verovio-humdrum-viewer/assets/3487289/d4d0e285-35f2-4c0e-ae3c-fb6a22c5e6ce"> <pre><code class="language-tsv">**kern **fing =1 =1 4c 1 4d 2 * *fs:small !!LO:TX:b:vg=1:fs=xsmall:t=small 2e 3 * *fs:large !!LO:TX:b:vg=1:t=large 2f 4 * *fs:normal !!LO:TX:b:vg=1:t=normal =2 =2 * *below !!LO:TX:a:t=below 4c 1 4d 2 * *Xbold !!LO:TX:a:t=Xbold 2e 3 2f 4 =3 =3 * *above * *italic * *color:orange !!LO:TX:b:vg=2:t=above !!LO:TX:b:t=italic !!LO:TX:b:t=orange 4c 1 4d 2 * *bold !!LO:TX:b:vg=2:t=bold 2e 3 2f 4 =4 =4 * *Xitalic * *color:crimson !!LO:TX:b:vg=3:t=red !!LO:TX:b:t=Xitalic 4c 4e 1 3 4d 4f 2 4 * *color:royalblue !!LO:TX:b:vg=3:t=blue 4e 4g 1 3 4f 4a 2 4 == == *- *-</code></pre> </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> 1 year ago</strong> </div> <div class="markdown-body"> <p>Add circles and boxes around fingerings in the future. Add stylings to separate fingering in chords in the future.</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>