123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737 |
- import { PagePlacementEnum } from "./GraphicalMusicPage";
- //import {MusicSymbol} from "./MusicSymbol";
- import log from "loglevel";
- import { TextAlignmentEnum } from "../../Common/Enums/TextAlignment";
- import { PlacementEnum } from "../VoiceData/Expressions/AbstractExpression";
- import { AutoBeamOptions, AlignRestOption, FillEmptyMeasuresWithWholeRests } from "../../OpenSheetMusicDisplay/OSMDOptions";
- import { ColoringModes as ColoringMode } from "./DrawingParameters";
- import { Dictionary } from "typescript-collections";
- import { FontStyles } from "../../Common/Enums";
- import { NoteEnum } from "../../Common/DataObjects/Pitch";
- export class EngravingRules {
- /** A unit of distance. 1.0 is the distance between lines of a stave for OSMD, which is 10 pixels in Vexflow. */
- private static unit: number = 1.0;
- private samplingUnit: number;
- private staccatoShorteningFactor: number;
- /** Height (size) of the sheet title. */
- private sheetTitleHeight: number;
- private sheetSubtitleHeight: number;
- private sheetMinimumDistanceBetweenTitleAndSubtitle: number;
- private sheetComposerHeight: number;
- private sheetAuthorHeight: number;
- private compactMode: boolean;
- private pagePlacementEnum: PagePlacementEnum;
- private pageHeight: number;
- private pageTopMargin: number;
- private pageTopMarginNarrow: number;
- private pageBottomMargin: number;
- private pageLeftMargin: number;
- private pageRightMargin: number;
- private titleTopDistance: number;
- private titleBottomDistance: number;
- private systemLeftMargin: number;
- private systemRightMargin: number;
- private firstSystemMargin: number;
- private systemLabelsRightMargin: number;
- private systemComposerDistance: number;
- private instrumentLabelTextHeight: number;
- private minimumDistanceBetweenSystems: number;
- private lastSystemMaxScalingFactor: number;
- private staffDistance: number;
- private betweenStaffDistance: number;
- private staffHeight: number;
- private tabStaffHeight: number;
- private betweenStaffLinesDistance: number;
- /** Whether to automatically beam notes that don't already have beams in XML. */
- private autoBeamNotes: boolean;
- /** Options for autoBeaming like whether to beam over rests. See AutoBeamOptions interface. */
- private autoBeamOptions: AutoBeamOptions;
- private beamWidth: number;
- private beamSpaceWidth: number;
- private beamForwardLength: number;
- private clefLeftMargin: number;
- private clefRightMargin: number;
- private betweenKeySymbolsDistance: number;
- private keyRightMargin: number;
- private rhythmRightMargin: number;
- private inStaffClefScalingFactor: number;
- private distanceBetweenNaturalAndSymbolWhenCancelling: number;
- private noteHelperLinesOffset: number;
- private measureLeftMargin: number;
- private measureRightMargin: number;
- private distanceBetweenLastInstructionAndRepetitionBarline: number;
- private arpeggioDistance: number;
- private idealStemLength: number;
- private stemNoteHeadBorderYOffset: number;
- private stemWidth: number;
- private stemMargin: number;
- private stemMinLength: number;
- private stemMaxLength: number;
- private beamSlopeMaxAngle: number;
- private stemMinAllowedDistanceBetweenNoteHeadAndBeamLine: number;
- private setWantedStemDirectionByXml: boolean;
- private graceNoteScalingFactor: number;
- private graceNoteXOffset: number;
- private wedgeOpeningLength: number;
- private wedgeMeasureEndOpeningLength: number;
- private wedgeMeasureBeginOpeningLength: number;
- private wedgePlacementAboveY: number;
- private wedgePlacementBelowY: number;
- private wedgeHorizontalMargin: number;
- private wedgeVerticalMargin: number;
- private distanceOffsetBetweenTwoHorizontallyCrossedWedges: number;
- private wedgeMinLength: number;
- private distanceBetweenAdjacentDynamics: number;
- private tempoChangeMeasureValidity: number;
- private tempoContinousFactor: number;
- private staccatoScalingFactor: number;
- private betweenDotsDistance: number;
- private ornamentAccidentalScalingFactor: number;
- private chordSymbolTextHeight: number;
- private chordSymbolXSpacing: number;
- private chordSymbolYOffset: number;
- private fingeringLabelFontHeight: number;
- private measureNumberLabelHeight: number;
- private measureNumberLabelOffset: number;
- /** Whether tuplets should display ratio (3:2 instead of 3 for triplet). Default false. */
- private tupletsRatioed: boolean;
- /** Whether all tuplets should be bracketed (e.g. |--5--| instead of 5). Default false.
- * If false, only tuplets given as bracketed in XML (bracket="yes") will be bracketed.
- * (If not given in XML, bracketing is implementation-dependent according to standard)
- */
- private tupletsBracketed: boolean;
- /** Whether all triplets should be bracketed. Overrides tupletsBracketed for triplets.
- * If false, only triplets given as bracketed in XML (bracket="yes") will be bracketed.
- * (Bracketing all triplets can be cluttering)
- */
- private tripletsBracketed: boolean;
- private tupletNumberLabelHeight: number;
- private tupletNumberYOffset: number;
- private labelMarginBorderFactor: number;
- private tupletVerticalLineLength: number;
- private repetitionEndingLabelHeight: number;
- private repetitionEndingLabelXOffset: number;
- private repetitionEndingLabelYOffset: number;
- private repetitionEndingLineYLowerOffset: number;
- private repetitionEndingLineYUpperOffset: number;
- private voltaOffset: number;
- /** Default alignment of lyrics.
- * Left alignments will extend text to the right of the bounding box,
- * which facilitates spacing by extending measure width.
- */
- private lyricsAlignmentStandard: TextAlignmentEnum;
- private lyricsHeight: number;
- private lyricsYOffsetToStaffHeight: number;
- private verticalBetweenLyricsDistance: number;
- private horizontalBetweenLyricsDistance: number;
- private betweenSyllableMaximumDistance: number;
- private betweenSyllableMinimumDistance: number;
- private lyricOverlapAllowedIntoNextMeasure: number;
- private minimumDistanceBetweenDashes: number;
- private bezierCurveStepSize: number;
- private tPower3: number[];
- private oneMinusTPower3: number[];
- private factorOne: number[];
- private factorTwo: number[];
- private tieGhostObjectWidth: number;
- private tieYPositionOffsetFactor: number;
- private minimumNeededXspaceForTieGhostObject: number;
- private tieHeightMinimum: number;
- private tieHeightMaximum: number;
- private tieHeightInterpolationK: number;
- private tieHeightInterpolationD: number;
- private slurNoteHeadYOffset: number;
- private slurStemXOffset: number;
- private slurSlopeMaxAngle: number;
- private slurTangentMinAngle: number;
- private slurTangentMaxAngle: number;
- private slursStartingAtSameStaffEntryYOffset: number;
- private instantaneousTempoTextHeight: number;
- private continuousDynamicTextHeight: number;
- private moodTextHeight: number;
- private unknownTextHeight: number;
- private continuousTempoTextHeight: number;
- private staffLineWidth: number;
- private ledgerLineWidth: number;
- private wedgeLineWidth: number;
- private tupletLineWidth: number;
- private lyricUnderscoreLineWidth: number;
- private systemThinLineWidth: number;
- private systemBoldLineWidth: number;
- private systemRepetitionEndingLineWidth: number;
- private systemDotWidth: number;
- private distanceBetweenVerticalSystemLines: number;
- private distanceBetweenDotAndLine: number;
- private octaveShiftLineWidth: number;
- private octaveShiftVerticalLineLength: number;
- private graceLineWidth: number;
- private minimumStaffLineDistance: number;
- private minimumSkyBottomLineDistance: number;
- private minimumCrossedBeamDifferenceMargin: number;
- private displacedNoteMargin: number;
- private minNoteDistance: number;
- private subMeasureXSpacingThreshold: number;
- private measureDynamicsMaxScalingFactor: number;
- private wholeRestXShiftVexflow: number;
- private metronomeMarksDrawn: boolean;
- private metronomeMarkXShift: number;
- private metronomeMarkYShift: number;
- private maxInstructionsConstValue: number;
- private noteDistances: number[] = [1.0, 1.0, 1.3, 1.6, 2.0, 2.5, 3.0, 4.0];
- private noteDistancesScalingFactors: number[] = [1.0, 2.0, 4.0, 8.0, 16.0, 32.0, 64.0, 128.0];
- private durationDistanceDict: {[_: number]: number; } = {};
- private durationScalingDistanceDict: {[_: number]: number; } = {};
- private alignRests: number; // 0 = false, 1 = true, 2 = auto
- private fillEmptyMeasuresWithWholeRest: FillEmptyMeasuresWithWholeRests | number;
- private arpeggiosGoAcrossVoices: boolean;
- private renderArpeggios: boolean;
- private renderSlurs: boolean;
- private coloringMode: ColoringMode;
- private coloringEnabled: boolean;
- private colorStemsLikeNoteheads: boolean;
- private colorFlags: boolean;
- private colorBeams: boolean;
- private coloringSetCustom: Dictionary<NoteEnum|number, string>;
- private defaultColorNotehead: string;
- private defaultColorRest: string;
- private defaultColorStem: string;
- private defaultColorLabel: string;
- private defaultColorTitle: string;
- private defaultFontFamily: string;
- private defaultFontStyle: FontStyles;
- private maxMeasureToDrawIndex: number;
- private minMeasureToDrawIndex: number;
- /** Whether to render a label for the composer of the piece at the top of the sheet. */
- private renderComposer: boolean;
- private renderTitle: boolean;
- private renderSubtitle: boolean;
- private renderLyricist: boolean;
- private renderPartNames: boolean;
- private renderPartAbbreviations: boolean;
- private renderFingerings: boolean;
- private renderMeasureNumbers: boolean;
- private renderLyrics: boolean;
- private dynamicExpressionMaxDistance: number;
- private dynamicExpressionSpacer: number;
- /** Position of fingering label in relation to corresponding note (left, right supported, above, below experimental) */
- private fingeringPosition: PlacementEnum;
- private fingeringInsideStafflines: boolean;
- private newSystemAtXMLNewSystemAttribute: boolean;
- private newPageAtXMLNewPageAttribute: boolean;
- private pageFormat: PageFormat;
- private pageBackgroundColor: string; // vexflow-color-string (#FFFFFF). Default undefined/transparent.
- private renderSingleHorizontalStaffline: boolean;
- private restoreCursorAfterRerender: boolean;
- private static fixStafflineBoundingBox: boolean; // TODO temporary workaround
- constructor() {
- // global variables
- this.samplingUnit = EngravingRules.unit * 3;
- // Page Label Variables
- this.sheetTitleHeight = 4.0;
- this.sheetSubtitleHeight = 2.0;
- this.sheetMinimumDistanceBetweenTitleAndSubtitle = 1.0;
- this.sheetComposerHeight = 2.0;
- this.sheetAuthorHeight = 2.0;
- // Staff sizing Variables
- this.compactMode = false;
- this.pagePlacementEnum = PagePlacementEnum.Down;
- this.pageHeight = 100001.0;
- this.pageTopMargin = 5.0;
- this.pageTopMarginNarrow = 0.0; // for compact mode
- this.pageBottomMargin = 5.0;
- this.pageLeftMargin = 5.0;
- this.pageRightMargin = 5.0;
- this.titleTopDistance = 9.0;
- this.titleBottomDistance = 1.0;
- this.staffDistance = 7.0;
- this.betweenStaffDistance = 5.0;
- // System Sizing and Label Variables
- this.staffHeight = 4.0;
- this.tabStaffHeight = 6.67;
- this.betweenStaffLinesDistance = EngravingRules.unit;
- this.systemLeftMargin = 0.0;
- this.systemRightMargin = 0.0;
- this.firstSystemMargin = 15.0;
- this.systemLabelsRightMargin = 2.0;
- this.systemComposerDistance = 2.0;
- this.instrumentLabelTextHeight = 2;
- this.minimumDistanceBetweenSystems = 4.0;
- this.lastSystemMaxScalingFactor = 1.4;
- // autoBeam options
- this.autoBeamNotes = false;
- this.autoBeamOptions = {
- beam_middle_rests_only: false,
- beam_rests: false,
- maintain_stem_directions: false
- };
- // Beam Sizing Variables
- this.beamWidth = EngravingRules.unit / 2.0;
- this.beamSpaceWidth = EngravingRules.unit / 3.0;
- this.beamForwardLength = 1.25 * EngravingRules.unit;
- // Beam Sizing Variables
- this.clefLeftMargin = 0.5;
- this.clefRightMargin = 0.75;
- this.betweenKeySymbolsDistance = 0.2;
- this.keyRightMargin = 0.75;
- this.rhythmRightMargin = 1.25;
- this.inStaffClefScalingFactor = 0.8;
- this.distanceBetweenNaturalAndSymbolWhenCancelling = 0.4;
- // Beam Sizing Variables
- this.noteHelperLinesOffset = 0.25;
- this.measureLeftMargin = 0.7;
- this.measureRightMargin = 0.0;
- this.distanceBetweenLastInstructionAndRepetitionBarline = 1.0;
- this.arpeggioDistance = 0.6;
- // Stems Variables
- this.staccatoShorteningFactor = 2;
- this.idealStemLength = 3.0;
- this.stemNoteHeadBorderYOffset = 0.2;
- this.stemWidth = 0.13;
- this.stemMargin = 0.2;
- this.stemMinLength = 2.5;
- this.stemMaxLength = 4.5;
- this.beamSlopeMaxAngle = 10.0;
- this.stemMinAllowedDistanceBetweenNoteHeadAndBeamLine = 1.0;
- this.setWantedStemDirectionByXml = true;
- // GraceNote Variables
- this.graceNoteScalingFactor = 0.6;
- this.graceNoteXOffset = 0.2;
- // Wedge Variables
- 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.distanceBetweenAdjacentDynamics = 0.75;
- // Tempo Variables
- this.tempoChangeMeasureValidity = 4;
- this.tempoContinousFactor = 0.7;
- // various
- this.staccatoScalingFactor = 0.8;
- this.betweenDotsDistance = 0.8;
- this.ornamentAccidentalScalingFactor = 0.65;
- this.chordSymbolTextHeight = 2.0;
- this.chordSymbolXSpacing = 1.0;
- this.chordSymbolYOffset = 2.0;
- this.fingeringLabelFontHeight = 1.7;
- // Tuplets, MeasureNumber and TupletNumber Labels
- this.measureNumberLabelHeight = 1.5 * EngravingRules.unit;
- this.measureNumberLabelOffset = 2;
- this.tupletsRatioed = false;
- this.tupletsBracketed = false;
- this.tripletsBracketed = false; // special setting for triplets, overrides tuplet setting (for triplets only)
- this.tupletNumberLabelHeight = 1.5 * EngravingRules.unit;
- this.tupletNumberYOffset = 0.5;
- this.labelMarginBorderFactor = 0.1;
- this.tupletVerticalLineLength = 0.5;
- // Slur and Tie variables
- 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.slurStemXOffset = 0.3;
- this.slurSlopeMaxAngle = 15.0;
- this.slurTangentMinAngle = 30.0;
- this.slurTangentMaxAngle = 80.0;
- this.slursStartingAtSameStaffEntryYOffset = 0.8;
- // Repetitions
- this.repetitionEndingLabelHeight = 2.0;
- this.repetitionEndingLabelXOffset = 0.5;
- this.repetitionEndingLabelYOffset = 0.3;
- this.repetitionEndingLineYLowerOffset = 0.5;
- this.repetitionEndingLineYUpperOffset = 0.3;
- this.voltaOffset = 2.5;
- // Lyrics
- this.lyricsAlignmentStandard = TextAlignmentEnum.LeftBottom; // CenterBottom and LeftBottom tested, spacing-optimized
- this.lyricsHeight = 2.0; // actually size of lyrics
- this.lyricsYOffsetToStaffHeight = 3.0; // distance between lyrics and staff. could partly be even lower/dynamic
- this.verticalBetweenLyricsDistance = 0.5;
- this.horizontalBetweenLyricsDistance = 0.2;
- this.betweenSyllableMaximumDistance = 10.0;
- this.betweenSyllableMinimumDistance = 0.5; // + 1.0 for CenterAlignment added in lyrics spacing
- this.lyricOverlapAllowedIntoNextMeasure = 3.4; // optimal for dashed last lyric, see Land der Berge
- this.minimumDistanceBetweenDashes = 10;
- // expressions variables
- 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;
- // Line Widths
- this.staffLineWidth = 0.12;
- this.ledgerLineWidth = 0.12;
- 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 / 5.0;
- this.distanceBetweenVerticalSystemLines = 0.35;
- this.distanceBetweenDotAndLine = 0.7;
- this.octaveShiftLineWidth = 0.12;
- this.octaveShiftVerticalLineLength = EngravingRules.unit;
- this.graceLineWidth = this.staffLineWidth * this.GraceNoteScalingFactor;
- // Line Widths
- this.minimumStaffLineDistance = 4.0;
- this.minimumSkyBottomLineDistance = 2.0; // default. 1.0 for compacttight mode (1.0 can cause overlaps)
- this.minimumCrossedBeamDifferenceMargin = 0.0001;
- // xSpacing Variables
- this.displacedNoteMargin = 0.1;
- this.minNoteDistance = 2.0;
- this.subMeasureXSpacingThreshold = 35;
- this.measureDynamicsMaxScalingFactor = 2.5;
- this.wholeRestXShiftVexflow = -2.5; // VexFlow draws rest notes too far to the right
- this.metronomeMarksDrawn = true;
- this.metronomeMarkXShift = -6; // our unit, is taken * unitInPixels
- this.metronomeMarkYShift = -0.5;
- // Render options (whether to render specific or invisible elements)
- this.alignRests = AlignRestOption.Never; // 0 = false, 1 = true, 2 = auto
- this.fillEmptyMeasuresWithWholeRest = FillEmptyMeasuresWithWholeRests.No;
- this.arpeggiosGoAcrossVoices = false; // safe option, as otherwise arpeggios will always go across all voices in Vexflow, which is often unwanted
- this.renderArpeggios = true;
- this.renderSlurs = true;
- this.coloringMode = ColoringMode.XML;
- this.coloringEnabled = true;
- this.colorStemsLikeNoteheads = false;
- this.colorBeams = true;
- this.colorFlags = true;
- this.defaultColorNotehead = "#000000"; // black. undefined is only black if a note's color hasn't been changed before.
- this.defaultColorRest = this.defaultColorNotehead;
- this.defaultColorStem = this.defaultColorNotehead;
- this.defaultColorLabel = this.defaultColorNotehead;
- this.defaultColorTitle = this.defaultColorNotehead;
- this.defaultFontFamily = "Times New Roman"; // what OSMD was initially optimized for
- this.defaultFontStyle = FontStyles.Regular;
- this.maxMeasureToDrawIndex = Number.MAX_VALUE;
- this.minMeasureToDrawIndex = 0;
- this.renderComposer = true;
- this.renderTitle = true;
- this.renderSubtitle = true;
- this.renderLyricist = true;
- this.renderPartNames = true;
- this.renderPartAbbreviations = true;
- this.renderFingerings = true;
- this.renderMeasureNumbers = true;
- this.renderLyrics = true;
- this.fingeringPosition = PlacementEnum.Left; // easier to get bounding box, and safer for vertical layout
- this.fingeringInsideStafflines = false;
- this.newSystemAtXMLNewSystemAttribute = false;
- this.newPageAtXMLNewPageAttribute = false;
- this.restoreCursorAfterRerender = true;
- EngravingRules.FixStafflineBoundingBox = false; // TODO temporary workaround
- 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.renderSingleHorizontalStaffline = false;
- this.populateDictionaries();
- try {
- this.maxInstructionsConstValue = this.ClefLeftMargin + this.ClefRightMargin + this.KeyRightMargin + this.RhythmRightMargin + 11;
- //if (FontInfo.Info !== undefined) {
- // this.maxInstructionsConstValue += FontInfo.Info.getBoundingBox(MusicSymbol.G_CLEF).width
- // + FontInfo.Info.getBoundingBox(MusicSymbol.FOUR).width
- // + 7 * FontInfo.Info.getBoundingBox(MusicSymbol.SHARP).width;
- //}
- } catch (ex) {
- log.info("EngravingRules()", ex);
- }
- }
- // these two need to be static so that we can avoid passing EngravingRules to BoundingBox in lots of code
- public static get FixStafflineBoundingBox(): boolean {
- return EngravingRules.fixStafflineBoundingBox;
- }
- public static set FixStafflineBoundingBox(value: boolean) {
- EngravingRules.fixStafflineBoundingBox = value;
- }
- public get SamplingUnit(): number {
- return this.samplingUnit;
- }
- public get SheetTitleHeight(): number {
- return this.sheetTitleHeight;
- }
- public set SheetTitleHeight(value: number) {
- this.sheetTitleHeight = value;
- }
- public get SheetSubtitleHeight(): number {
- return this.sheetSubtitleHeight;
- }
- public set SheetSubtitleHeight(value: number) {
- this.sheetSubtitleHeight = value;
- }
- public get SheetMinimumDistanceBetweenTitleAndSubtitle(): number {
- return this.sheetMinimumDistanceBetweenTitleAndSubtitle;
- }
- public set SheetMinimumDistanceBetweenTitleAndSubtitle(value: number) {
- this.sheetMinimumDistanceBetweenTitleAndSubtitle = value;
- }
- public get SheetComposerHeight(): number {
- return this.sheetComposerHeight;
- }
- public set SheetComposerHeight(value: number) {
- this.sheetComposerHeight = value;
- }
- public get SheetAuthorHeight(): number {
- return this.sheetAuthorHeight;
- }
- public set SheetAuthorHeight(value: number) {
- this.sheetAuthorHeight = value;
- }
- public get PagePlacement(): PagePlacementEnum {
- return this.pagePlacementEnum;
- }
- public set PagePlacement(value: PagePlacementEnum) {
- this.pagePlacementEnum = value;
- }
- public get CompactMode(): boolean {
- return this.compactMode;
- }
- public set CompactMode(value: boolean) {
- this.compactMode = value;
- }
- public get PageHeight(): number {
- return this.pageHeight;
- }
- public set PageHeight(value: number) {
- this.pageHeight = value;
- }
- public get PageTopMargin(): number {
- return this.pageTopMargin;
- }
- public set PageTopMargin(value: number) {
- this.pageTopMargin = value;
- }
- public get PageTopMarginNarrow(): number {
- return this.pageTopMarginNarrow;
- }
- public set PageTopMarginNarrow(value: number) {
- this.pageTopMarginNarrow = value;
- }
- public get PageBottomMargin(): number {
- return this.pageBottomMargin;
- }
- public set PageBottomMargin(value: number) {
- this.pageBottomMargin = value;
- }
- public get PageLeftMargin(): number {
- return this.pageLeftMargin;
- }
- public set PageLeftMargin(value: number) {
- this.pageLeftMargin = value;
- }
- public get PageRightMargin(): number {
- return this.pageRightMargin;
- }
- public set PageRightMargin(value: number) {
- this.pageRightMargin = value;
- }
- public get TitleTopDistance(): number {
- return this.titleTopDistance;
- }
- public set TitleTopDistance(value: number) {
- this.titleTopDistance = value;
- }
- public get TitleBottomDistance(): number {
- return this.titleBottomDistance;
- }
- public set TitleBottomDistance(value: number) {
- this.titleBottomDistance = value;
- }
- public get SystemComposerDistance(): number {
- return this.systemComposerDistance;
- }
- public set SystemComposerDistance(value: number) {
- this.systemComposerDistance = value;
- }
- public get InstrumentLabelTextHeight(): number {
- return this.instrumentLabelTextHeight;
- }
- public set InstrumentLabelTextHeight(value: number) {
- this.instrumentLabelTextHeight = value;
- }
- public get SystemLeftMargin(): number {
- return this.systemLeftMargin;
- }
- public set SystemLeftMargin(value: number) {
- this.systemLeftMargin = value;
- }
- public get SystemRightMargin(): number {
- return this.systemRightMargin;
- }
- public set SystemRightMargin(value: number) {
- this.systemRightMargin = value;
- }
- public get FirstSystemMargin(): number {
- return this.firstSystemMargin;
- }
- public set FirstSystemMargin(value: number) {
- this.firstSystemMargin = value;
- }
- public get SystemLabelsRightMargin(): number {
- return this.systemLabelsRightMargin;
- }
- public set SystemLabelsRightMargin(value: number) {
- this.systemLabelsRightMargin = value;
- }
- public get MinimumDistanceBetweenSystems(): number {
- return this.minimumDistanceBetweenSystems;
- }
- public set MinimumDistanceBetweenSystems(value: number) {
- this.minimumDistanceBetweenSystems = value;
- }
- public get LastSystemMaxScalingFactor(): number {
- return this.lastSystemMaxScalingFactor;
- }
- public set LastSystemMaxScalingFactor(value: number) {
- this.lastSystemMaxScalingFactor = value;
- }
- public get StaffDistance(): number {
- return this.staffDistance;
- }
- public set StaffDistance(value: number) {
- this.staffDistance = value;
- }
- public get BetweenStaffDistance(): number {
- return this.betweenStaffDistance;
- }
- public set BetweenStaffDistance(value: number) {
- this.betweenStaffDistance = value;
- }
- public get StaffHeight(): number {
- return this.staffHeight;
- }
- public set StaffHeight(value: number) {
- this.staffHeight = value;
- }
- public get TabStaffHeight(): number {
- return this.tabStaffHeight;
- }
- public set TabStaffHeight(value: number) {
- this.tabStaffHeight = value;
- }
- public get BetweenStaffLinesDistance(): number {
- return this.betweenStaffLinesDistance;
- }
- public set BetweenStaffLinesDistance(value: number) {
- this.betweenStaffLinesDistance = value;
- }
- public get AutoBeamNotes(): boolean {
- return this.autoBeamNotes;
- }
- public set AutoBeamNotes(value: boolean) {
- this.autoBeamNotes = value;
- }
- public get AutoBeamOptions(): AutoBeamOptions {
- return this.autoBeamOptions;
- }
- public set AutoBeamOptions(value: AutoBeamOptions) {
- this.autoBeamOptions = value;
- }
- public get BeamWidth(): number {
- return this.beamWidth;
- }
- public set BeamWidth(value: number) {
- this.beamWidth = value;
- }
- public get BeamSpaceWidth(): number {
- return this.beamSpaceWidth;
- }
- public set BeamSpaceWidth(value: number) {
- this.beamSpaceWidth = value;
- }
- public get BeamForwardLength(): number {
- return this.beamForwardLength;
- }
- public set BeamForwardLength(value: number) {
- this.beamForwardLength = value;
- }
- public get BetweenKeySymbolsDistance(): number {
- return this.betweenKeySymbolsDistance;
- }
- public set BetweenKeySymbolsDistance(value: number) {
- this.betweenKeySymbolsDistance = value;
- }
- public get ClefLeftMargin(): number {
- return this.clefLeftMargin;
- }
- public set ClefLeftMargin(value: number) {
- this.clefLeftMargin = value;
- }
- public get ClefRightMargin(): number {
- return this.clefRightMargin;
- }
- public set ClefRightMargin(value: number) {
- this.clefRightMargin = value;
- }
- public get KeyRightMargin(): number {
- return this.keyRightMargin;
- }
- public set KeyRightMargin(value: number) {
- this.keyRightMargin = value;
- }
- public get RhythmRightMargin(): number {
- return this.rhythmRightMargin;
- }
- public set RhythmRightMargin(value: number) {
- this.rhythmRightMargin = value;
- }
- public get InStaffClefScalingFactor(): number {
- return this.inStaffClefScalingFactor;
- }
- public set InStaffClefScalingFactor(value: number) {
- this.inStaffClefScalingFactor = value;
- }
- public get DistanceBetweenNaturalAndSymbolWhenCancelling(): number {
- return this.distanceBetweenNaturalAndSymbolWhenCancelling;
- }
- public set DistanceBetweenNaturalAndSymbolWhenCancelling(value: number) {
- this.distanceBetweenNaturalAndSymbolWhenCancelling = value;
- }
- public get NoteHelperLinesOffset(): number {
- return this.noteHelperLinesOffset;
- }
- public set NoteHelperLinesOffset(value: number) {
- this.noteHelperLinesOffset = value;
- }
- public get MeasureLeftMargin(): number {
- return this.measureLeftMargin;
- }
- public set MeasureLeftMargin(value: number) {
- this.measureLeftMargin = value;
- }
- public get MeasureRightMargin(): number {
- return this.measureRightMargin;
- }
- public set MeasureRightMargin(value: number) {
- this.measureRightMargin = value;
- }
- public get DistanceBetweenLastInstructionAndRepetitionBarline(): number {
- return this.distanceBetweenLastInstructionAndRepetitionBarline;
- }
- public set DistanceBetweenLastInstructionAndRepetitionBarline(value: number) {
- this.distanceBetweenLastInstructionAndRepetitionBarline = value;
- }
- public get ArpeggioDistance(): number {
- return this.arpeggioDistance;
- }
- public set ArpeggioDistance(value: number) {
- this.arpeggioDistance = value;
- }
- public get StaccatoShorteningFactor(): number {
- return this.staccatoShorteningFactor;
- }
- public set StaccatoShorteningFactor(value: number) {
- this.staccatoShorteningFactor = value;
- }
- public get IdealStemLength(): number {
- return this.idealStemLength;
- }
- public set IdealStemLength(value: number) {
- this.idealStemLength = value;
- }
- public get StemNoteHeadBorderYOffset(): number {
- return this.stemNoteHeadBorderYOffset;
- }
- public set StemNoteHeadBorderYOffset(value: number) {
- this.stemNoteHeadBorderYOffset = value;
- }
- public get StemWidth(): number {
- return this.stemWidth;
- }
- public set StemWidth(value: number) {
- this.stemWidth = value;
- }
- public get StemMargin(): number {
- return this.stemMargin;
- }
- public set StemMargin(value: number) {
- this.stemMargin = value;
- }
- public get StemMinLength(): number {
- return this.stemMinLength;
- }
- public set StemMinLength(value: number) {
- this.stemMinLength = value;
- }
- public get StemMaxLength(): number {
- return this.stemMaxLength;
- }
- public set StemMaxLength(value: number) {
- this.stemMaxLength = value;
- }
- public get BeamSlopeMaxAngle(): number {
- return this.beamSlopeMaxAngle;
- }
- public set BeamSlopeMaxAngle(value: number) {
- this.beamSlopeMaxAngle = value;
- }
- public get StemMinAllowedDistanceBetweenNoteHeadAndBeamLine(): number {
- return this.stemMinAllowedDistanceBetweenNoteHeadAndBeamLine;
- }
- public set StemMinAllowedDistanceBetweenNoteHeadAndBeamLine(value: number) {
- this.stemMinAllowedDistanceBetweenNoteHeadAndBeamLine = value;
- }
- public get SetWantedStemDirectionByXml(): boolean {
- return this.setWantedStemDirectionByXml;
- }
- public set SetWantedStemDirectionByXml(value: boolean) {
- this.setWantedStemDirectionByXml = value;
- }
- public get GraceNoteScalingFactor(): number {
- return this.graceNoteScalingFactor;
- }
- public set GraceNoteScalingFactor(value: number) {
- this.graceNoteScalingFactor = value;
- }
- public get GraceNoteXOffset(): number {
- return this.graceNoteXOffset;
- }
- public set GraceNoteXOffset(value: number) {
- this.graceNoteXOffset = value;
- }
- public get WedgeOpeningLength(): number {
- return this.wedgeOpeningLength;
- }
- public set WedgeOpeningLength(value: number) {
- this.wedgeOpeningLength = value;
- }
- public get WedgeMeasureEndOpeningLength(): number {
- return this.wedgeMeasureEndOpeningLength;
- }
- public set WedgeMeasureEndOpeningLength(value: number) {
- this.wedgeMeasureEndOpeningLength = value;
- }
- public get WedgeMeasureBeginOpeningLength(): number {
- return this.wedgeMeasureBeginOpeningLength;
- }
- public set WedgeMeasureBeginOpeningLength(value: number) {
- this.wedgeMeasureBeginOpeningLength = value;
- }
- public get WedgePlacementAboveY(): number {
- return this.wedgePlacementAboveY;
- }
- public set WedgePlacementAboveY(value: number) {
- this.wedgePlacementAboveY = value;
- }
- public get WedgePlacementBelowY(): number {
- return this.wedgePlacementBelowY;
- }
- public set WedgePlacementBelowY(value: number) {
- this.wedgePlacementBelowY = value;
- }
- public get WedgeHorizontalMargin(): number {
- return this.wedgeHorizontalMargin;
- }
- public set WedgeHorizontalMargin(value: number) {
- this.wedgeHorizontalMargin = value;
- }
- public get WedgeVerticalMargin(): number {
- return this.wedgeVerticalMargin;
- }
- public set WedgeVerticalMargin(value: number) {
- this.wedgeVerticalMargin = value;
- }
- public get DistanceOffsetBetweenTwoHorizontallyCrossedWedges(): number {
- return this.distanceOffsetBetweenTwoHorizontallyCrossedWedges;
- }
- public set DistanceOffsetBetweenTwoHorizontallyCrossedWedges(value: number) {
- this.distanceOffsetBetweenTwoHorizontallyCrossedWedges = value;
- }
- public get WedgeMinLength(): number {
- return this.wedgeMinLength;
- }
- public set WedgeMinLength(value: number) {
- this.wedgeMinLength = value;
- }
- public get DistanceBetweenAdjacentDynamics(): number {
- return this.distanceBetweenAdjacentDynamics;
- }
- public set DistanceBetweenAdjacentDynamics(value: number) {
- this.distanceBetweenAdjacentDynamics = value;
- }
- public get TempoChangeMeasureValidity(): number {
- return this.tempoChangeMeasureValidity;
- }
- public set TempoChangeMeasureValidity(value: number) {
- this.tempoChangeMeasureValidity = value;
- }
- public get TempoContinousFactor(): number {
- return this.tempoContinousFactor;
- }
- public set TempoContinousFactor(value: number) {
- this.tempoContinousFactor = value;
- }
- public get StaccatoScalingFactor(): number {
- return this.staccatoScalingFactor;
- }
- public set StaccatoScalingFactor(value: number) {
- this.staccatoScalingFactor = value;
- }
- public get BetweenDotsDistance(): number {
- return this.betweenDotsDistance;
- }
- public set BetweenDotsDistance(value: number) {
- this.betweenDotsDistance = value;
- }
- public get OrnamentAccidentalScalingFactor(): number {
- return this.ornamentAccidentalScalingFactor;
- }
- public set OrnamentAccidentalScalingFactor(value: number) {
- this.ornamentAccidentalScalingFactor = value;
- }
- public get ChordSymbolTextHeight(): number {
- return this.chordSymbolTextHeight;
- }
- public set ChordSymbolTextHeight(value: number) {
- this.chordSymbolTextHeight = value;
- }
- public get ChordSymbolXSpacing(): number {
- return this.chordSymbolXSpacing;
- }
- public set ChordSymbolXSpacing(value: number) {
- this.chordSymbolXSpacing = value;
- }
- public get ChordSymbolYOffset(): number {
- return this.chordSymbolYOffset;
- }
- public set ChordSymbolYOffset(value: number) {
- this.chordSymbolYOffset = value;
- }
- public get FingeringLabelFontHeight(): number {
- return this.fingeringLabelFontHeight;
- }
- public set FingeringLabelFontHeight(value: number) {
- this.fingeringLabelFontHeight = value;
- }
- public get MeasureNumberLabelHeight(): number {
- return this.measureNumberLabelHeight;
- }
- public set MeasureNumberLabelHeight(value: number) {
- this.measureNumberLabelHeight = value;
- }
- public get MeasureNumberLabelOffset(): number {
- return this.measureNumberLabelOffset;
- }
- public set MeasureNumberLabelOffset(value: number) {
- this.measureNumberLabelOffset = value;
- }
- public get TupletsRatioed(): boolean {
- return this.tupletsRatioed;
- }
- public set TupletsRatioed(value: boolean) {
- this.tupletsRatioed = value;
- }
- public get TupletsBracketed(): boolean {
- return this.tupletsBracketed;
- }
- public set TupletsBracketed(value: boolean) {
- this.tupletsBracketed = value;
- }
- public get TripletsBracketed(): boolean {
- return this.tripletsBracketed;
- }
- public set TripletsBracketed(value: boolean) {
- this.tripletsBracketed = value;
- }
- public get TupletNumberLabelHeight(): number {
- return this.tupletNumberLabelHeight;
- }
- public set TupletNumberLabelHeight(value: number) {
- this.tupletNumberLabelHeight = value;
- }
- public get TupletNumberYOffset(): number {
- return this.tupletNumberYOffset;
- }
- public set TupletNumberYOffset(value: number) {
- this.tupletNumberYOffset = value;
- }
- public get LabelMarginBorderFactor(): number {
- return this.labelMarginBorderFactor;
- }
- public set LabelMarginBorderFactor(value: number) {
- this.labelMarginBorderFactor = value;
- }
- public get TupletVerticalLineLength(): number {
- return this.tupletVerticalLineLength;
- }
- public set TupletVerticalLineLength(value: number) {
- this.tupletVerticalLineLength = value;
- }
- public get RepetitionEndingLabelHeight(): number {
- return this.repetitionEndingLabelHeight;
- }
- public set RepetitionEndingLabelHeight(value: number) {
- this.repetitionEndingLabelHeight = value;
- }
- public get RepetitionEndingLabelXOffset(): number {
- return this.repetitionEndingLabelXOffset;
- }
- public set RepetitionEndingLabelXOffset(value: number) {
- this.repetitionEndingLabelXOffset = value;
- }
- public get RepetitionEndingLabelYOffset(): number {
- return this.repetitionEndingLabelYOffset;
- }
- public set RepetitionEndingLabelYOffset(value: number) {
- this.repetitionEndingLabelYOffset = value;
- }
- public get RepetitionEndingLineYLowerOffset(): number {
- return this.repetitionEndingLineYLowerOffset;
- }
- public set RepetitionEndingLineYLowerOffset(value: number) {
- this.repetitionEndingLineYLowerOffset = value;
- }
- public get RepetitionEndingLineYUpperOffset(): number {
- return this.repetitionEndingLineYUpperOffset;
- }
- public set RepetitionEndingLineYUpperOffset(value: number) {
- this.repetitionEndingLineYUpperOffset = value;
- }
- public get VoltaOffset(): number {
- return this.voltaOffset;
- }
- public set VoltaOffset(value: number) {
- this.voltaOffset = value;
- }
- public get LyricsAlignmentStandard(): TextAlignmentEnum {
- return this.lyricsAlignmentStandard;
- }
- public set LyricsAlignmentStandard(value: TextAlignmentEnum) {
- this.lyricsAlignmentStandard = value;
- }
- public get LyricsHeight(): number {
- return this.lyricsHeight;
- }
- public set LyricsHeight(value: number) {
- this.lyricsHeight = value;
- }
- public get LyricsYOffsetToStaffHeight(): number {
- return this.lyricsYOffsetToStaffHeight;
- }
- public set LyricsYOffsetToStaffHeight(value: number) {
- this.lyricsYOffsetToStaffHeight = value;
- }
- public get VerticalBetweenLyricsDistance(): number {
- return this.verticalBetweenLyricsDistance;
- }
- public set VerticalBetweenLyricsDistance(value: number) {
- this.verticalBetweenLyricsDistance = value;
- }
- public get HorizontalBetweenLyricsDistance(): number {
- return this.horizontalBetweenLyricsDistance;
- }
- public set HorizontalBetweenLyricsDistance(value: number) {
- this.horizontalBetweenLyricsDistance = value;
- }
- public get BetweenSyllableMaximumDistance(): number {
- return this.betweenSyllableMaximumDistance;
- }
- public set BetweenSyllableMaximumDistance(value: number) {
- this.betweenSyllableMaximumDistance = value;
- }
- public get BetweenSyllableMinimumDistance(): number {
- return this.betweenSyllableMinimumDistance;
- }
- public set BetweenSyllableMinimumDistance(value: number) {
- this.betweenSyllableMinimumDistance = value;
- }
- public get LyricOverlapAllowedIntoNextMeasure(): number {
- return this.lyricOverlapAllowedIntoNextMeasure;
- }
- public set LyricOverlapAllowedIntoNextMeasure(value: number) {
- this.lyricOverlapAllowedIntoNextMeasure = value;
- }
- public get MinimumDistanceBetweenDashes(): number {
- return this.minimumDistanceBetweenDashes;
- }
- public set MinimumDistanceBetweenDashes(value: number) {
- this.minimumDistanceBetweenDashes = value;
- }
- public get BezierCurveStepSize(): number {
- return this.bezierCurveStepSize;
- }
- public set BezierCurveStepSize(value: number) {
- this.bezierCurveStepSize = value;
- }
- public get TPow3(): number[] {
- return this.tPower3;
- }
- public set TPow3(value: number[]) {
- this.tPower3 = value;
- }
- public get OneMinusTPow3(): number[] {
- return this.oneMinusTPower3;
- }
- public set OneMinusTPow3(value: number[]) {
- this.oneMinusTPower3 = value;
- }
- public get BezierFactorOne(): number[] {
- return this.factorOne;
- }
- public set BezierFactorOne(value: number[]) {
- this.factorOne = value;
- }
- public get BezierFactorTwo(): number[] {
- return this.factorTwo;
- }
- public set BezierFactorTwo(value: number[]) {
- this.factorTwo = value;
- }
- public get TieGhostObjectWidth(): number {
- return this.tieGhostObjectWidth;
- }
- public set TieGhostObjectWidth(value: number) {
- this.tieGhostObjectWidth = value;
- }
- public get TieYPositionOffsetFactor(): number {
- return this.tieYPositionOffsetFactor;
- }
- public set TieYPositionOffsetFactor(value: number) {
- this.tieYPositionOffsetFactor = value;
- }
- public get MinimumNeededXspaceForTieGhostObject(): number {
- return this.minimumNeededXspaceForTieGhostObject;
- }
- public set MinimumNeededXspaceForTieGhostObject(value: number) {
- this.minimumNeededXspaceForTieGhostObject = value;
- }
- public get TieHeightMinimum(): number {
- return this.tieHeightMinimum;
- }
- public set TieHeightMinimum(value: number) {
- this.tieHeightMinimum = value;
- }
- public get TieHeightMaximum(): number {
- return this.tieHeightMaximum;
- }
- public set TieHeightMaximum(value: number) {
- this.tieHeightMaximum = value;
- }
- public get TieHeightInterpolationK(): number {
- return this.tieHeightInterpolationK;
- }
- public set TieHeightInterpolationK(value: number) {
- this.tieHeightInterpolationK = value;
- }
- public get TieHeightInterpolationD(): number {
- return this.tieHeightInterpolationD;
- }
- public set TieHeightInterpolationD(value: number) {
- this.tieHeightInterpolationD = value;
- }
- public get SlurNoteHeadYOffset(): number {
- return this.slurNoteHeadYOffset;
- }
- public set SlurNoteHeadYOffset(value: number) {
- this.slurNoteHeadYOffset = value;
- }
- public get SlurStemXOffset(): number {
- return this.slurStemXOffset;
- }
- public set SlurStemXOffset(value: number) {
- this.slurStemXOffset = value;
- }
- public get SlurSlopeMaxAngle(): number {
- return this.slurSlopeMaxAngle;
- }
- public set SlurSlopeMaxAngle(value: number) {
- this.slurSlopeMaxAngle = value;
- }
- public get SlurTangentMinAngle(): number {
- return this.slurTangentMinAngle;
- }
- public set SlurTangentMinAngle(value: number) {
- this.slurTangentMinAngle = value;
- }
- public get SlurTangentMaxAngle(): number {
- return this.slurTangentMaxAngle;
- }
- public set SlurTangentMaxAngle(value: number) {
- this.slurTangentMaxAngle = value;
- }
- public get SlursStartingAtSameStaffEntryYOffset(): number {
- return this.slursStartingAtSameStaffEntryYOffset;
- }
- public set SlursStartingAtSameStaffEntryYOffset(value: number) {
- this.slursStartingAtSameStaffEntryYOffset = value;
- }
- public get InstantaneousTempoTextHeight(): number {
- return this.instantaneousTempoTextHeight;
- }
- public set InstantaneousTempoTextHeight(value: number) {
- this.instantaneousTempoTextHeight = value;
- }
- public get ContinuousDynamicTextHeight(): number {
- return this.continuousDynamicTextHeight;
- }
- public set ContinuousDynamicTextHeight(value: number) {
- this.continuousDynamicTextHeight = value;
- }
- public get MoodTextHeight(): number {
- return this.moodTextHeight;
- }
- public set MoodTextHeight(value: number) {
- this.moodTextHeight = value;
- }
- public get ContinuousTempoTextHeight(): number {
- return this.continuousTempoTextHeight;
- }
- public set ContinuousTempoTextHeight(value: number) {
- this.continuousTempoTextHeight = value;
- }
- /** Distance of expressions inside a group */
- public get DynamicExpressionMaxDistance(): number {
- return this.dynamicExpressionMaxDistance;
- }
- public set DynamicExpressionMaxDistance(value: number) {
- this.dynamicExpressionMaxDistance = value;
- }
- /** Space between expressions in a group */
- public get DynamicExpressionSpacer(): number {
- return this.dynamicExpressionSpacer;
- }
- public set DynamicExpressionSpacer(value: number) {
- this.dynamicExpressionSpacer = value;
- }
- public get UnknownTextHeight(): number {
- return this.unknownTextHeight;
- }
- public set UnknownTextHeight(value: number) {
- this.unknownTextHeight = value;
- }
- public get StaffLineWidth(): number {
- return this.staffLineWidth;
- }
- public set StaffLineWidth(value: number) {
- this.staffLineWidth = value;
- }
- public get LedgerLineWidth(): number {
- return this.ledgerLineWidth;
- }
- public set LedgerLineWidth(value: number) {
- this.ledgerLineWidth = value;
- }
- public get WedgeLineWidth(): number {
- return this.wedgeLineWidth;
- }
- public set WedgeLineWidth(value: number) {
- this.wedgeLineWidth = value;
- }
- public get TupletLineWidth(): number {
- return this.tupletLineWidth;
- }
- public set TupletLineWidth(value: number) {
- this.tupletLineWidth = value;
- }
- public get LyricUnderscoreLineWidth(): number {
- return this.lyricUnderscoreLineWidth;
- }
- public set LyricUnderscoreLineWidth(value: number) {
- this.lyricUnderscoreLineWidth = value;
- }
- public get SystemThinLineWidth(): number {
- return this.systemThinLineWidth;
- }
- public set SystemThinLineWidth(value: number) {
- this.systemThinLineWidth = value;
- }
- public get SystemBoldLineWidth(): number {
- return this.systemBoldLineWidth;
- }
- public set SystemBoldLineWidth(value: number) {
- this.systemBoldLineWidth = value;
- }
- public get SystemRepetitionEndingLineWidth(): number {
- return this.systemRepetitionEndingLineWidth;
- }
- public set SystemRepetitionEndingLineWidth(value: number) {
- this.systemRepetitionEndingLineWidth = value;
- }
- public get SystemDotWidth(): number {
- return this.systemDotWidth;
- }
- public set SystemDotWidth(value: number) {
- this.systemDotWidth = value;
- }
- public get DistanceBetweenVerticalSystemLines(): number {
- return this.distanceBetweenVerticalSystemLines;
- }
- public set DistanceBetweenVerticalSystemLines(value: number) {
- this.distanceBetweenVerticalSystemLines = value;
- }
- public get DistanceBetweenDotAndLine(): number {
- return this.distanceBetweenDotAndLine;
- }
- public set DistanceBetweenDotAndLine(value: number) {
- this.distanceBetweenDotAndLine = value;
- }
- public get OctaveShiftLineWidth(): number {
- return this.octaveShiftLineWidth;
- }
- public set OctaveShiftLineWidth(value: number) {
- this.octaveShiftLineWidth = value;
- }
- public get OctaveShiftVerticalLineLength(): number {
- return this.octaveShiftVerticalLineLength;
- }
- public set OctaveShiftVerticalLineLength(value: number) {
- this.octaveShiftVerticalLineLength = value;
- }
- public get GraceLineWidth(): number {
- return this.graceLineWidth;
- }
- public set GraceLineWidth(value: number) {
- this.graceLineWidth = value;
- }
- public get MinimumStaffLineDistance(): number {
- return this.minimumStaffLineDistance;
- }
- public set MinimumStaffLineDistance(value: number) {
- this.minimumStaffLineDistance = value;
- }
- public get MinimumSkyBottomLineDistance(): number {
- return this.minimumSkyBottomLineDistance;
- }
- public set MinimumSkyBottomLineDistance(value: number) {
- this.minimumSkyBottomLineDistance = value;
- }
- public get MinimumCrossedBeamDifferenceMargin(): number {
- return this.minimumCrossedBeamDifferenceMargin;
- }
- public set MinimumCrossedBeamDifferenceMargin(value: number) {
- this.minimumCrossedBeamDifferenceMargin = value;
- }
- public get DisplacedNoteMargin(): number {
- return this.displacedNoteMargin;
- }
- public set DisplacedNoteMargin(value: number) {
- this.displacedNoteMargin = value;
- }
- public get MinNoteDistance(): number {
- return this.minNoteDistance;
- }
- public set MinNoteDistance(value: number) {
- this.minNoteDistance = value;
- }
- public get SubMeasureXSpacingThreshold(): number {
- return this.subMeasureXSpacingThreshold;
- }
- public set SubMeasureXSpacingThreshold(value: number) {
- this.subMeasureXSpacingThreshold = value;
- }
- public get MeasureDynamicsMaxScalingFactor(): number {
- return this.measureDynamicsMaxScalingFactor;
- }
- public set MeasureDynamicsMaxScalingFactor(value: number) {
- this.measureDynamicsMaxScalingFactor = value;
- }
- public get WholeRestXShiftVexflow(): number {
- return this.wholeRestXShiftVexflow;
- }
- public set WholeRestXShiftVexflow(value: number) {
- this.wholeRestXShiftVexflow = value;
- }
- public get MetronomeMarksDrawn(): boolean {
- return this.metronomeMarksDrawn;
- }
- public set MetronomeMarksDrawn(value: boolean) {
- this.metronomeMarksDrawn = value;
- }
- public get MetronomeMarkXShift(): number {
- return this.metronomeMarkXShift;
- }
- public set MetronomeMarkXShift(value: number) {
- this.metronomeMarkXShift = value;
- }
- public get MetronomeMarkYShift(): number {
- return this.metronomeMarkYShift;
- }
- public set MetronomeMarkYShift(value: number) {
- this.metronomeMarkYShift = value;
- }
- public get MaxInstructionsConstValue(): number {
- return this.maxInstructionsConstValue;
- }
- public set MaxInstructionsConstValue(value: number) {
- this.maxInstructionsConstValue = value;
- }
- public get NoteDistances(): number[] {
- return this.noteDistances;
- }
- public set NoteDistances(value: number[]) {
- this.noteDistances = value;
- }
- public get NoteDistancesScalingFactors(): number[] {
- return this.noteDistancesScalingFactors;
- }
- public set NoteDistancesScalingFactors(value: number[]) {
- this.noteDistancesScalingFactors = value;
- }
- public get DurationDistanceDict(): {[_: number]: number; } {
- return this.durationDistanceDict;
- }
- public get DurationScalingDistanceDict(): {[_: number]: number; } {
- return this.durationScalingDistanceDict;
- }
- public get AlignRests(): number {
- return this.alignRests;
- }
- public set AlignRests(value: number) {
- this.alignRests = value;
- }
- public get FillEmptyMeasuresWithWholeRest(): FillEmptyMeasuresWithWholeRests | number {
- return this.fillEmptyMeasuresWithWholeRest;
- }
- public set FillEmptyMeasuresWithWholeRest(value: FillEmptyMeasuresWithWholeRests | number) {
- this.fillEmptyMeasuresWithWholeRest = value;
- }
- public get ArpeggiosGoAcrossVoices(): boolean {
- return this.arpeggiosGoAcrossVoices;
- }
- public set ArpeggiosGoAcrossVoices(value: boolean) {
- this.arpeggiosGoAcrossVoices = value;
- }
- public get RenderArpeggios(): boolean {
- return this.renderArpeggios;
- }
- public set RenderArpeggios(value: boolean) {
- this.renderArpeggios = value;
- }
- public get RenderSlurs(): boolean {
- return this.renderSlurs;
- }
- public set RenderSlurs(value: boolean) {
- this.renderSlurs = value;
- }
- public get ColoringMode(): ColoringMode {
- return this.coloringMode;
- }
- public set ColoringMode(value: ColoringMode) {
- this.coloringMode = value;
- }
- public get ColoringEnabled(): boolean {
- return this.coloringEnabled;
- }
- public set ColoringEnabled(value: boolean) {
- this.coloringEnabled = value;
- }
- public get ColorStemsLikeNoteheads(): boolean {
- return this.colorStemsLikeNoteheads;
- }
- public set ColorStemsLikeNoteheads(value: boolean) {
- this.colorStemsLikeNoteheads = value;
- }
- public get ColorFlags(): boolean {
- return this.colorFlags;
- }
- public set ColorFlags(value: boolean) {
- this.colorFlags = value;
- }
- public get ColorBeams(): boolean {
- return this.colorBeams;
- }
- public set ColorBeams(value: boolean) {
- this.colorBeams = value;
- }
- public get ColoringSetCurrent(): Dictionary<NoteEnum|number, string> {
- return this.coloringSetCustom;
- }
- public set ColoringSetCurrent(value: Dictionary<NoteEnum|number, string>) {
- this.coloringSetCustom = value;
- }
- public get DefaultColorNotehead(): string {
- return this.defaultColorNotehead;
- }
- public set DefaultColorNotehead(value: string) {
- this.defaultColorNotehead = value;
- }
- public get DefaultColorRest(): string {
- return this.defaultColorRest;
- }
- public set DefaultColorRest(value: string) {
- this.defaultColorRest = value;
- }
- public get DefaultColorStem(): string {
- return this.defaultColorStem;
- }
- public set DefaultColorStem(value: string) {
- this.defaultColorStem = value;
- }
- public get DefaultColorLabel(): string {
- return this.defaultColorLabel;
- }
- public set DefaultColorLabel(value: string) {
- this.defaultColorLabel = value;
- }
- public get DefaultColorTitle(): string {
- return this.defaultColorTitle;
- }
- public set DefaultColorTitle(value: string) {
- this.defaultColorTitle = value;
- }
- public get DefaultFontFamily(): string {
- return this.defaultFontFamily;
- }
- public set DefaultFontFamily(value: string) {
- this.defaultFontFamily = value;
- }
- public get DefaultFontStyle(): FontStyles {
- return this.defaultFontStyle;
- }
- public set DefaultFontStyle(value: FontStyles) {
- this.defaultFontStyle = value;
- }
- public get MaxMeasureToDrawIndex(): number {
- return this.maxMeasureToDrawIndex;
- }
- public set MaxMeasureToDrawIndex(value: number) {
- this.maxMeasureToDrawIndex = value;
- }
- public get MinMeasureToDrawIndex(): number {
- return this.minMeasureToDrawIndex;
- }
- public set MinMeasureToDrawIndex(value: number) {
- this.minMeasureToDrawIndex = value;
- }
- public get RenderComposer(): boolean {
- return this.renderComposer;
- }
- public set RenderComposer(value: boolean) {
- this.renderComposer = value;
- }
- public get RenderTitle(): boolean {
- return this.renderTitle;
- }
- public set RenderTitle(value: boolean) {
- this.renderTitle = value;
- }
- public get RenderSubtitle(): boolean {
- return this.renderSubtitle;
- }
- public set RenderSubtitle(value: boolean) {
- this.renderSubtitle = value;
- }
- public get RenderLyricist(): boolean {
- return this.renderLyricist;
- }
- public set RenderLyricist(value: boolean) {
- this.renderLyricist = value;
- }
- public get RenderPartNames(): boolean {
- return this.renderPartNames;
- }
- public set RenderPartNames(value: boolean) {
- this.renderPartNames = value;
- if (!this.renderPartNames) {
- this.renderPartAbbreviations = false;
- }
- }
- public get RenderPartAbbreviations(): boolean {
- return this.renderPartAbbreviations;
- }
- public set RenderPartAbbreviations(value: boolean) {
- this.renderPartAbbreviations = value;
- }
- public get RenderFingerings(): boolean {
- return this.renderFingerings;
- }
- public set RenderFingerings(value: boolean) {
- this.renderFingerings = value;
- }
- public get RenderMeasureNumbers(): boolean {
- return this.renderMeasureNumbers;
- }
- public set RenderMeasureNumbers(value: boolean) {
- this.renderMeasureNumbers = value;
- }
- public get RenderLyrics(): boolean {
- return this.renderLyrics;
- }
- public set RenderLyrics(value: boolean) {
- this.renderLyrics = value;
- }
- public get FingeringPosition(): PlacementEnum {
- return this.fingeringPosition;
- }
- public set FingeringPosition(value: PlacementEnum) {
- this.fingeringPosition = value;
- }
- public get FingeringInsideStafflines(): boolean {
- return this.fingeringInsideStafflines;
- }
- public set FingeringInsideStafflines(value: boolean) {
- this.fingeringInsideStafflines = value;
- }
- public get NewSystemAtXMLNewSystemAttribute(): boolean {
- return this.newSystemAtXMLNewSystemAttribute;
- }
- public set NewSystemAtXMLNewSystemAttribute(value: boolean) {
- this.newSystemAtXMLNewSystemAttribute = value;
- }
- public get NewPageAtXMLNewPageAttribute(): boolean {
- return this.newPageAtXMLNewPageAttribute;
- }
- public set NewPageAtXMLNewPageAttribute(value: boolean) {
- this.newPageAtXMLNewPageAttribute = value;
- }
- public get PageFormat(): PageFormat {
- return this.pageFormat;
- }
- public set PageFormat(value: PageFormat) {
- this.pageFormat = value;
- }
- public get PageBackgroundColor(): string {
- return this.pageBackgroundColor;
- }
- public set PageBackgroundColor(value: string) {
- this.pageBackgroundColor = value;
- }
- public get RenderSingleHorizontalStaffline(): boolean {
- return this.renderSingleHorizontalStaffline;
- }
- public set RenderSingleHorizontalStaffline(value: boolean) {
- this.renderSingleHorizontalStaffline = value;
- }
- public get RestoreCursorAfterRerender(): boolean {
- return this.restoreCursorAfterRerender;
- }
- public set RestoreCursorAfterRerender(value: boolean) {
- this.restoreCursorAfterRerender = value;
- }
- /**
- * This method maps NoteDurations to Distances and DistancesScalingFactors.
- */
- private populateDictionaries(): void {
- for (let i: number = 0; i < this.noteDistances.length; i++) {
- switch (i) {
- case 0:
- this.durationDistanceDict[0.015625] = this.noteDistances[i];
- this.durationScalingDistanceDict[0.015625] = this.noteDistancesScalingFactors[i];
- break;
- case 1:
- this.durationDistanceDict[0.03125] = this.noteDistances[i];
- this.durationScalingDistanceDict[0.03125] = this.noteDistancesScalingFactors[i];
- break;
- case 2:
- this.durationDistanceDict[0.0625] = this.noteDistances[i];
- this.durationScalingDistanceDict[0.0625] = this.noteDistancesScalingFactors[i];
- break;
- case 3:
- this.durationDistanceDict[0.125] = this.noteDistances[i];
- this.durationScalingDistanceDict[0.125] = this.noteDistancesScalingFactors[i];
- break;
- case 4:
- this.durationDistanceDict[0.25] = this.noteDistances[i];
- this.durationScalingDistanceDict[0.25] = this.noteDistancesScalingFactors[i];
- break;
- case 5:
- this.durationDistanceDict[0.5] = this.noteDistances[i];
- this.durationScalingDistanceDict[0.5] = this.noteDistancesScalingFactors[i];
- break;
- case 6:
- this.durationDistanceDict[1.0] = this.noteDistances[i];
- this.durationScalingDistanceDict[1.0] = this.noteDistancesScalingFactors[i];
- break;
- case 7:
- this.durationDistanceDict[2.0] = this.noteDistances[i];
- this.durationScalingDistanceDict[2.0] = this.noteDistancesScalingFactors[i];
- break;
- default:
- // FIXME
- }
- }
- }
- /**
- * Calculate Curve-independend factors, to be used later in the Slur- and TieCurvePoints calculation
- */
- 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);
- }
- }
- }
- // TODO maybe this should be moved to OSMDOptions. Also see OpenSheetMusicDisplay.PageFormatStandards
- 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; // infinite page height
- }
- }
- /** Undefined page format: use default page format. */
- 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;
- }
- }
|