rism-digital / verovio

🎵 Music notation engraving library for MEI with MusicXML and Humdrum support and various toolkits (JavaScript, Python)
https://www.verovio.org
GNU Lesser General Public License v3.0
661 stars 183 forks source link

Time signature numbers overlap with Petaluma font #1184

Closed efreja closed 2 years ago

efreja commented 4 years ago

Hello, The time signature numbers overlap in a bad way with Petaluma font. Example: Capture d’écran 2019-11-05 à 22 15 20 Many thanks.

craigsapp commented 4 years ago

Should the numbers be scaled to fit within the staff, or should the top/bottom of the two numbers touch the middle staff line?

Also there is a problem with the "3" tuplet number underneath the beam in the second measure. Either the number should be moved down, or the tuplet numbers should be made smaller.

efreja commented 4 years ago

I guess that it should be done as said in Elaine's Gould book: "Time-signature numerals should exactly fill the height of the stave". BTW it's how it works for the other fonts embedded in Verovio. This can be easily seen on: http://www.partitionnumerique.com/music-sheet-viewer-plugin-gallery/ (search "rolling") Thanks

craigsapp commented 4 years ago

Yes, that is a reasonable assumption, but Petaluma is an emulation of handwriting, so the rules/standards may be different. I found a page demonstrating the intended effect for the time signature with Petaluma in Flat:

https://blog.flat.io/new-music-font/

Screen Shot 2019-11-06 at 8 54 20 AM

So the numbers in the time signature are supposed to be oversized and touching the center staff line.

craigsapp commented 4 years ago

Note that the stem lengths in the above example are correct @lpugin 😜

Screen Shot 2019-11-06 at 9 17 59 AM
<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="http://music-encoding.org/schema/4.0.0/mei-all.rng" type="application/xml" schematypens="http://relaxng.org/ns/structure/1.0"?>
<?xml-model href="http://music-encoding.org/schema/4.0.0/mei-all.rng" type="application/xml" schematypens="http://purl.oclc.org/dsdl/schematron"?>
<mei xmlns="http://www.music-encoding.org/ns/mei" meiversion="4.0.0">
    <meiHead>
        <fileDesc>
            <titleStmt>
                <title />
            </titleStmt>
            <pubStmt />
        </fileDesc>
        <encodingDesc>
            <appInfo>
                <application isodate="2019-11-06T09:18:04" version="2.3.0-dev-5f4c553">
                    <name>Verovio</name>
                    <p>Transcoded from Humdrum</p>
                </application>
            </appInfo>
        </encodingDesc>
        <workList>
            <work>
                <title />
            </work>
        </workList>
        <extMeta>
            <frames xmlns="http://www.humdrum.org/ns/humxml">
                <metaFrame n="2" token="!!!OMD: [quarter] = 80" xml:id="L3">
                    <frameInfo>
                        <startTime float="0" />
                        <frameType>reference</frameType>
                        <referenceKey>OMD</referenceKey>
                        <referenceValue>[quarter] = 80</referenceValue>
                    </frameInfo>
                </metaFrame>
            </frames>
        </extMeta>
    </meiHead>
    <music>
        <body>
            <mdiv xml:id="mdiv-0000001955366819">
                <score xml:id="score-0000001453786354">
                    <scoreDef xml:id="scoredef-0000001530575559">
                        <staffGrp xml:id="staffgrp-0000001078610473">
                            <staffDef xml:id="staffdef-0000000685169079" n="1" lines="5">
                                <clef xml:id="clef-L2F1" shape="G" line="2" />
                                <meterSig xml:id="metersig-L4F1" count="4" unit="4" />
                            </staffDef>
                        </staffGrp>
                    </scoreDef>
                    <section xml:id="section-L1F1">
                        <measure xml:id="measure-L1" right="end" n="0">
                            <staff xml:id="staff-0000000625768149" n="1">
                                <layer xml:id="layer-L1F1N1" n="1">
                                    <note xml:id="note-L5F1" dur="4" oct="4" pname="c" accid.ges="n" />
                                    <beam xml:id="beam-L6F1-L7F1">
                                        <note xml:id="note-L6F1" dur="8" oct="4" pname="d" accid.ges="n" />
                                        <note xml:id="note-L7F1" dur="8" oct="4" pname="e" accid.ges="n" />
                                    </beam>
                                    <beam xml:id="beam-L8F1-L11F1">
                                        <note xml:id="note-L8F1" dur="16" oct="4" pname="f" accid.ges="n" />
                                        <note xml:id="note-L9F1" dur="16" oct="4" pname="g" accid.ges="n" />
                                        <note xml:id="note-L10F1" dur="16" oct="4" pname="a" accid.ges="n" />
                                        <note xml:id="note-L11F1" dur="16" oct="4" pname="b" accid.ges="n" />
                                    </beam>
                                    <note xml:id="note-L12F1" dur="8" oct="5" pname="c" accid.ges="n" />
                                    <rest xml:id="rest-L13F1" dur="8" />
                                </layer>
                            </staff>
                            <tempo xml:id="tempo-L3F1" staff="1" tstamp="1.000000">♩ = 80</tempo>
                        </measure>
                    </section>
                </score>
            </mdiv>
        </body>
    </music>
</mei>
efreja commented 4 years ago

Maybe it's what Steinberg preconizes, but I don't think it's nice looking. Here's an example of the RealBook as it's supposed to fake hand writing for Jazz: Capture d’écran 2019-11-06 à 18 27 52 In fact the 2 numerals overlap slightly. In Verovio with Petaluma, it's rendered as: Capture d’écran 2019-11-06 à 18 28 09 that seem to show that if we wanted to do the same, it's the lower numeral that is placed too high..

lpugin commented 4 years ago

SMuFL compliant fonts should not require random glyphs to be resized. Regarding Petaluma, it seems indeed that the expectation is for superimposed figures to be aligned (bottom and top) with the center line, as @craigsapp pointed out. It would be good to look at the SMuFL spec to see if there is a given glyph or something else that provides information about the height of time signature glyphs, or if they should be aligned with the line one-by-one depending on their own height.

rettinghaus commented 4 years ago

It seems to me that Verovio is SMuFL compliant, while Petaluna isn't. SMuFL specifications say:

Digits for time signatures should be scaled such that each digit is two staff spaces tall, i.e. 0.5 em, and vertically centered on the baseline. Although some glyphs in the time signatures range (such as the large + sign, common and cut time glyphs, etc.) apply to the whole staff, these should likewise be vertically centered on the baseline. Time signature digits should also have non-zero side bearings to achieve good default spacing when set in a single run.

craigsapp commented 4 years ago

In what way is Petaluma non-compliant (i.e., why would the producers of SMuFL make a non-compliant font :-)?

Digits for time signatures should be scaled such that each digit is two staff spaces tall

It says "should" not "must" (or "shall"), so it is not required. Basically they are saying that the time signature glyphs should not need to be scaled, and they should be stored in the font at the default size that they are to be displayed at.

Somewhat interesting on page 60 of the manual where there is a note about positioning:

http://www.smufl.org/files/smufl-0.9.pdf

Screen Shot 2019-11-06 at 11 01 39 AM

And there are separate glyphs for numerators and denominators of time signatures:

Screen Shot 2019-11-06 at 11 04 01 AM
rettinghaus commented 4 years ago

Ok, so the control characters U+E09E and U+E09F should be used to shift the glyphs. Haven't seen that. @lpugin, could we make use of that?

craigsapp commented 4 years ago

Those are supposed to be for text-based display of time signatures :-)

lpugin commented 4 years ago

Ok, so the control characters U+E09E and U+E09F should be used to shift the glyphs. Haven't seen that. @lpugin, could we make use of that?

Not sure. They are meant to be used by text-based applications.

I am still finding it unclear how to exactly position them, but I assume we can fiddle around to have them aligned on each side for the middle line. I am not convinced that looking at the height of each glyph (which is the only way I can see for now) is very robust and recommendable.

craigsapp commented 3 years ago

Here is a sample of Petaluma time signatures used in Dorico:

Screen Shot 2021-05-30 at 11 21 31 AM

See: https://www.youtube.com/watch?v=P52OXNJB-FA&t=120s

The top of the bottom number and the bottom of the top number are centered on the center line of the staff. In verovio both numbers overlap the center line:

Screen Shot 2021-05-30 at 11 18 39 AM

They seem to be centered on the second and 4th lines. Otherwise maybe there is a font metric control for this? Otherwise it is better to place the time signature so that their bounding boxes do not overlap.

MEI test data:

<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="https://music-encoding.org/schema/4.0.0/mei-all.rng" type="application/xml" schematypens="http://relaxng.org/ns/structure/1.0"?>
<?xml-model href="https://music-encoding.org/schema/4.0.0/mei-all.rng" type="application/xml" schematypens="http://purl.oclc.org/dsdl/schematron"?>
<mei xmlns="http://www.music-encoding.org/ns/mei" meiversion="4.0.0">
 <meiHead>
  <fileDesc>
   <titleStmt>
    <title />
   </titleStmt>
   <pubStmt />
  </fileDesc>
  <encodingDesc>
   <appInfo>
    <application isodate="2021-05-30T11:25:47" version="3.5.0-dev-488626e-dirty">
     <name>Verovio</name>
     <p>Transcoded from Humdrum</p>
    </application>
   </appInfo>
  </encodingDesc>
  <workList>
   <work>
    <title />
   </work>
  </workList>
 </meiHead>
 <music>
  <body>
   <mdiv xml:id="mdiv-0000000898930398">
    <score xml:id="score-0000001417309045">
     <scoreDef xml:id="scoredef-0000000071155701" midi.bpm="400">
      <staffGrp xml:id="staffgrp-0000001372785383">
       <staffDef xml:id="staffdef-0000001821370244" n="1" lines="5">
        <clef xml:id="clef-0000000240569369" 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-0000002103886421" n="1">
        <layer xml:id="layer-L1F1N1" n="1">
         <note xml:id="note-L4F1" dur="1" oct="4" pname="c" accid.ges="n" />
        </layer>
       </staff>
      </measure>
      <scoreDef xml:id="scoredef-0000001006888016">
       <staffGrp xml:id="staffgrp-0000001837181126">
        <staffDef xml:id="staffdef-0000001113488198" n="1">
         <meterSig xml:id="msig-0000000360644189" count="6" unit="8" />
        </staffDef>
       </staffGrp>
      </scoreDef>
      <measure xml:id="measure-L5" n="2">
       <staff xml:id="staff-L5F1N1" n="1">
        <layer xml:id="layer-L5F1N1" n="1">
         <note xml:id="note-L7F1" dots="1" dur="2" oct="4" pname="c" accid.ges="n" />
        </layer>
       </staff>
      </measure>
      <scoreDef xml:id="scoredef-0000000591486082">
       <staffGrp xml:id="staffgrp-0000000847858237">
        <staffDef xml:id="staffdef-0000000372950526" n="1">
         <meterSig xml:id="msig-0000002131498803" count="3" unit="16" />
        </staffDef>
       </staffGrp>
      </scoreDef>
      <measure xml:id="measure-L8" right="end" n="3">
       <staff xml:id="staff-L8F1N1" n="1">
        <layer xml:id="layer-L8F1N1" n="1">
         <note xml:id="note-L10F1" dots="1" dur="8" oct="4" pname="c" accid.ges="n" />
        </layer>
       </staff>
      </measure>
     </section>
    </score>
   </mdiv>
  </body>
 </music>
</mei>