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
687 stars 185 forks source link

Issues with xml:id #2103

Closed rettinghaus closed 3 years ago

rettinghaus commented 3 years ago

I noticed two things with xml:ids:

  1. You'll never get a stable id for scoreDef with --xml-id-seed. scoreDef seems to be generated before the generator is seeded.
  2. --remove-ids actually doesn't remove ids that were needed for alignment of some elements during rendering, e.g. syllables or fermata markup (try following file).
<?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>ID removals</title>
         </titleStmt>
         <pubStmt>
            <respStmt>
               <persName>Klaus Rettinghaus</persName>
            </respStmt>
            <date>2021-03-17</date>
         </pubStmt>
      </fileDesc>
   </meiHead>
   <music>
      <body>
         <mdiv>
            <score>
               <scoreDef>
                  <staffGrp>
                     <staffDef n="1" lines="5" clef.shape="G" clef.line="2" />
                  </staffGrp>
               </scoreDef>
               <section>
                  <measure>
                     <staff n="1">
                        <layer n="1">
                           <note dur="4" oct="4" pname="g" />
                           <note dur="4" oct="4" pname="g">
                              <artic artic="ten" />
                           </note>
                           <note dur="4" fermata="above" oct="4" pname="g" />
                           <note dur="4" oct="4" pname="g">
                              <verse>
                                 <syl>wrong</syl>
                              </verse>
                           </note>
                        </layer>
                     </staff>
                  </measure>
               </section>
            </score>
         </mdiv>
      </body>
   </music>
</mei>
lpugin commented 3 years ago
  1. The problem is because the document scoreDef is allocated on the stack when the toolkit document is created. Allocating it on the heap will be the only way to fix this. I am not sure this is worth the effort.
  2. I would be in favour of discarding completely the support for analytical markup ;-) but if you want to fix this issue you are welcome
rettinghaus commented 3 years ago
  1. I agree, let's leave it like it is.
  2. I would propose to ignore analytical markup by default, and have an option to convert them for rendering (like it is done now with articulation). Then we had a more consistent behavior.
lpugin commented 3 years ago

As less drastic step would be to make the conversion to standard markup being preserved by default. Basically changing this https://github.com/rism-digital/verovio/blob/a059e398be6a2053d33ac6bcc626887bbe15aa0a/include/vrv/doc.h#L325 default value. This would also solve the issue of consistency.

As you can see, the idea was to have a parameter for this but nobody ever expressed the need for it so it was not added. We could add one for users who do want to preserve analytical markup as is.

rettinghaus commented 3 years ago

Sounds reasonable.

lpugin commented 3 years ago

Let's call it --preserve-analytical-markup