Quellcode durchsuchen

add EngravingRule UseJustifiedBuilder (#59)

sschmidTU vor 3 Jahren
Ursprung
Commit
76888f3d9f

+ 2 - 0
src/MusicalScore/Graphical/EngravingRules.ts

@@ -324,6 +324,7 @@ export class EngravingRules {
     public StringNumberOffsetY: number;
     public NewSystemAtXMLNewSystemAttribute: boolean;
     public NewPageAtXMLNewPageAttribute: boolean;
+    public UseJustifiedBuilder: boolean;
     public PageFormat: PageFormat;
     public PageBackgroundColor: string; // vexflow-color-string (#FFFFFF). Default undefined/transparent.
     public PerformanceMode: boolean;
@@ -668,6 +669,7 @@ export class EngravingRules {
 
         EngravingRules.FixStafflineBoundingBox = false; // TODO temporary workaround
 
+        this.UseJustifiedBuilder = true;
         this.PageFormat = PageFormat.UndefinedPageFormat; // default: undefined / 'infinite' height page, using the canvas'/container's width and height
         this.PageBackgroundColor = undefined; // default: transparent. half-transparent white: #FFFFFF88"
         this.PerformanceMode = false;

+ 3 - 1
src/MusicalScore/Graphical/MusicSheetCalculator.ts

@@ -828,7 +828,9 @@ export abstract class MusicSheetCalculator {
         // build the MusicSystems
         let musicSystemBuilder: MusicSystemBuilder;
         const measureCount: number = allMeasures.length;
-        if (measureCount === 1 || this.rules.RenderSingleHorizontalStaffline) {
+        if (!this.rules.UseJustifiedBuilder ||
+            measureCount === 1 ||
+            this.rules.RenderSingleHorizontalStaffline) {
             musicSystemBuilder = new MusicSystemBuilder();
             // JustifiedMusicSystemBuilder makes measures way too large with
             //   only one measure or RenderSingleHorizontalStaffline.