12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133 |
- import { PagePlacementEnum } from "./GraphicalMusicPage";
- import log from "loglevel";
- import { TextAlignmentEnum } from "../../Common/Enums/TextAlignment";
- import { PlacementEnum } from "../VoiceData/Expressions/AbstractExpression";
- import {
- AutoBeamOptions,
- AlignRestOption,
- FillEmptyMeasuresWithWholeRests,
- SkyBottomLineBatchCalculatorBackendType
- } from "../../OpenSheetMusicDisplay/OSMDOptions";
- import { ColoringModes as ColoringMode } from "./DrawingParameters";
- import { Dictionary } from "typescript-collections";
- import { FontStyles } from "../../Common/Enums";
- import { NoteEnum, AccidentalEnum } from "../../Common/DataObjects/Pitch";
- import { ChordSymbolEnum, CustomChord, DegreesInfo } from "../../MusicalScore/VoiceData/ChordSymbolContainer";
- import { GraphicalNote } from "./GraphicalNote";
- import { Note } from "../VoiceData/Note";
- export class EngravingRules {
-
- public static unit: number = 1.0;
- public SamplingUnit: number;
- public StaccatoShorteningFactor: number;
-
- public SheetTitleHeight: number;
- public SheetSubtitleHeight: number;
- public SheetMinimumDistanceBetweenTitleAndSubtitle: number;
- public SheetComposerHeight: number;
- public SheetAuthorHeight: number;
- public SheetCopyrightHeight: number;
- public SheetCopyrightMargin: number;
- public CompactMode: boolean;
- public PagePlacementEnum: PagePlacementEnum;
- public PageHeight: number;
- public PageTopMargin: number;
- public PageTopMarginNarrow: number;
- public PageBottomMargin: number;
- public PageLeftMargin: number;
- public PageRightMargin: number;
- public TitleTopDistance: number;
- public TitleBottomDistance: number;
- public SystemLeftMargin: number;
- public SystemRightMargin: number;
- public SystemLabelsRightMargin: number;
- public SystemComposerDistance: number;
- public InstrumentLabelTextHeight: number;
- public MinimumDistanceBetweenSystems: number;
- public MinSkyBottomDistBetweenSystems: number;
- public LastSystemMaxScalingFactor: number;
- public StaffDistance: number;
- public BetweenStaffDistance: number;
- public StaffHeight: number;
- public TabStaffInterlineHeight: number;
- public BetweenStaffLinesDistance: number;
-
- public AutoBeamNotes: boolean;
-
- public AutoBeamOptions: AutoBeamOptions;
- public AutoBeamTabs: boolean;
- public BeamWidth: number;
- public BeamSpaceWidth: number;
- public BeamForwardLength: number;
- public FlatBeams: boolean;
- public FlatBeamOffset: number;
- public FlatBeamOffsetPerBeam: number;
- public ClefLeftMargin: number;
- public ClefRightMargin: number;
-
- public PercussionOneLineCutoff: number;
- public PercussionForceVoicesOneLineCutoff: number;
- public PercussionUseXMLDisplayStep: boolean;
- public PercussionXMLDisplayStepNoteValueShift: number;
- public PercussionOneLineXMLDisplayStepOctaveOffset: number;
-
- public PercussionUseCajon2NoteSystem: boolean;
- public BetweenKeySymbolsDistance: number;
- public KeyRightMargin: number;
- public RhythmRightMargin: number;
- public ShowRhythmAgainAfterPartEndOrFinalBarline: boolean;
- public NewPartAndSystemAfterFinalBarline: boolean;
- public InStaffClefScalingFactor: number;
- public DistanceBetweenNaturalAndSymbolWhenCancelling: number;
- public NoteHelperLinesOffset: number;
- public MeasureLeftMargin: number;
- public MeasureRightMargin: number;
- public DistanceBetweenLastInstructionAndRepetitionBarline: number;
- public ArpeggioDistance: number;
- public IdealStemLength: number;
- public StemNoteHeadBorderYOffset: number;
- public StemWidth: number;
- public StemMargin: number;
- public StemMinLength: number;
- public StemMaxLength: number;
- public BeamSlopeMaxAngle: number;
- public StemMinAllowedDistanceBetweenNoteHeadAndBeamLine: number;
- public SetWantedStemDirectionByXml: boolean;
- public GraceNoteScalingFactor: number;
- public GraceNoteXOffset: number;
- public GraceNoteGroupXMargin: number;
- public WedgeOpeningLength: number;
- public WedgeMeasureEndOpeningLength: number;
- public WedgeMeasureBeginOpeningLength: number;
- public WedgePlacementAboveY: number;
- public WedgePlacementBelowY: number;
- public WedgeHorizontalMargin: number;
- public WedgeVerticalMargin: number;
- public DistanceOffsetBetweenTwoHorizontallyCrossedWedges: number;
- public WedgeMinLength: number;
- public WedgeEndDistanceBetweenTimestampsFactor: number;
- public SoftAccentWedgePadding: number;
- public SoftAccentSizeFactor: number;
- public DistanceBetweenAdjacentDynamics: number;
- public TempoChangeMeasureValidity: number;
- public TempoContinousFactor: number;
- public StaccatoScalingFactor: number;
- public BetweenDotsDistance: number;
- public OrnamentAccidentalScalingFactor: number;
- public ChordSymbolTextHeight: number;
- public ChordSymbolTextAlignment: TextAlignmentEnum;
- public ChordSymbolRelativeXOffset: number;
-
- public ChordSymbolExtraXShiftForShortChordSymbols: number;
-
- public ChordSymbolExtraXShiftWidthThreshold: number;
- public ChordSymbolXSpacing: number;
- public ChordOverlapAllowedIntoNextMeasure: number;
- public ChordSymbolYOffset: number;
- public ChordSymbolYPadding: number;
- public ChordSymbolYAlignment: boolean;
- public ChordSymbolYAlignmentScope: string;
-
- public ChordSymbolWholeMeasureRestXOffset: number;
- public ChordSymbolWholeMeasureRestXOffsetMeasure1: number;
- public ChordSymbolLabelTexts: Dictionary<ChordSymbolEnum, string>;
- public ChordAccidentalTexts: Dictionary<AccidentalEnum, string>;
- public CustomChords: CustomChord[];
-
- public RepetitionSymbolsYOffset: number;
-
- public RepetitionEndInstructionXShiftAsPercentOfStaveWidth: number;
- public RehearsalMarkXOffset: number;
- public RehearsalMarkXOffsetDefault: number;
- public RehearsalMarkXOffsetSystemStartMeasure: number;
- public RehearsalMarkYOffset: number;
- public RehearsalMarkYOffsetDefault: number;
- public RehearsalMarkFontSize: number;
- public MeasureNumberLabelHeight: number;
- public MeasureNumberLabelOffset: number;
- public MeasureNumberLabelXOffset: number;
-
- public TupletsRatioed: boolean;
-
- public TupletsBracketed: boolean;
-
- public TripletsBracketed: boolean;
-
- public TupletsBracketedUseXMLValue: boolean;
- public TupletNumberLabelHeight: number;
- public TupletNumberYOffset: number;
- public TupletNumberLimitConsecutiveRepetitions: boolean;
- public TupletNumberMaxConsecutiveRepetitions: number;
- public TupletNumberAlwaysDisableAfterFirstMax: boolean;
- public LabelMarginBorderFactor: number;
- public TupletVerticalLineLength: number;
- public TupletNumbersInTabs: boolean;
- public TabBeamsRendered: boolean;
- public RepetitionAllowFirstMeasureBeginningRepeatBarline: boolean;
- public RepetitionEndingLabelHeight: number;
- public RepetitionEndingLabelXOffset: number;
- public RepetitionEndingLabelYOffset: number;
- public RepetitionEndingLineYLowerOffset: number;
- public RepetitionEndingLineYUpperOffset: number;
- public VoltaOffset: number;
-
- public LyricsAlignmentStandard: TextAlignmentEnum;
- public LyricsHeight: number;
- public LyricsYOffsetToStaffHeight: number;
- public LyricsYMarginToBottomLine: number;
-
- public LyricsExtraXShiftForShortLyrics: number;
-
- public LyricsExtraXShiftForShortLyricsWidthThreshold: number;
-
- public LyricsUseXPaddingForShortNotes: boolean;
-
- public LyricsXPaddingFactorForLongLyrics: number;
-
- public LyricsXPaddingWidthThreshold: number;
- public VerticalBetweenLyricsDistance: number;
- public HorizontalBetweenLyricsDistance: number;
- public BetweenSyllableMaximumDistance: number;
- public BetweenSyllableMinimumDistance: number;
- public LyricOverlapAllowedIntoNextMeasure: number;
- public MinimumDistanceBetweenDashes: number;
- public MaximumLyricsElongationFactor: number;
- public SlurPlacementFromXML: boolean;
- public SlurPlacementAtStems: boolean;
- public SlurPlacementUseSkyBottomLine: boolean;
- public BezierCurveStepSize: number;
- public TPower3: number[];
- public OneMinusTPower3: number[];
- public FactorOne: number[];
- public FactorTwo: number[];
- public TieGhostObjectWidth: number;
- public TieYPositionOffsetFactor: number;
- public MinimumNeededXspaceForTieGhostObject: number;
- public TieHeightMinimum: number;
- public TieHeightMaximum: number;
- public TieHeightInterpolationK: number;
- public TieHeightInterpolationD: number;
- public SlurNoteHeadYOffset: number;
- public SlurEndArticulationYOffset: number;
- public SlurStartArticulationYOffsetOfArticulation: number;
- public SlurStemXOffset: number;
- public SlurSlopeMaxAngle: number;
- public SlurTangentMinAngle: number;
- public SlurTangentMaxAngle: number;
- public SlurHeightFactor: number;
- public SlurHeightFlattenLongSlursFactorByWidth: number;
- public SlurHeightFlattenLongSlursFactorByAngle: number;
- public SlurHeightFlattenLongSlursCutoffAngle: number;
- public SlurHeightFlattenLongSlursCutoffWidth: number;
- public SlursStartingAtSameStaffEntryYOffset: number;
- public SlurMaximumYControlPointDistance: number;
- public GlissandoNoteOffset: number;
- public GlissandoStafflineStartMinimumWidth: number;
- public GlissandoStafflineStartYDistanceToNote: number;
- public GlissandoStafflineEndOffset: number;
- public GlissandoDefaultWidth: number;
- public TempoYSpacing: number;
- public InstantaneousTempoTextHeight: number;
- public ContinuousDynamicTextHeight: number;
- public MoodTextHeight: number;
- public UnknownTextHeight: number;
- public ContinuousTempoTextHeight: number;
- public VexFlowDefaultNotationFontScale: number;
- public VexFlowDefaultTabFontScale: number;
- public TremoloStrokeScale: number;
- public TremoloYSpacingScale: number;
- public TremoloBuzzRollThickness: number;
- public StaffLineWidth: number;
- public StaffLineColor: string;
- public LedgerLineWidth: number;
- public LedgerLineStrokeStyle: string;
- public LedgerLineColorDefault: string;
- public WedgeLineWidth: number;
- public TupletLineWidth: number;
- public LyricUnderscoreLineWidth: number;
- public SystemThinLineWidth: number;
- public SystemBoldLineWidth: number;
- public SystemRepetitionEndingLineWidth: number;
- public SystemDotWidth: number;
- public MultipleRestMeasureDefaultWidth: number;
- public MultipleRestMeasureAddKeySignature: boolean;
-
- public FixedMeasureWidth: boolean;
-
- public FixedMeasureWidthFixedValue: number;
- public FixedMeasureWidthUseForPickupMeasures: boolean;
- public DistanceBetweenVerticalSystemLines: number;
- public DistanceBetweenDotAndLine: number;
- public RepeatEndStartPadding: number;
- public OctaveShiftLineWidth: number;
- public OctaveShiftVerticalLineLength: number;
- public OctaveShiftOnWholeMeasureNoteUntilEndOfMeasure: boolean;
- public GraceLineWidth: number;
- public MinimumStaffLineDistance: number;
- public MinSkyBottomDistBetweenStaves: number;
- public MinimumCrossedBeamDifferenceMargin: number;
-
- public SheetMaximumWidth: number;
- public VoiceSpacingMultiplierVexflow: number;
- public VoiceSpacingAddendVexflow: number;
- public PickupMeasureWidthMultiplier: number;
-
- public PickupMeasureRepetitionSpacing: number;
-
- public PickupMeasureSpacingSingleNoteAddend: number;
- public DisplacedNoteMargin: number;
- public MinNoteDistance: number;
- public SubMeasureXSpacingThreshold: number;
- public MeasureDynamicsMaxScalingFactor: number;
- public WholeRestXShiftVexflow: number;
- public MetronomeMarksDrawn: boolean;
- public MetronomeMarkXShift: number;
- public MetronomeMarkYShift: number;
- public SoftmaxFactorVexFlow: number;
-
- public StaggerSameWholeNotes: boolean;
- public MaxInstructionsConstValue: number;
- public NoteDistances: number[] = [1.0, 1.0, 1.3, 1.6, 2.0, 2.5, 3.0, 4.0];
- public NoteDistancesScalingFactors: number[] = [1.0, 2.0, 4.0, 8.0, 16.0, 32.0, 64.0, 128.0];
- public DurationDistanceDict: {[_: number]: number } = {};
- public DurationScalingDistanceDict: {[_: number]: number } = {};
-
- public AlignRests: AlignRestOption;
- public RestCollisionYPadding: number;
- public FillEmptyMeasuresWithWholeRest: FillEmptyMeasuresWithWholeRests | number;
- public ArpeggiosGoAcrossVoices: boolean;
- public RenderArpeggios: boolean;
- public RenderSlurs: boolean;
- public RenderGlissandi: boolean;
- public ColoringMode: ColoringMode;
- public ColoringEnabled: boolean;
- public ColorStemsLikeNoteheads: boolean;
- public ColorFlags: boolean;
- public ColorBeams: boolean;
- public ColoringSetCurrent: Dictionary<NoteEnum|number, string>;
-
- public DefaultColorMusic: string;
- public DefaultColorNotehead: string;
- public DefaultColorRest: string;
- public DefaultColorStem: string;
- public DefaultColorLabel: string;
- public DefaultColorLyrics: string;
- public DefaultColorChordSymbol: string;
- public DefaultColorTitle: string;
- public DefaultColorCursor: string;
- public DefaultFontFamily: string;
- public DefaultFontStyle: FontStyles;
- public DefaultVexFlowNoteFont: string;
- public MaxMeasureToDrawIndex: number;
- public MinMeasureToDrawIndex: number;
- public MaxPageToDrawNumber: number;
- public MaxSystemToDrawNumber: number;
-
- public RenderComposer: boolean;
- public RenderTitle: boolean;
- public RenderSubtitle: boolean;
- public RenderLyricist: boolean;
- public RenderCopyright: boolean;
- public RenderPartNames: boolean;
- public RenderPartAbbreviations: boolean;
- public RenderFingerings: boolean;
- public RenderMeasureNumbers: boolean;
- public RenderMeasureNumbersOnlyAtSystemStart: boolean;
- public UseXMLMeasureNumbers: boolean;
- public RenderLyrics: boolean;
- public RenderChordSymbols: boolean;
- public RenderMultipleRestMeasures: boolean;
- public AutoGenerateMultipleRestMeasuresFromRestMeasures: boolean;
- public RenderRehearsalMarks: boolean;
- public RenderClefsAtBeginningOfStaffline: boolean;
- public RenderKeySignatures: boolean;
- public RenderTimeSignatures: boolean;
- public RenderPedals: boolean;
- public DynamicExpressionMaxDistance: number;
- public DynamicExpressionSpacer: number;
- public IgnoreRepeatedDynamics: boolean;
- public MpatMode: boolean;
- public ArticulationPlacementFromXML: boolean;
-
- public BreathMarkDistance: number;
-
- public FingeringPosition: PlacementEnum;
- public FingeringPositionFromXML: boolean;
- public FingeringPositionGrace: PlacementEnum;
- public FingeringInsideStafflines: boolean;
- public FingeringLabelFontHeight: number;
- public FingeringOffsetX: number;
- public FingeringOffsetY: number;
- public FingeringPaddingY: number;
- public FingeringTextSize: number;
-
- public RenderStringNumbersClassical: boolean;
-
- public StringNumberOffsetY: number;
- public NewSystemAtXMLNewSystemAttribute: boolean;
-
- public NewSystemAtXMLNewPageAttribute: boolean;
- public NewPageAtXMLNewPageAttribute: boolean;
- public UseJustifiedBuilder: boolean;
- public PageFormat: PageFormat;
- public PageBackgroundColor: string;
- public PerformanceMode: boolean;
- public RenderSingleHorizontalStaffline: boolean;
- public RestoreCursorAfterRerender: boolean;
- public StretchLastSystemLine: boolean;
-
- public IgnoreBracketsWords: boolean;
- public PlaceWordsInsideStafflineFromXml: boolean;
- public PlaceWordsInsideStafflineYOffset: number;
-
- public SpacingBetweenTextLines: number;
- public NoteToGraphicalNoteMap: Dictionary<number, GraphicalNote>;
-
- public NoteToGraphicalNoteMapObjectCount: number = 0;
-
- public RenderCount: number = 0;
-
- public PreferredSkyBottomLineBatchCalculatorBackend: SkyBottomLineBatchCalculatorBackendType;
-
- public DisableWebGLInFirefox: boolean;
-
- public DisableWebGLInSafariAndIOS: boolean;
-
- public SkyBottomLineBatchMinMeasures: number;
-
- public SkyBottomLineWebGLMinMeasures: number;
-
- public AlwaysSetPreferredSkyBottomLineBackendAutomatically: boolean;
-
- public PlayAlreadyStartedNotesFromCursorPosition: boolean = false;
-
- public PlaybackSkipNotesSafetyInterval: number = 0.02;
-
- public UseDefaultVoiceInteractionListener: boolean = true;
- public LimitCursorPositionToCurrentMeasure: boolean = true;
- constructor() {
- this.loadDefaultValues();
- }
- public loadDefaultValues(): void {
-
- this.SamplingUnit = EngravingRules.unit * 3;
-
- this.MpatMode = true;
-
- this.SheetTitleHeight = 4.0;
- this.SheetSubtitleHeight = 2.0;
- this.SheetMinimumDistanceBetweenTitleAndSubtitle = 1.0;
- this.SheetComposerHeight = 2.0;
- this.SheetAuthorHeight = 2.0;
- this.SheetCopyrightHeight = 1.5;
- this.SheetCopyrightMargin = 2.0;
-
- this.CompactMode = false;
- this.PagePlacementEnum = PagePlacementEnum.Down;
- this.PageHeight = 100001.0;
- this.PageTopMargin = 5.0;
- this.PageTopMarginNarrow = 0.0;
- this.PageBottomMargin = 5.0;
- this.PageLeftMargin = 5.0;
- this.PageRightMargin = 5.0;
- this.TitleTopDistance = 5.0;
- this.TitleBottomDistance = 1.0;
- this.StaffDistance = 7.0;
- this.BetweenStaffDistance = 5.0;
- this.MinimumStaffLineDistance = 4.0;
- this.MinSkyBottomDistBetweenStaves = 1.0;
-
- this.StaffHeight = 4.0;
- this.TabStaffInterlineHeight = 1.1111;
- this.BetweenStaffLinesDistance = EngravingRules.unit;
- this.SystemLeftMargin = 0.0;
- this.SystemRightMargin = 0.0;
- this.SystemLabelsRightMargin = 2.0;
- this.SystemComposerDistance = 2.0;
- this.InstrumentLabelTextHeight = 2;
- this.MinimumDistanceBetweenSystems = 7.0;
- this.MinSkyBottomDistBetweenSystems = 5.0;
- this.LastSystemMaxScalingFactor = 1.4;
-
- this.AutoBeamNotes = false;
- this.AutoBeamOptions = {
- beam_middle_rests_only: false,
- beam_rests: false,
- maintain_stem_directions: false
- };
- this.AutoBeamTabs = false;
-
- this.BeamWidth = EngravingRules.unit / 2.0;
- this.BeamSpaceWidth = EngravingRules.unit / 3.0;
- this.BeamForwardLength = 1.25 * EngravingRules.unit;
- this.FlatBeams = false;
- this.FlatBeamOffset = 20;
- this.FlatBeamOffsetPerBeam = 10;
-
- this.ClefLeftMargin = 0.5;
- this.ClefRightMargin = 0.75;
- this.PercussionOneLineCutoff = 3;
- this.PercussionForceVoicesOneLineCutoff = 1;
- this.PercussionUseXMLDisplayStep = true;
- this.PercussionXMLDisplayStepNoteValueShift = 0;
- this.PercussionOneLineXMLDisplayStepOctaveOffset = 0;
- this.PercussionUseCajon2NoteSystem = false;
- this.BetweenKeySymbolsDistance = 0.2;
- this.KeyRightMargin = 0.75;
- this.RhythmRightMargin = 1.25;
- this.ShowRhythmAgainAfterPartEndOrFinalBarline = true;
- this.NewPartAndSystemAfterFinalBarline = false;
- this.InStaffClefScalingFactor = 0.8;
- this.DistanceBetweenNaturalAndSymbolWhenCancelling = 0.4;
-
- this.NoteHelperLinesOffset = 0.25;
- this.MeasureLeftMargin = 0.7;
- this.MeasureRightMargin = 0.0;
- this.DistanceBetweenLastInstructionAndRepetitionBarline = 1.0;
- this.ArpeggioDistance = 0.6;
-
- this.StaccatoShorteningFactor = 2;
- this.IdealStemLength = 3.0;
- this.StemNoteHeadBorderYOffset = 0.2;
- this.StemMargin = 0.2;
- this.StemMinLength = 2.5;
- this.StemMaxLength = 4.5;
- this.BeamSlopeMaxAngle = 10.0;
- this.StemMinAllowedDistanceBetweenNoteHeadAndBeamLine = 1.0;
- this.SetWantedStemDirectionByXml = true;
-
-
- this.GraceNoteScalingFactor = 0.6;
- this.GraceNoteXOffset = 0.2;
- this.GraceNoteGroupXMargin = 0.0;
-
-
- this.WedgeOpeningLength = 1.2;
- this.WedgeMeasureEndOpeningLength = 0.75;
- this.WedgeMeasureBeginOpeningLength = 0.75;
- this.WedgePlacementAboveY = -1.5;
- this.WedgePlacementBelowY = 1.5;
- this.WedgeHorizontalMargin = 0.6;
- this.WedgeVerticalMargin = 0.5;
- this.DistanceOffsetBetweenTwoHorizontallyCrossedWedges = 0.3;
- this.WedgeMinLength = 2.0;
- this.WedgeEndDistanceBetweenTimestampsFactor = 1.75;
- this.SoftAccentWedgePadding = 0.4;
- this.SoftAccentSizeFactor = 0.6;
- this.DistanceBetweenAdjacentDynamics = 0.75;
-
- this.TempoChangeMeasureValidity = 4;
- this.TempoContinousFactor = 0.7;
-
- this.StaccatoScalingFactor = 0.8;
- this.BetweenDotsDistance = 0.8;
- this.OrnamentAccidentalScalingFactor = 0.65;
- this.ChordSymbolTextHeight = 2.0;
- this.ChordSymbolTextAlignment = TextAlignmentEnum.LeftBottom;
- this.ChordSymbolRelativeXOffset = -1.0;
- this.ChordSymbolExtraXShiftForShortChordSymbols = 0.3;
- this.ChordSymbolExtraXShiftWidthThreshold = 2.0;
- this.ChordSymbolXSpacing = 1.0;
- this.ChordOverlapAllowedIntoNextMeasure = 0;
- this.ChordSymbolYOffset = 0.1;
- this.ChordSymbolYPadding = 0.0;
- this.ChordSymbolYAlignment = true;
- this.ChordSymbolYAlignmentScope = "staffline";
- this.ChordSymbolWholeMeasureRestXOffset = 0;
- this.ChordSymbolWholeMeasureRestXOffsetMeasure1 = -2.0;
- this.ChordAccidentalTexts = new Dictionary<AccidentalEnum, string>();
- this.resetChordAccidentalTexts(this.ChordAccidentalTexts, false);
- this.ChordSymbolLabelTexts = new Dictionary<ChordSymbolEnum, string>();
- this.resetChordSymbolLabelTexts(this.ChordSymbolLabelTexts);
- this.CustomChords = [];
- this.resetChordNames();
- this.RepetitionSymbolsYOffset = 0;
- this.RepetitionEndInstructionXShiftAsPercentOfStaveWidth = 0.4;
- this.RehearsalMarkXOffsetDefault = 10;
- this.RehearsalMarkXOffset = 0;
- this.RehearsalMarkXOffsetSystemStartMeasure = -20;
- this.RehearsalMarkYOffsetDefault = -15;
- this.RehearsalMarkYOffset = 0;
- this.RehearsalMarkFontSize = 10;
-
- this.MeasureNumberLabelHeight = 1.5 * EngravingRules.unit;
- this.MeasureNumberLabelOffset = 2;
- this.MeasureNumberLabelXOffset = -0.5;
- this.TupletsRatioed = false;
- this.TupletsBracketed = false;
- this.TripletsBracketed = false;
- this.TupletsBracketedUseXMLValue = true;
- this.TupletNumberLabelHeight = 1.5 * EngravingRules.unit;
- this.TupletNumberYOffset = 0.5;
- this.TupletNumberLimitConsecutiveRepetitions = true;
- this.TupletNumberMaxConsecutiveRepetitions = 2;
- this.TupletNumberAlwaysDisableAfterFirstMax = true;
- this.LabelMarginBorderFactor = 0.1;
- this.TupletVerticalLineLength = 0.5;
- this.TupletNumbersInTabs = false;
- this.TabBeamsRendered = true;
-
- this.SlurPlacementFromXML = true;
- this.SlurPlacementAtStems = false;
- this.SlurPlacementUseSkyBottomLine = false;
- this.BezierCurveStepSize = 1000;
- this.calculateCurveParametersArrays();
- this.TieGhostObjectWidth = 0.75;
- this.TieYPositionOffsetFactor = 0.3;
- this.MinimumNeededXspaceForTieGhostObject = 1.0;
- this.TieHeightMinimum = 0.28;
- this.TieHeightMaximum = 1.2;
- this.TieHeightInterpolationK = 0.0288;
- this.TieHeightInterpolationD = 0.136;
- this.SlurNoteHeadYOffset = 0.5;
- this.SlurEndArticulationYOffset = 0.8;
- this.SlurStartArticulationYOffsetOfArticulation = 0.5;
- this.SlurStemXOffset = 0.3;
- this.SlurSlopeMaxAngle = 15.0;
- this.SlurTangentMinAngle = 30.0;
- this.SlurTangentMaxAngle = 80.0;
- this.SlurHeightFactor = 1;
- this.SlurHeightFlattenLongSlursFactorByWidth = 0.24;
- this.SlurHeightFlattenLongSlursFactorByAngle = 0.36;
- this.SlurHeightFlattenLongSlursCutoffAngle = 47;
- this.SlurHeightFlattenLongSlursCutoffWidth = 16;
- this.SlursStartingAtSameStaffEntryYOffset = 0.8;
-
- this.SlurMaximumYControlPointDistance = undefined;
-
- this.GlissandoNoteOffset = 0.5;
- this.GlissandoStafflineStartMinimumWidth = 1;
- this.GlissandoStafflineStartYDistanceToNote = 0.8;
- this.GlissandoStafflineEndOffset = 1;
- this.GlissandoDefaultWidth = 0.1;
-
- this.RepetitionAllowFirstMeasureBeginningRepeatBarline = false;
- this.RepetitionEndingLabelHeight = 2.0;
- this.RepetitionEndingLabelXOffset = 0.5;
- this.RepetitionEndingLabelYOffset = 0.3;
- this.RepetitionEndingLineYLowerOffset = 0.5;
- this.RepetitionEndingLineYUpperOffset = 0.3;
- this.VoltaOffset = 2.5;
-
- this.LyricsAlignmentStandard = TextAlignmentEnum.LeftBottom;
- this.LyricsHeight = 2.0;
- this.LyricsYOffsetToStaffHeight = 0.0;
- this.LyricsYMarginToBottomLine = 0.2;
- this.LyricsExtraXShiftForShortLyrics = 0.5;
- this.LyricsExtraXShiftForShortLyricsWidthThreshold = 1.4;
- this.LyricsUseXPaddingForShortNotes = true;
- this.LyricsXPaddingFactorForLongLyrics = 0.8;
- this.LyricsXPaddingWidthThreshold = 3.3;
- this.VerticalBetweenLyricsDistance = 0.5;
- this.HorizontalBetweenLyricsDistance = 0.2;
- this.BetweenSyllableMaximumDistance = 10.0;
- this.BetweenSyllableMinimumDistance = 0.5;
- this.LyricOverlapAllowedIntoNextMeasure = 3.4;
- this.MinimumDistanceBetweenDashes = 10;
- this.MaximumLyricsElongationFactor = 2.5;
-
- this.TempoYSpacing = 0.5;
- this.InstantaneousTempoTextHeight = 2.3;
- this.ContinuousDynamicTextHeight = 2.3;
- this.MoodTextHeight = 2.3;
- this.UnknownTextHeight = 2.0;
- this.ContinuousTempoTextHeight = 2.3;
- this.DynamicExpressionMaxDistance = 2;
- this.DynamicExpressionSpacer = 0.5;
- this.IgnoreRepeatedDynamics = false;
-
- this.VexFlowDefaultNotationFontScale = 39;
- this.VexFlowDefaultTabFontScale = 39;
- this.TremoloStrokeScale = 1;
- this.TremoloYSpacingScale = 1;
- this.TremoloBuzzRollThickness = 0.25;
- this.StemWidth = 0.15;
- this.StaffLineWidth = 0.10;
- this.StaffLineColor = undefined;
- this.LedgerLineWidth = 1;
- this.LedgerLineStrokeStyle = undefined;
- this.LedgerLineColorDefault = "#000000";
- this.WedgeLineWidth = 0.12;
- this.TupletLineWidth = 0.12;
- this.LyricUnderscoreLineWidth = 0.12;
- this.SystemThinLineWidth = 0.12;
- this.SystemBoldLineWidth = EngravingRules.unit / 2.0;
- this.SystemRepetitionEndingLineWidth = 0.12;
- this.SystemDotWidth = EngravingRules.unit / 2.0;
- this.DistanceBetweenVerticalSystemLines = 0.35;
- this.DistanceBetweenDotAndLine = 0.7;
- this.RepeatEndStartPadding = 2.0;
- this.OctaveShiftLineWidth = 0.12;
- this.OctaveShiftVerticalLineLength = EngravingRules.unit;
- this.OctaveShiftOnWholeMeasureNoteUntilEndOfMeasure = false;
- this.GraceLineWidth = this.StaffLineWidth * this.GraceNoteScalingFactor;
- this.MultipleRestMeasureDefaultWidth = 4;
- this.MultipleRestMeasureAddKeySignature = true;
- this.FixedMeasureWidth = false;
- this.FixedMeasureWidthFixedValue = undefined;
- this.FixedMeasureWidthUseForPickupMeasures = false;
-
- this.MinimumCrossedBeamDifferenceMargin = 0.0001;
-
- this.SheetMaximumWidth = 32767;
-
- this.VoiceSpacingMultiplierVexflow = 0.85;
- this.VoiceSpacingAddendVexflow = 3.0;
- this.PickupMeasureWidthMultiplier = 1.0;
- this.PickupMeasureRepetitionSpacing = 0.8;
- this.PickupMeasureSpacingSingleNoteAddend = 1.6;
- this.DisplacedNoteMargin = 0.1;
- this.MinNoteDistance = 2.0;
- this.SubMeasureXSpacingThreshold = 35;
- this.MeasureDynamicsMaxScalingFactor = 2.5;
- this.WholeRestXShiftVexflow = -1.5;
- this.MetronomeMarksDrawn = true;
- this.MetronomeMarkXShift = -6;
- this.MetronomeMarkYShift = -1.0;
- this.SoftmaxFactorVexFlow = 15;
-
-
- this.StaggerSameWholeNotes = true;
-
- this.AlignRests = AlignRestOption.Never;
- this.RestCollisionYPadding = 0.0;
- this.FillEmptyMeasuresWithWholeRest = FillEmptyMeasuresWithWholeRests.No;
- this.ArpeggiosGoAcrossVoices = false;
- this.RenderArpeggios = true;
- this.RenderSlurs = true;
- this.RenderGlissandi = true;
- this.ColoringMode = ColoringMode.XML;
- this.ColoringEnabled = true;
- this.ColorStemsLikeNoteheads = false;
- this.ColorBeams = true;
- this.ColorFlags = true;
- this.applyDefaultColorMusic("#000000");
- this.DefaultColorCursor = "#33e02f";
- this.DefaultFontFamily = "Times New Roman";
- this.DefaultFontStyle = FontStyles.Regular;
- this.DefaultVexFlowNoteFont = "gonville";
- this.MaxMeasureToDrawIndex = Number.MAX_VALUE;
- this.MinMeasureToDrawIndex = 0;
- this.MaxSystemToDrawNumber = Number.MAX_VALUE;
- this.MaxPageToDrawNumber = Number.MAX_VALUE;
- this.RenderComposer = true;
- this.RenderTitle = true;
- this.RenderSubtitle = true;
- this.RenderLyricist = true;
- this.RenderCopyright = false;
- this.RenderPartNames = true;
- this.RenderPartAbbreviations = true;
- this.RenderFingerings = true;
- this.RenderMeasureNumbers = true;
- this.RenderMeasureNumbersOnlyAtSystemStart = false;
- this.UseXMLMeasureNumbers = true;
- this.RenderLyrics = true;
- this.RenderChordSymbols = true;
- this.RenderMultipleRestMeasures = true;
- this.AutoGenerateMultipleRestMeasuresFromRestMeasures = true;
- this.RenderRehearsalMarks = true;
- this.RenderClefsAtBeginningOfStaffline = true;
- this.RenderKeySignatures = true;
- this.RenderTimeSignatures = true;
- this.RenderPedals = true;
- this.ArticulationPlacementFromXML = true;
- this.BreathMarkDistance = 0.8;
- this.FingeringPosition = PlacementEnum.AboveOrBelow;
- this.FingeringPositionFromXML = true;
- this.FingeringPositionGrace = PlacementEnum.Left;
- this.FingeringInsideStafflines = false;
- this.FingeringLabelFontHeight = 1.7;
- this.FingeringOffsetX = 0.0;
- this.FingeringOffsetY = 0.0;
- this.FingeringPaddingY = -0.2;
- this.FingeringTextSize = 1.5;
- this.RenderStringNumbersClassical = true;
- this.StringNumberOffsetY = 0.0;
- this.NewSystemAtXMLNewSystemAttribute = false;
- this.NewPageAtXMLNewPageAttribute = false;
- this.NewSystemAtXMLNewPageAttribute = false;
- this.RestoreCursorAfterRerender = true;
- this.StretchLastSystemLine = false;
- this.IgnoreBracketsWords = true;
- this.PlaceWordsInsideStafflineFromXml = false;
- this.PlaceWordsInsideStafflineYOffset = 0.9;
-
- this.UseJustifiedBuilder = true;
- this.PageFormat = PageFormat.UndefinedPageFormat;
- this.PageBackgroundColor = undefined;
- this.PerformanceMode = false;
- this.RenderSingleHorizontalStaffline = false;
- this.SpacingBetweenTextLines = 0;
- this.NoteToGraphicalNoteMap = new Dictionary<number, GraphicalNote>();
- this.NoteToGraphicalNoteMapObjectCount = 0;
- this.SkyBottomLineBatchMinMeasures = 5;
- this.SkyBottomLineWebGLMinMeasures = 80;
- this.AlwaysSetPreferredSkyBottomLineBackendAutomatically = true;
- this.DisableWebGLInFirefox = true;
- this.DisableWebGLInSafariAndIOS = true;
- this.setPreferredSkyBottomLineBackendAutomatically();
-
- try {
- this.MaxInstructionsConstValue = this.ClefLeftMargin + this.ClefRightMargin + this.KeyRightMargin + this.RhythmRightMargin + 11;
-
-
-
-
-
- } catch (ex) {
- log.info("EngravingRules()", ex);
- }
-
- if (this.MpatMode) {
- this.NewPartAndSystemAfterFinalBarline = true;
- }
- }
- public setPreferredSkyBottomLineBackendAutomatically(numberOfGraphicalMeasures: number = -1): void {
- let vendor: string = "";
- let userAgent: string = "";
- if (typeof globalThis === "object") {
- vendor = globalThis.navigator?.vendor ?? "";
- userAgent = globalThis.navigator?.userAgent ?? "";
- }
- let alwaysUsePlain: boolean = false;
- if (this.DisableWebGLInSafariAndIOS && (/apple/i).test(vendor)) {
- alwaysUsePlain = true;
- } else if (this.DisableWebGLInFirefox && userAgent.includes("Firefox")) {
- alwaysUsePlain = true;
- }
-
-
- this.PreferredSkyBottomLineBatchCalculatorBackend = SkyBottomLineBatchCalculatorBackendType.Plain;
- if (!alwaysUsePlain) {
- if (numberOfGraphicalMeasures >= this.SkyBottomLineWebGLMinMeasures) {
- this.PreferredSkyBottomLineBatchCalculatorBackend = SkyBottomLineBatchCalculatorBackendType.WebGL;
- }
- }
- }
-
- public applyDefaultColorMusic(color: string): void {
- this.DefaultColorMusic = color;
- this.DefaultColorNotehead = color;
- this.DefaultColorRest = color;
- this.DefaultColorStem = color;
- this.DefaultColorLabel = color;
- this.DefaultColorLyrics = color;
- this.DefaultColorTitle = color;
- this.LedgerLineColorDefault = color;
- }
- public addGraphicalNoteToNoteMap(note: Note, graphicalNote: GraphicalNote): void {
- note.NoteToGraphicalNoteObjectId = this.NoteToGraphicalNoteMapObjectCount;
- this.NoteToGraphicalNoteMap.setValue(note.NoteToGraphicalNoteObjectId, graphicalNote);
- this.NoteToGraphicalNoteMapObjectCount++;
- }
-
- public GNote(note: Note): GraphicalNote {
- return GraphicalNote.FromNote(note, this);
- }
-
- public clearMusicSheetObjects(): void {
- this.NoteToGraphicalNoteMap = new Dictionary<number, GraphicalNote>();
- this.NoteToGraphicalNoteMapObjectCount = 0;
- }
- public resetChordAccidentalTexts(chordAccidentalTexts: Dictionary<AccidentalEnum, string>, useChordAccidentalsUnicode: boolean): void {
- chordAccidentalTexts.setValue(AccidentalEnum.SHARP, useChordAccidentalsUnicode ? "♯" : "#");
- chordAccidentalTexts.setValue(AccidentalEnum.FLAT, useChordAccidentalsUnicode ? "♭" : "b");
- chordAccidentalTexts.setValue(AccidentalEnum.DOUBLEFLAT, useChordAccidentalsUnicode ? "𝄫" : "bb");
- chordAccidentalTexts.setValue(AccidentalEnum.DOUBLESHARP, useChordAccidentalsUnicode ? "𝄪" : "x");
- }
- public setChordSymbolLabelText(key: ChordSymbolEnum, value: string): void {
- this.ChordSymbolLabelTexts.setValue(key, value);
- }
- public resetChordSymbolLabelTexts(chordtexts: Dictionary<ChordSymbolEnum, string>): Dictionary<ChordSymbolEnum, string> {
- chordtexts.setValue(ChordSymbolEnum.minor, "m");
- chordtexts.setValue(ChordSymbolEnum.augmented, "aug");
- chordtexts.setValue(ChordSymbolEnum.diminished, "dim");
- chordtexts.setValue(ChordSymbolEnum.dominant, "7");
- chordtexts.setValue(ChordSymbolEnum.majorseventh, "maj7");
- chordtexts.setValue(ChordSymbolEnum.minorseventh, "m7");
- chordtexts.setValue(ChordSymbolEnum.diminishedseventh, "dim7");
- chordtexts.setValue(ChordSymbolEnum.augmentedseventh, "aug7");
- chordtexts.setValue(ChordSymbolEnum.halfdiminished, `m7${this.ChordAccidentalTexts.getValue(AccidentalEnum.FLAT)}5`);
- chordtexts.setValue(ChordSymbolEnum.majorminor, "m(maj7)");
- chordtexts.setValue(ChordSymbolEnum.majorsixth, "maj6");
- chordtexts.setValue(ChordSymbolEnum.minorsixth, "m6");
- chordtexts.setValue(ChordSymbolEnum.dominantninth, "9");
- chordtexts.setValue(ChordSymbolEnum.majorninth, "maj9");
- chordtexts.setValue(ChordSymbolEnum.minorninth, "m9");
- chordtexts.setValue(ChordSymbolEnum.dominant11th, "11");
- chordtexts.setValue(ChordSymbolEnum.major11th, "maj11");
- chordtexts.setValue(ChordSymbolEnum.minor11th, "m11");
- chordtexts.setValue(ChordSymbolEnum.dominant13th, "13");
- chordtexts.setValue(ChordSymbolEnum.major13th, "maj13");
- chordtexts.setValue(ChordSymbolEnum.minor13th, "m13");
- chordtexts.setValue(ChordSymbolEnum.suspendedsecond, "sus2");
- chordtexts.setValue(ChordSymbolEnum.suspendedfourth, "sus4");
- chordtexts.setValue(ChordSymbolEnum.power, "5");
- chordtexts.setValue(ChordSymbolEnum.none, "N.C.");
- return chordtexts;
- }
- public addChordName(
- altName: string,
- chordKindText: string,
- adds: string[],
- alts: string[],
- subs: string[],
- ): void {
- if (ChordSymbolEnum[chordKindText] !== undefined) {
- const degrees: DegreesInfo = {
- adds,
- alts,
- subs,
- };
- this.CustomChords.push(CustomChord.createCustomChord(altName, ChordSymbolEnum[chordKindText], degrees));
- }
- }
- public renameChord(altName: string, newAltName: string): void {
- CustomChord.renameCustomChord(altName, newAltName, this.CustomChords);
- }
- public resetChordNames(): void {
- const sharp: string = this.ChordAccidentalTexts.getValue(AccidentalEnum.SHARP);
- const flat: string = this.ChordAccidentalTexts.getValue(AccidentalEnum.FLAT);
-
- this.addChordName("alt", "major", [`${sharp}5`, `${flat}9`, `${sharp}9`], [`${flat}5`], []);
- this.addChordName("7alt", "dominant", [`${sharp}5`, `${flat}9`, `${sharp}9`], [`${flat}5`], []);
- this.addChordName("7sus4", "dominant", ["4"], [], ["3"]);
- this.addChordName("7sus4", "suspendedfourth", ["7"], [], []);
- this.addChordName("9sus4", "dominantninth", ["4"], [], ["3"]);
- this.addChordName("9sus4", "suspendedfourth", ["9"], [], []);
- this.addChordName("11sus4", "dominant11th", ["4"], [], ["3"]);
- this.addChordName("11sus4", "suspendedfourth", ["11"], [], []);
- this.addChordName("13sus4", "dominant13th", ["4"], [], ["3"]);
- this.addChordName("13sus4", "suspendedfourth", ["13"], [], []);
- this.addChordName("7sus2", "dominant", ["2"], [], ["3"]);
- this.addChordName("7sus2", "suspendedsecond", ["7"], [], []);
- this.addChordName(`m7${flat}5`, "minorseventh", [], [`${flat}5`], []);
- this.addChordName("9sus2", "dominantninth", ["2"], [], ["3"]);
- this.addChordName("9sus2", "suspendedsecond", ["9"], [], []);
- this.addChordName("11sus2", "dominant11th", ["2"], [], ["3"]);
- this.addChordName("11sus2", "suspendedsecond", ["11"], [], []);
- this.addChordName("13sus2", "dominant13th", ["2"], [], ["3"]);
- this.addChordName("13sus2", "suspendedsecond", ["13"], [], []);
- this.addChordName("m(maj9)", "majorminor", ["9"], [], []);
- this.addChordName("m(maj11)", "majorminor", ["11"], [], []);
- this.addChordName("m(maj13)", "majorminor", ["13"], [], []);
- this.addChordName("69", "majorsixth", ["9"], [], []);
- this.addChordName("mi69", "minorsixth", ["9"], [], []);
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- private calculateCurveParametersArrays(): void {
- this.TPower3 = new Array(this.BezierCurveStepSize);
- this.OneMinusTPower3 = new Array(this.BezierCurveStepSize);
- this.FactorOne = new Array(this.BezierCurveStepSize);
- this.FactorTwo = new Array(this.BezierCurveStepSize);
- for (let i: number = 0; i < this.BezierCurveStepSize; i++) {
- const t: number = i / this.BezierCurveStepSize;
- this.TPower3[i] = Math.pow(t, 3);
- this.OneMinusTPower3[i] = Math.pow((1 - t), 3);
- this.FactorOne[i] = 3 * Math.pow((1 - t), 2) * t;
- this.FactorTwo[i] = 3 * (1 - t) * Math.pow(t, 2);
- }
- }
- }
- export class PageFormat {
- constructor(width: number, height: number, idString: string = "noIdStringGiven") {
- this.width = width;
- this.height = height;
- this.idString = idString;
- }
- public width: number;
- public height: number;
- public idString: string;
- public get aspectRatio(): number {
- if (!this.IsUndefined) {
- return this.width / this.height;
- } else {
- return 0;
- }
- }
-
- public get IsUndefined(): boolean {
- return this.width === undefined || this.height === undefined || this.height === 0 || this.width === 0;
- }
- public static get UndefinedPageFormat(): PageFormat {
- return new PageFormat(0, 0);
- }
- public Equals(otherPageFormat: PageFormat): boolean {
- if (!otherPageFormat) {
- return false;
- }
- return otherPageFormat.width === this.width && otherPageFormat.height === this.height;
- }
- }
|