Browse Source

fix(VexFlowMusicSheetCalculator): fix vexflow formatting error caused by align_rests = true

fix(demo): readd downbow and delayed ornaments to function test
remove misleading comments from calculateMeasureWidthFromLyrics (merge d1e9e23)
sschmidTU 6 years ago
parent
commit
4fa7b4eb06

+ 7 - 6
src/MusicalScore/Graphical/VexFlow/VexFlowMusicSheetCalculator.ts

@@ -123,11 +123,14 @@ export class VexFlowMusicSheetCalculator extends MusicSheetCalculator {
             const vexflowMeasure: VexFlowMeasure = (measure as VexFlowMeasure);
             // prepare format function for voices, will be called later for formatting measure again
             vexflowMeasure.formatVoices = (w: number) => {
-              formatter.format(allVoices, w, {
-                align_rests: true,
-          });
+              formatter.format(allVoices, w);
+              // formatter.format(allVoices, w, {
+              //   align_rests: false, // TODO
+              //   // align_rests = true causes a Vexflow Exception for Mozart - An Chloe
+              //   // align_rests = false still aligns rests with beams according to Vexflow, but doesn't seem to do anything
+              // });
             };
-            // format now for minimum width
+            // format now for minimum width, calculateMeasureWidthFromLyrics later
             vexflowMeasure.formatVoices(minStaffEntriesWidth * unitInPixels);
           } else {
             (measure as VexFlowMeasure).formatVoices = undefined;
@@ -216,13 +219,11 @@ export class VexFlowMusicSheetCalculator extends MusicSheetCalculator {
             measureNumber: measure.MeasureNumber,
             staffEntryXPosition: staffEntryXPosition,
             text: lyricsEntry.GetLyricsEntry.Text,
-            // lyricExtend: lyricExtend
           };
         }
       }
     }
     return oldMinimumStaffEntriesWidth * elongationFactorMeasureWidth;
-    // calculateMeasureWidthFromLyrics is called afterwards from MusicSheetCalculator
   }
 
   protected createGraphicalTie(tie: Tie, startGse: GraphicalStaffEntry, endGse: GraphicalStaffEntry,

+ 10 - 1
test/data/OSMD_function_test_all.xml

@@ -258,7 +258,7 @@
         <stem>down</stem>
         <notations>
           <ornaments>
-            <turn/>
+            <delayed-turn/>
             </ornaments>
           </notations>
         <lyric number="1" default-x="6.94" default-y="-80.00">
@@ -297,6 +297,11 @@
         <type>quarter</type>
         <dot/>
         <stem>up</stem>
+	<notations>
+	  <ornaments>
+	    <delayed-turn/>
+	    </ornaments>
+	  </notations>
         </note>
       <note default-x="341.71" default-y="-35.00">
         <pitch>
@@ -426,6 +431,10 @@
             <down-bow/>
             </technical>
           </notations>
+	<lyric number="1" default-x="6.58" default-y="-80.00">
+          <syllabic>single</syllabic>
+          <text>Downbow</text>
+          </lyric>
         </note>
       <note default-x="213.64" default-y="-5.00">
         <pitch>