EngravingRules.ts 68 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836
  1. import { PagePlacementEnum } from "./GraphicalMusicPage";
  2. //import {MusicSymbol} from "./MusicSymbol";
  3. import log from "loglevel";
  4. import { TextAlignmentEnum } from "../../Common/Enums/TextAlignment";
  5. import { PlacementEnum } from "../VoiceData/Expressions/AbstractExpression";
  6. import { AutoBeamOptions, AlignRestOption, FillEmptyMeasuresWithWholeRests } from "../../OpenSheetMusicDisplay/OSMDOptions";
  7. import { ColoringModes as ColoringMode } from "./DrawingParameters";
  8. import { Dictionary } from "typescript-collections";
  9. import { FontStyles } from "../../Common/Enums";
  10. import { NoteEnum } from "../../Common/DataObjects/Pitch";
  11. import { ChordSymbolEnum } from "../../MusicalScore/VoiceData/ChordSymbolContainer";
  12. export class EngravingRules {
  13. /** A unit of distance. 1.0 is the distance between lines of a stave for OSMD, which is 10 pixels in Vexflow. */
  14. private static unit: number = 1.0;
  15. private samplingUnit: number;
  16. private staccatoShorteningFactor: number;
  17. /** Height (size) of the sheet title. */
  18. private sheetTitleHeight: number;
  19. private sheetSubtitleHeight: number;
  20. private sheetMinimumDistanceBetweenTitleAndSubtitle: number;
  21. private sheetComposerHeight: number;
  22. private sheetAuthorHeight: number;
  23. private compactMode: boolean;
  24. private pagePlacementEnum: PagePlacementEnum;
  25. private pageHeight: number;
  26. private pageTopMargin: number;
  27. private pageTopMarginNarrow: number;
  28. private pageBottomMargin: number;
  29. private pageLeftMargin: number;
  30. private pageRightMargin: number;
  31. private titleTopDistance: number;
  32. private titleBottomDistance: number;
  33. private systemLeftMargin: number;
  34. private systemRightMargin: number;
  35. private firstSystemMargin: number;
  36. private systemLabelsRightMargin: number;
  37. private systemComposerDistance: number;
  38. private instrumentLabelTextHeight: number;
  39. private minimumDistanceBetweenSystems: number;
  40. private minSkyBottomDistBetweenSystems: number;
  41. private lastSystemMaxScalingFactor: number;
  42. private staffDistance: number;
  43. private betweenStaffDistance: number;
  44. private staffHeight: number;
  45. private tabStaffInterlineHeight: number;
  46. private betweenStaffLinesDistance: number;
  47. /** Whether to automatically beam notes that don't already have beams in XML. */
  48. private autoBeamNotes: boolean;
  49. /** Options for autoBeaming like whether to beam over rests. See AutoBeamOptions interface. */
  50. private autoBeamOptions: AutoBeamOptions;
  51. private beamWidth: number;
  52. private beamSpaceWidth: number;
  53. private beamForwardLength: number;
  54. private clefLeftMargin: number;
  55. private clefRightMargin: number;
  56. private percussionOneLineCutoff: number;
  57. private percussionForceVoicesOneLineCutoff: number;
  58. private betweenKeySymbolsDistance: number;
  59. private keyRightMargin: number;
  60. private rhythmRightMargin: number;
  61. private showRhythmAgainAfterPartEndOrFinalBarline: boolean;
  62. private inStaffClefScalingFactor: number;
  63. private distanceBetweenNaturalAndSymbolWhenCancelling: number;
  64. private noteHelperLinesOffset: number;
  65. private measureLeftMargin: number;
  66. private measureRightMargin: number;
  67. private distanceBetweenLastInstructionAndRepetitionBarline: number;
  68. private arpeggioDistance: number;
  69. private idealStemLength: number;
  70. private stemNoteHeadBorderYOffset: number;
  71. private stemWidth: number;
  72. private stemMargin: number;
  73. private stemMinLength: number;
  74. private stemMaxLength: number;
  75. private beamSlopeMaxAngle: number;
  76. private stemMinAllowedDistanceBetweenNoteHeadAndBeamLine: number;
  77. private setWantedStemDirectionByXml: boolean;
  78. private graceNoteScalingFactor: number;
  79. private graceNoteXOffset: number;
  80. private wedgeOpeningLength: number;
  81. private wedgeMeasureEndOpeningLength: number;
  82. private wedgeMeasureBeginOpeningLength: number;
  83. private wedgePlacementAboveY: number;
  84. private wedgePlacementBelowY: number;
  85. private wedgeHorizontalMargin: number;
  86. private wedgeVerticalMargin: number;
  87. private distanceOffsetBetweenTwoHorizontallyCrossedWedges: number;
  88. private wedgeMinLength: number;
  89. private distanceBetweenAdjacentDynamics: number;
  90. private tempoChangeMeasureValidity: number;
  91. private tempoContinousFactor: number;
  92. private staccatoScalingFactor: number;
  93. private betweenDotsDistance: number;
  94. private ornamentAccidentalScalingFactor: number;
  95. private chordSymbolTextHeight: number;
  96. private chordSymbolXSpacing: number;
  97. private chordSymbolYOffset: number;
  98. private chordSymbolLabelTexts: Dictionary<ChordSymbolEnum, string>;
  99. private measureNumberLabelHeight: number;
  100. private measureNumberLabelOffset: number;
  101. private measureNumberLabelXOffset: number;
  102. /** Whether tuplets should display ratio (3:2 instead of 3 for triplet). Default false. */
  103. private tupletsRatioed: boolean;
  104. /** Whether all tuplets should be bracketed (e.g. |--5--| instead of 5). Default false.
  105. * If false, only tuplets given as bracketed in XML (bracket="yes") will be bracketed.
  106. * (If not given in XML, bracketing is implementation-dependent according to standard)
  107. */
  108. private tupletsBracketed: boolean;
  109. /** Whether all triplets should be bracketed. Overrides tupletsBracketed for triplets.
  110. * If false, only triplets given as bracketed in XML (bracket="yes") will be bracketed.
  111. * (Bracketing all triplets can be cluttering)
  112. */
  113. private tripletsBracketed: boolean;
  114. private tupletNumberLabelHeight: number;
  115. private tupletNumberYOffset: number;
  116. private labelMarginBorderFactor: number;
  117. private tupletVerticalLineLength: number;
  118. private repetitionEndingLabelHeight: number;
  119. private repetitionEndingLabelXOffset: number;
  120. private repetitionEndingLabelYOffset: number;
  121. private repetitionEndingLineYLowerOffset: number;
  122. private repetitionEndingLineYUpperOffset: number;
  123. private voltaOffset: number;
  124. /** Default alignment of lyrics.
  125. * Left alignments will extend text to the right of the bounding box,
  126. * which facilitates spacing by extending measure width.
  127. */
  128. private lyricsAlignmentStandard: TextAlignmentEnum;
  129. private lyricsHeight: number;
  130. private lyricsYOffsetToStaffHeight: number;
  131. private verticalBetweenLyricsDistance: number;
  132. private horizontalBetweenLyricsDistance: number;
  133. private betweenSyllableMaximumDistance: number;
  134. private betweenSyllableMinimumDistance: number;
  135. private lyricOverlapAllowedIntoNextMeasure: number;
  136. private minimumDistanceBetweenDashes: number;
  137. private bezierCurveStepSize: number;
  138. private tPower3: number[];
  139. private oneMinusTPower3: number[];
  140. private factorOne: number[];
  141. private factorTwo: number[];
  142. private tieGhostObjectWidth: number;
  143. private tieYPositionOffsetFactor: number;
  144. private minimumNeededXspaceForTieGhostObject: number;
  145. private tieHeightMinimum: number;
  146. private tieHeightMaximum: number;
  147. private tieHeightInterpolationK: number;
  148. private tieHeightInterpolationD: number;
  149. private slurNoteHeadYOffset: number;
  150. private slurStemXOffset: number;
  151. private slurSlopeMaxAngle: number;
  152. private slurTangentMinAngle: number;
  153. private slurTangentMaxAngle: number;
  154. private slursStartingAtSameStaffEntryYOffset: number;
  155. private instantaneousTempoTextHeight: number;
  156. private continuousDynamicTextHeight: number;
  157. private moodTextHeight: number;
  158. private unknownTextHeight: number;
  159. private continuousTempoTextHeight: number;
  160. private staffLineWidth: number;
  161. private ledgerLineWidth: number;
  162. private ledgerLineStrokeStyle: string;
  163. private wedgeLineWidth: number;
  164. private tupletLineWidth: number;
  165. private lyricUnderscoreLineWidth: number;
  166. private systemThinLineWidth: number;
  167. private systemBoldLineWidth: number;
  168. private systemRepetitionEndingLineWidth: number;
  169. private systemDotWidth: number;
  170. private distanceBetweenVerticalSystemLines: number;
  171. private distanceBetweenDotAndLine: number;
  172. private octaveShiftLineWidth: number;
  173. private octaveShiftVerticalLineLength: number;
  174. private graceLineWidth: number;
  175. private minimumStaffLineDistance: number;
  176. private minSkyBottomDistBetweenStaves: number;
  177. private minimumCrossedBeamDifferenceMargin: number;
  178. private displacedNoteMargin: number;
  179. private minNoteDistance: number;
  180. private subMeasureXSpacingThreshold: number;
  181. private measureDynamicsMaxScalingFactor: number;
  182. private wholeRestXShiftVexflow: number;
  183. private metronomeMarksDrawn: boolean;
  184. private metronomeMarkXShift: number;
  185. private metronomeMarkYShift: number;
  186. private maxInstructionsConstValue: number;
  187. private noteDistances: number[] = [1.0, 1.0, 1.3, 1.6, 2.0, 2.5, 3.0, 4.0];
  188. private noteDistancesScalingFactors: number[] = [1.0, 2.0, 4.0, 8.0, 16.0, 32.0, 64.0, 128.0];
  189. private durationDistanceDict: {[_: number]: number; } = {};
  190. private durationScalingDistanceDict: {[_: number]: number; } = {};
  191. private alignRests: number; // 0 = false, 1 = true, 2 = auto
  192. private fillEmptyMeasuresWithWholeRest: FillEmptyMeasuresWithWholeRests | number;
  193. private arpeggiosGoAcrossVoices: boolean;
  194. private renderArpeggios: boolean;
  195. private renderSlurs: boolean;
  196. private coloringMode: ColoringMode;
  197. private coloringEnabled: boolean;
  198. private colorStemsLikeNoteheads: boolean;
  199. private colorFlags: boolean;
  200. private colorBeams: boolean;
  201. private coloringSetCustom: Dictionary<NoteEnum|number, string>;
  202. private defaultColorNotehead: string;
  203. private defaultColorRest: string;
  204. private defaultColorStem: string;
  205. private defaultColorLabel: string;
  206. private defaultColorTitle: string;
  207. private defaultFontFamily: string;
  208. private defaultFontStyle: FontStyles;
  209. private maxMeasureToDrawIndex: number;
  210. private minMeasureToDrawIndex: number;
  211. /** Whether to render a label for the composer of the piece at the top of the sheet. */
  212. private renderComposer: boolean;
  213. private renderTitle: boolean;
  214. private renderSubtitle: boolean;
  215. private renderLyricist: boolean;
  216. private renderPartNames: boolean;
  217. private renderPartAbbreviations: boolean;
  218. private renderFingerings: boolean;
  219. private renderMeasureNumbers: boolean;
  220. private renderLyrics: boolean;
  221. private dynamicExpressionMaxDistance: number;
  222. private dynamicExpressionSpacer: number;
  223. /** Position of fingering label in relation to corresponding note (left, right supported, above, below experimental) */
  224. private fingeringPosition: PlacementEnum;
  225. private fingeringInsideStafflines: boolean;
  226. private fingeringLabelFontHeight: number;
  227. private fingeringOffsetX: number;
  228. private newSystemAtXMLNewSystemAttribute: boolean;
  229. private newPageAtXMLNewPageAttribute: boolean;
  230. private pageFormat: PageFormat;
  231. private pageBackgroundColor: string; // vexflow-color-string (#FFFFFF). Default undefined/transparent.
  232. private renderSingleHorizontalStaffline: boolean;
  233. private restoreCursorAfterRerender: boolean;
  234. private static fixStafflineBoundingBox: boolean; // TODO temporary workaround
  235. constructor() {
  236. // global variables
  237. this.samplingUnit = EngravingRules.unit * 3;
  238. // Page Label Variables
  239. this.sheetTitleHeight = 4.0;
  240. this.sheetSubtitleHeight = 2.0;
  241. this.sheetMinimumDistanceBetweenTitleAndSubtitle = 1.0;
  242. this.sheetComposerHeight = 2.0;
  243. this.sheetAuthorHeight = 2.0;
  244. // Staff sizing Variables
  245. this.compactMode = false;
  246. this.pagePlacementEnum = PagePlacementEnum.Down;
  247. this.pageHeight = 100001.0;
  248. this.pageTopMargin = 5.0;
  249. this.pageTopMarginNarrow = 0.0; // for compact mode
  250. this.pageBottomMargin = 5.0;
  251. this.pageLeftMargin = 5.0;
  252. this.pageRightMargin = 5.0;
  253. this.titleTopDistance = 9.0;
  254. this.titleBottomDistance = 1.0;
  255. this.staffDistance = 7.0;
  256. this.betweenStaffDistance = 5.0;
  257. this.minimumStaffLineDistance = 4.0;
  258. this.minSkyBottomDistBetweenStaves = 1.0; // default. compacttight mode sets it to 1.0 (as well).
  259. // System Sizing and Label Variables
  260. this.staffHeight = 4.0;
  261. this.tabStaffInterlineHeight = 1.1111;
  262. this.betweenStaffLinesDistance = EngravingRules.unit;
  263. this.systemLeftMargin = 0.0;
  264. this.systemRightMargin = 0.0;
  265. this.firstSystemMargin = 15.0;
  266. this.systemLabelsRightMargin = 2.0;
  267. this.systemComposerDistance = 2.0;
  268. this.instrumentLabelTextHeight = 2;
  269. this.minimumDistanceBetweenSystems = 7.0;
  270. this.minSkyBottomDistBetweenSystems = 5.0;
  271. this.lastSystemMaxScalingFactor = 1.4;
  272. // autoBeam options
  273. this.autoBeamNotes = false;
  274. this.autoBeamOptions = {
  275. beam_middle_rests_only: false,
  276. beam_rests: false,
  277. maintain_stem_directions: false
  278. };
  279. // Beam Sizing Variables
  280. this.beamWidth = EngravingRules.unit / 2.0;
  281. this.beamSpaceWidth = EngravingRules.unit / 3.0;
  282. this.beamForwardLength = 1.25 * EngravingRules.unit;
  283. // Beam Sizing Variables
  284. this.clefLeftMargin = 0.5;
  285. this.clefRightMargin = 0.75;
  286. this.percussionOneLineCutoff = 4;
  287. this.percussionForceVoicesOneLineCutoff = 3;
  288. this.betweenKeySymbolsDistance = 0.2;
  289. this.keyRightMargin = 0.75;
  290. this.rhythmRightMargin = 1.25;
  291. this.showRhythmAgainAfterPartEndOrFinalBarline = true;
  292. this.inStaffClefScalingFactor = 0.8;
  293. this.distanceBetweenNaturalAndSymbolWhenCancelling = 0.4;
  294. // Beam Sizing Variables
  295. this.noteHelperLinesOffset = 0.25;
  296. this.measureLeftMargin = 0.7;
  297. this.measureRightMargin = 0.0;
  298. this.distanceBetweenLastInstructionAndRepetitionBarline = 1.0;
  299. this.arpeggioDistance = 0.6;
  300. // Stems Variables
  301. this.staccatoShorteningFactor = 2;
  302. this.idealStemLength = 3.0;
  303. this.stemNoteHeadBorderYOffset = 0.2;
  304. this.stemWidth = 0.13;
  305. this.stemMargin = 0.2;
  306. this.stemMinLength = 2.5;
  307. this.stemMaxLength = 4.5;
  308. this.beamSlopeMaxAngle = 10.0;
  309. this.stemMinAllowedDistanceBetweenNoteHeadAndBeamLine = 1.0;
  310. this.setWantedStemDirectionByXml = true;
  311. // GraceNote Variables
  312. this.graceNoteScalingFactor = 0.6;
  313. this.graceNoteXOffset = 0.2;
  314. // Wedge Variables
  315. this.wedgeOpeningLength = 1.2;
  316. this.wedgeMeasureEndOpeningLength = 0.75;
  317. this.wedgeMeasureBeginOpeningLength = 0.75;
  318. this.wedgePlacementAboveY = -1.5;
  319. this.wedgePlacementBelowY = 1.5;
  320. this.wedgeHorizontalMargin = 0.6;
  321. this.wedgeVerticalMargin = 0.5;
  322. this.distanceOffsetBetweenTwoHorizontallyCrossedWedges = 0.3;
  323. this.wedgeMinLength = 2.0;
  324. this.distanceBetweenAdjacentDynamics = 0.75;
  325. // Tempo Variables
  326. this.tempoChangeMeasureValidity = 4;
  327. this.tempoContinousFactor = 0.7;
  328. // various
  329. this.staccatoScalingFactor = 0.8;
  330. this.betweenDotsDistance = 0.8;
  331. this.ornamentAccidentalScalingFactor = 0.65;
  332. this.chordSymbolTextHeight = 2.0;
  333. this.chordSymbolXSpacing = 1.0;
  334. this.chordSymbolYOffset = 2.0;
  335. this.chordSymbolLabelTexts = new Dictionary<ChordSymbolEnum, string>();
  336. this.resetChordSymbolLabelTexts(this.chordSymbolLabelTexts);
  337. // Tuplets, MeasureNumber and TupletNumber Labels
  338. this.measureNumberLabelHeight = 1.5 * EngravingRules.unit;
  339. this.measureNumberLabelOffset = 2;
  340. this.measureNumberLabelXOffset = -0.5;
  341. this.tupletsRatioed = false;
  342. this.tupletsBracketed = false;
  343. this.tripletsBracketed = false; // special setting for triplets, overrides tuplet setting (for triplets only)
  344. this.tupletNumberLabelHeight = 1.5 * EngravingRules.unit;
  345. this.tupletNumberYOffset = 0.5;
  346. this.labelMarginBorderFactor = 0.1;
  347. this.tupletVerticalLineLength = 0.5;
  348. // Slur and Tie variables
  349. this.bezierCurveStepSize = 1000;
  350. this.calculateCurveParametersArrays();
  351. this.tieGhostObjectWidth = 0.75;
  352. this.tieYPositionOffsetFactor = 0.3;
  353. this.minimumNeededXspaceForTieGhostObject = 1.0;
  354. this.tieHeightMinimum = 0.28;
  355. this.tieHeightMaximum = 1.2;
  356. this.tieHeightInterpolationK = 0.0288;
  357. this.tieHeightInterpolationD = 0.136;
  358. this.slurNoteHeadYOffset = 0.5;
  359. this.slurStemXOffset = 0.3;
  360. this.slurSlopeMaxAngle = 15.0;
  361. this.slurTangentMinAngle = 30.0;
  362. this.slurTangentMaxAngle = 80.0;
  363. this.slursStartingAtSameStaffEntryYOffset = 0.8;
  364. // Repetitions
  365. this.repetitionEndingLabelHeight = 2.0;
  366. this.repetitionEndingLabelXOffset = 0.5;
  367. this.repetitionEndingLabelYOffset = 0.3;
  368. this.repetitionEndingLineYLowerOffset = 0.5;
  369. this.repetitionEndingLineYUpperOffset = 0.3;
  370. this.voltaOffset = 2.5;
  371. // Lyrics
  372. this.lyricsAlignmentStandard = TextAlignmentEnum.LeftBottom; // CenterBottom and LeftBottom tested, spacing-optimized
  373. this.lyricsHeight = 2.0; // actually size of lyrics
  374. this.lyricsYOffsetToStaffHeight = 3.0; // distance between lyrics and staff. could partly be even lower/dynamic
  375. this.verticalBetweenLyricsDistance = 0.5;
  376. this.horizontalBetweenLyricsDistance = 0.2;
  377. this.betweenSyllableMaximumDistance = 10.0;
  378. this.betweenSyllableMinimumDistance = 0.5; // + 1.0 for CenterAlignment added in lyrics spacing
  379. this.lyricOverlapAllowedIntoNextMeasure = 3.4; // optimal for dashed last lyric, see Land der Berge
  380. this.minimumDistanceBetweenDashes = 10;
  381. // expressions variables
  382. this.instantaneousTempoTextHeight = 2.3;
  383. this.continuousDynamicTextHeight = 2.3;
  384. this.moodTextHeight = 2.3;
  385. this.unknownTextHeight = 2.0;
  386. this.continuousTempoTextHeight = 2.3;
  387. this.dynamicExpressionMaxDistance = 2;
  388. this.dynamicExpressionSpacer = 0.5;
  389. // Line Widths
  390. this.staffLineWidth = 0.12;
  391. this.ledgerLineWidth = undefined; // if not undefined, the vexflow default will be overwritten
  392. this.ledgerLineStrokeStyle = undefined; // if not undefined, the vexflow default will be overwritten
  393. this.wedgeLineWidth = 0.12;
  394. this.tupletLineWidth = 0.12;
  395. this.lyricUnderscoreLineWidth = 0.12;
  396. this.systemThinLineWidth = 0.12;
  397. this.systemBoldLineWidth = EngravingRules.unit / 2.0;
  398. this.systemRepetitionEndingLineWidth = 0.12;
  399. this.systemDotWidth = EngravingRules.unit / 5.0;
  400. this.distanceBetweenVerticalSystemLines = 0.35;
  401. this.distanceBetweenDotAndLine = 0.7;
  402. this.octaveShiftLineWidth = 0.12;
  403. this.octaveShiftVerticalLineLength = EngravingRules.unit;
  404. this.graceLineWidth = this.staffLineWidth * this.GraceNoteScalingFactor;
  405. // Line Widths
  406. this.minimumCrossedBeamDifferenceMargin = 0.0001;
  407. // xSpacing Variables
  408. this.displacedNoteMargin = 0.1;
  409. this.minNoteDistance = 2.0;
  410. this.subMeasureXSpacingThreshold = 35;
  411. this.measureDynamicsMaxScalingFactor = 2.5;
  412. this.wholeRestXShiftVexflow = -2.5; // VexFlow draws rest notes too far to the right
  413. this.metronomeMarksDrawn = true;
  414. this.metronomeMarkXShift = -6; // our unit, is taken * unitInPixels
  415. this.metronomeMarkYShift = -0.5;
  416. // Render options (whether to render specific or invisible elements)
  417. this.alignRests = AlignRestOption.Never; // 0 = false, 1 = true, 2 = auto
  418. this.fillEmptyMeasuresWithWholeRest = FillEmptyMeasuresWithWholeRests.No;
  419. this.arpeggiosGoAcrossVoices = false; // safe option, as otherwise arpeggios will always go across all voices in Vexflow, which is often unwanted
  420. this.renderArpeggios = true;
  421. this.renderSlurs = true;
  422. this.coloringMode = ColoringMode.XML;
  423. this.coloringEnabled = true;
  424. this.colorStemsLikeNoteheads = false;
  425. this.colorBeams = true;
  426. this.colorFlags = true;
  427. this.defaultColorNotehead = "#000000"; // black. undefined is only black if a note's color hasn't been changed before.
  428. this.defaultColorRest = this.defaultColorNotehead;
  429. this.defaultColorStem = this.defaultColorNotehead;
  430. this.defaultColorLabel = this.defaultColorNotehead;
  431. this.defaultColorTitle = this.defaultColorNotehead;
  432. this.defaultFontFamily = "Times New Roman"; // what OSMD was initially optimized for
  433. this.defaultFontStyle = FontStyles.Regular;
  434. this.maxMeasureToDrawIndex = Number.MAX_VALUE;
  435. this.minMeasureToDrawIndex = 0;
  436. this.renderComposer = true;
  437. this.renderTitle = true;
  438. this.renderSubtitle = true;
  439. this.renderLyricist = true;
  440. this.renderPartNames = true;
  441. this.renderPartAbbreviations = true;
  442. this.renderFingerings = true;
  443. this.renderMeasureNumbers = true;
  444. this.renderLyrics = true;
  445. this.fingeringPosition = PlacementEnum.Left; // easier to get bounding box, and safer for vertical layout
  446. this.fingeringInsideStafflines = false;
  447. this.fingeringLabelFontHeight = 1.7;
  448. this.fingeringOffsetX = 0.0;
  449. this.newSystemAtXMLNewSystemAttribute = false;
  450. this.newPageAtXMLNewPageAttribute = false;
  451. this.restoreCursorAfterRerender = true;
  452. EngravingRules.FixStafflineBoundingBox = false; // TODO temporary workaround
  453. this.pageFormat = PageFormat.UndefinedPageFormat; // default: undefined / 'infinite' height page, using the canvas'/container's width and height
  454. this.pageBackgroundColor = undefined; // default: transparent. half-transparent white: #FFFFFF88"
  455. this.renderSingleHorizontalStaffline = false;
  456. this.populateDictionaries();
  457. try {
  458. this.maxInstructionsConstValue = this.ClefLeftMargin + this.ClefRightMargin + this.KeyRightMargin + this.RhythmRightMargin + 11;
  459. //if (FontInfo.Info !== undefined) {
  460. // this.maxInstructionsConstValue += FontInfo.Info.getBoundingBox(MusicSymbol.G_CLEF).width
  461. // + FontInfo.Info.getBoundingBox(MusicSymbol.FOUR).width
  462. // + 7 * FontInfo.Info.getBoundingBox(MusicSymbol.SHARP).width;
  463. //}
  464. } catch (ex) {
  465. log.info("EngravingRules()", ex);
  466. }
  467. }
  468. // these two need to be static so that we can avoid passing EngravingRules to BoundingBox in lots of code
  469. public static get FixStafflineBoundingBox(): boolean {
  470. return EngravingRules.fixStafflineBoundingBox;
  471. }
  472. public static set FixStafflineBoundingBox(value: boolean) {
  473. EngravingRules.fixStafflineBoundingBox = value;
  474. }
  475. public get SamplingUnit(): number {
  476. return this.samplingUnit;
  477. }
  478. public get SheetTitleHeight(): number {
  479. return this.sheetTitleHeight;
  480. }
  481. public set SheetTitleHeight(value: number) {
  482. this.sheetTitleHeight = value;
  483. }
  484. public get SheetSubtitleHeight(): number {
  485. return this.sheetSubtitleHeight;
  486. }
  487. public set SheetSubtitleHeight(value: number) {
  488. this.sheetSubtitleHeight = value;
  489. }
  490. public get SheetMinimumDistanceBetweenTitleAndSubtitle(): number {
  491. return this.sheetMinimumDistanceBetweenTitleAndSubtitle;
  492. }
  493. public set SheetMinimumDistanceBetweenTitleAndSubtitle(value: number) {
  494. this.sheetMinimumDistanceBetweenTitleAndSubtitle = value;
  495. }
  496. public get SheetComposerHeight(): number {
  497. return this.sheetComposerHeight;
  498. }
  499. public set SheetComposerHeight(value: number) {
  500. this.sheetComposerHeight = value;
  501. }
  502. public get SheetAuthorHeight(): number {
  503. return this.sheetAuthorHeight;
  504. }
  505. public set SheetAuthorHeight(value: number) {
  506. this.sheetAuthorHeight = value;
  507. }
  508. public get PagePlacement(): PagePlacementEnum {
  509. return this.pagePlacementEnum;
  510. }
  511. public set PagePlacement(value: PagePlacementEnum) {
  512. this.pagePlacementEnum = value;
  513. }
  514. public get CompactMode(): boolean {
  515. return this.compactMode;
  516. }
  517. public set CompactMode(value: boolean) {
  518. this.compactMode = value;
  519. }
  520. public get PageHeight(): number {
  521. return this.pageHeight;
  522. }
  523. public set PageHeight(value: number) {
  524. this.pageHeight = value;
  525. }
  526. public get PageTopMargin(): number {
  527. return this.pageTopMargin;
  528. }
  529. public set PageTopMargin(value: number) {
  530. this.pageTopMargin = value;
  531. }
  532. public get PageTopMarginNarrow(): number {
  533. return this.pageTopMarginNarrow;
  534. }
  535. public set PageTopMarginNarrow(value: number) {
  536. this.pageTopMarginNarrow = value;
  537. }
  538. public get PageBottomMargin(): number {
  539. return this.pageBottomMargin;
  540. }
  541. public set PageBottomMargin(value: number) {
  542. this.pageBottomMargin = value;
  543. }
  544. public get PageLeftMargin(): number {
  545. return this.pageLeftMargin;
  546. }
  547. public set PageLeftMargin(value: number) {
  548. this.pageLeftMargin = value;
  549. }
  550. public get PageRightMargin(): number {
  551. return this.pageRightMargin;
  552. }
  553. public set PageRightMargin(value: number) {
  554. this.pageRightMargin = value;
  555. }
  556. public get TitleTopDistance(): number {
  557. return this.titleTopDistance;
  558. }
  559. public set TitleTopDistance(value: number) {
  560. this.titleTopDistance = value;
  561. }
  562. public get TitleBottomDistance(): number {
  563. return this.titleBottomDistance;
  564. }
  565. public set TitleBottomDistance(value: number) {
  566. this.titleBottomDistance = value;
  567. }
  568. public get SystemComposerDistance(): number {
  569. return this.systemComposerDistance;
  570. }
  571. public set SystemComposerDistance(value: number) {
  572. this.systemComposerDistance = value;
  573. }
  574. public get InstrumentLabelTextHeight(): number {
  575. return this.instrumentLabelTextHeight;
  576. }
  577. public set InstrumentLabelTextHeight(value: number) {
  578. this.instrumentLabelTextHeight = value;
  579. }
  580. public get SystemLeftMargin(): number {
  581. return this.systemLeftMargin;
  582. }
  583. public set SystemLeftMargin(value: number) {
  584. this.systemLeftMargin = value;
  585. }
  586. public get SystemRightMargin(): number {
  587. return this.systemRightMargin;
  588. }
  589. public set SystemRightMargin(value: number) {
  590. this.systemRightMargin = value;
  591. }
  592. public get FirstSystemMargin(): number {
  593. return this.firstSystemMargin;
  594. }
  595. public set FirstSystemMargin(value: number) {
  596. this.firstSystemMargin = value;
  597. }
  598. public get SystemLabelsRightMargin(): number {
  599. return this.systemLabelsRightMargin;
  600. }
  601. public set SystemLabelsRightMargin(value: number) {
  602. this.systemLabelsRightMargin = value;
  603. }
  604. public get MinimumDistanceBetweenSystems(): number {
  605. return this.minimumDistanceBetweenSystems;
  606. }
  607. public set MinimumDistanceBetweenSystems(value: number) {
  608. this.minimumDistanceBetweenSystems = value;
  609. }
  610. public get MinSkyBottomDistBetweenSystems(): number {
  611. return this.minSkyBottomDistBetweenSystems;
  612. }
  613. public set MinSkyBottomDistBetweenSystems(value: number) {
  614. this.minSkyBottomDistBetweenSystems = value;
  615. }
  616. public get LastSystemMaxScalingFactor(): number {
  617. return this.lastSystemMaxScalingFactor;
  618. }
  619. public set LastSystemMaxScalingFactor(value: number) {
  620. this.lastSystemMaxScalingFactor = value;
  621. }
  622. public get StaffDistance(): number {
  623. return this.staffDistance;
  624. }
  625. public set StaffDistance(value: number) {
  626. this.staffDistance = value;
  627. }
  628. public get BetweenStaffDistance(): number {
  629. return this.betweenStaffDistance;
  630. }
  631. public set BetweenStaffDistance(value: number) {
  632. this.betweenStaffDistance = value;
  633. }
  634. public get StaffHeight(): number {
  635. return this.staffHeight;
  636. }
  637. public set StaffHeight(value: number) {
  638. this.staffHeight = value;
  639. }
  640. public get TabStaffInterlineHeight(): number {
  641. return this.tabStaffInterlineHeight;
  642. }
  643. public set TabStaffInterlineHeight(value: number) {
  644. this.tabStaffInterlineHeight = value;
  645. }
  646. public get BetweenStaffLinesDistance(): number {
  647. return this.betweenStaffLinesDistance;
  648. }
  649. public set BetweenStaffLinesDistance(value: number) {
  650. this.betweenStaffLinesDistance = value;
  651. }
  652. public get AutoBeamNotes(): boolean {
  653. return this.autoBeamNotes;
  654. }
  655. public set AutoBeamNotes(value: boolean) {
  656. this.autoBeamNotes = value;
  657. }
  658. public get AutoBeamOptions(): AutoBeamOptions {
  659. return this.autoBeamOptions;
  660. }
  661. public set AutoBeamOptions(value: AutoBeamOptions) {
  662. this.autoBeamOptions = value;
  663. }
  664. public get BeamWidth(): number {
  665. return this.beamWidth;
  666. }
  667. public set BeamWidth(value: number) {
  668. this.beamWidth = value;
  669. }
  670. public get BeamSpaceWidth(): number {
  671. return this.beamSpaceWidth;
  672. }
  673. public set BeamSpaceWidth(value: number) {
  674. this.beamSpaceWidth = value;
  675. }
  676. public get BeamForwardLength(): number {
  677. return this.beamForwardLength;
  678. }
  679. public set BeamForwardLength(value: number) {
  680. this.beamForwardLength = value;
  681. }
  682. public get BetweenKeySymbolsDistance(): number {
  683. return this.betweenKeySymbolsDistance;
  684. }
  685. public set BetweenKeySymbolsDistance(value: number) {
  686. this.betweenKeySymbolsDistance = value;
  687. }
  688. public get ClefLeftMargin(): number {
  689. return this.clefLeftMargin;
  690. }
  691. public set ClefLeftMargin(value: number) {
  692. this.clefLeftMargin = value;
  693. }
  694. public get ClefRightMargin(): number {
  695. return this.clefRightMargin;
  696. }
  697. public set ClefRightMargin(value: number) {
  698. this.clefRightMargin = value;
  699. }
  700. public get PercussionOneLineCutoff(): number {
  701. return this.percussionOneLineCutoff;
  702. }
  703. public set PercussionOneLineCutoff(value: number) {
  704. this.percussionOneLineCutoff = value;
  705. }
  706. public get PercussionForceVoicesOneLineCutoff(): number {
  707. return this.percussionForceVoicesOneLineCutoff;
  708. }
  709. public set PercussionForceVoicesOneLineCutoff(value: number) {
  710. this.percussionForceVoicesOneLineCutoff = value;
  711. }
  712. public get KeyRightMargin(): number {
  713. return this.keyRightMargin;
  714. }
  715. public set KeyRightMargin(value: number) {
  716. this.keyRightMargin = value;
  717. }
  718. public get RhythmRightMargin(): number {
  719. return this.rhythmRightMargin;
  720. }
  721. public set RhythmRightMargin(value: number) {
  722. this.rhythmRightMargin = value;
  723. }
  724. public get ShowRhythmAgainAfterPartEndOrFinalBarline(): boolean {
  725. return this.showRhythmAgainAfterPartEndOrFinalBarline;
  726. }
  727. public set ShowRhythmAgainAfterPartEndOrFinalBarline(value: boolean) {
  728. this.showRhythmAgainAfterPartEndOrFinalBarline = value;
  729. }
  730. public get InStaffClefScalingFactor(): number {
  731. return this.inStaffClefScalingFactor;
  732. }
  733. public set InStaffClefScalingFactor(value: number) {
  734. this.inStaffClefScalingFactor = value;
  735. }
  736. public get DistanceBetweenNaturalAndSymbolWhenCancelling(): number {
  737. return this.distanceBetweenNaturalAndSymbolWhenCancelling;
  738. }
  739. public set DistanceBetweenNaturalAndSymbolWhenCancelling(value: number) {
  740. this.distanceBetweenNaturalAndSymbolWhenCancelling = value;
  741. }
  742. public get NoteHelperLinesOffset(): number {
  743. return this.noteHelperLinesOffset;
  744. }
  745. public set NoteHelperLinesOffset(value: number) {
  746. this.noteHelperLinesOffset = value;
  747. }
  748. public get MeasureLeftMargin(): number {
  749. return this.measureLeftMargin;
  750. }
  751. public set MeasureLeftMargin(value: number) {
  752. this.measureLeftMargin = value;
  753. }
  754. public get MeasureRightMargin(): number {
  755. return this.measureRightMargin;
  756. }
  757. public set MeasureRightMargin(value: number) {
  758. this.measureRightMargin = value;
  759. }
  760. public get DistanceBetweenLastInstructionAndRepetitionBarline(): number {
  761. return this.distanceBetweenLastInstructionAndRepetitionBarline;
  762. }
  763. public set DistanceBetweenLastInstructionAndRepetitionBarline(value: number) {
  764. this.distanceBetweenLastInstructionAndRepetitionBarline = value;
  765. }
  766. public get ArpeggioDistance(): number {
  767. return this.arpeggioDistance;
  768. }
  769. public set ArpeggioDistance(value: number) {
  770. this.arpeggioDistance = value;
  771. }
  772. public get StaccatoShorteningFactor(): number {
  773. return this.staccatoShorteningFactor;
  774. }
  775. public set StaccatoShorteningFactor(value: number) {
  776. this.staccatoShorteningFactor = value;
  777. }
  778. public get IdealStemLength(): number {
  779. return this.idealStemLength;
  780. }
  781. public set IdealStemLength(value: number) {
  782. this.idealStemLength = value;
  783. }
  784. public get StemNoteHeadBorderYOffset(): number {
  785. return this.stemNoteHeadBorderYOffset;
  786. }
  787. public set StemNoteHeadBorderYOffset(value: number) {
  788. this.stemNoteHeadBorderYOffset = value;
  789. }
  790. public get StemWidth(): number {
  791. return this.stemWidth;
  792. }
  793. public set StemWidth(value: number) {
  794. this.stemWidth = value;
  795. }
  796. public get StemMargin(): number {
  797. return this.stemMargin;
  798. }
  799. public set StemMargin(value: number) {
  800. this.stemMargin = value;
  801. }
  802. public get StemMinLength(): number {
  803. return this.stemMinLength;
  804. }
  805. public set StemMinLength(value: number) {
  806. this.stemMinLength = value;
  807. }
  808. public get StemMaxLength(): number {
  809. return this.stemMaxLength;
  810. }
  811. public set StemMaxLength(value: number) {
  812. this.stemMaxLength = value;
  813. }
  814. public get BeamSlopeMaxAngle(): number {
  815. return this.beamSlopeMaxAngle;
  816. }
  817. public set BeamSlopeMaxAngle(value: number) {
  818. this.beamSlopeMaxAngle = value;
  819. }
  820. public get StemMinAllowedDistanceBetweenNoteHeadAndBeamLine(): number {
  821. return this.stemMinAllowedDistanceBetweenNoteHeadAndBeamLine;
  822. }
  823. public set StemMinAllowedDistanceBetweenNoteHeadAndBeamLine(value: number) {
  824. this.stemMinAllowedDistanceBetweenNoteHeadAndBeamLine = value;
  825. }
  826. public get SetWantedStemDirectionByXml(): boolean {
  827. return this.setWantedStemDirectionByXml;
  828. }
  829. public set SetWantedStemDirectionByXml(value: boolean) {
  830. this.setWantedStemDirectionByXml = value;
  831. }
  832. public get GraceNoteScalingFactor(): number {
  833. return this.graceNoteScalingFactor;
  834. }
  835. public set GraceNoteScalingFactor(value: number) {
  836. this.graceNoteScalingFactor = value;
  837. }
  838. public get GraceNoteXOffset(): number {
  839. return this.graceNoteXOffset;
  840. }
  841. public set GraceNoteXOffset(value: number) {
  842. this.graceNoteXOffset = value;
  843. }
  844. public get WedgeOpeningLength(): number {
  845. return this.wedgeOpeningLength;
  846. }
  847. public set WedgeOpeningLength(value: number) {
  848. this.wedgeOpeningLength = value;
  849. }
  850. public get WedgeMeasureEndOpeningLength(): number {
  851. return this.wedgeMeasureEndOpeningLength;
  852. }
  853. public set WedgeMeasureEndOpeningLength(value: number) {
  854. this.wedgeMeasureEndOpeningLength = value;
  855. }
  856. public get WedgeMeasureBeginOpeningLength(): number {
  857. return this.wedgeMeasureBeginOpeningLength;
  858. }
  859. public set WedgeMeasureBeginOpeningLength(value: number) {
  860. this.wedgeMeasureBeginOpeningLength = value;
  861. }
  862. public get WedgePlacementAboveY(): number {
  863. return this.wedgePlacementAboveY;
  864. }
  865. public set WedgePlacementAboveY(value: number) {
  866. this.wedgePlacementAboveY = value;
  867. }
  868. public get WedgePlacementBelowY(): number {
  869. return this.wedgePlacementBelowY;
  870. }
  871. public set WedgePlacementBelowY(value: number) {
  872. this.wedgePlacementBelowY = value;
  873. }
  874. public get WedgeHorizontalMargin(): number {
  875. return this.wedgeHorizontalMargin;
  876. }
  877. public set WedgeHorizontalMargin(value: number) {
  878. this.wedgeHorizontalMargin = value;
  879. }
  880. public get WedgeVerticalMargin(): number {
  881. return this.wedgeVerticalMargin;
  882. }
  883. public set WedgeVerticalMargin(value: number) {
  884. this.wedgeVerticalMargin = value;
  885. }
  886. public get DistanceOffsetBetweenTwoHorizontallyCrossedWedges(): number {
  887. return this.distanceOffsetBetweenTwoHorizontallyCrossedWedges;
  888. }
  889. public set DistanceOffsetBetweenTwoHorizontallyCrossedWedges(value: number) {
  890. this.distanceOffsetBetweenTwoHorizontallyCrossedWedges = value;
  891. }
  892. public get WedgeMinLength(): number {
  893. return this.wedgeMinLength;
  894. }
  895. public set WedgeMinLength(value: number) {
  896. this.wedgeMinLength = value;
  897. }
  898. public get DistanceBetweenAdjacentDynamics(): number {
  899. return this.distanceBetweenAdjacentDynamics;
  900. }
  901. public set DistanceBetweenAdjacentDynamics(value: number) {
  902. this.distanceBetweenAdjacentDynamics = value;
  903. }
  904. public get TempoChangeMeasureValidity(): number {
  905. return this.tempoChangeMeasureValidity;
  906. }
  907. public set TempoChangeMeasureValidity(value: number) {
  908. this.tempoChangeMeasureValidity = value;
  909. }
  910. public get TempoContinousFactor(): number {
  911. return this.tempoContinousFactor;
  912. }
  913. public set TempoContinousFactor(value: number) {
  914. this.tempoContinousFactor = value;
  915. }
  916. public get StaccatoScalingFactor(): number {
  917. return this.staccatoScalingFactor;
  918. }
  919. public set StaccatoScalingFactor(value: number) {
  920. this.staccatoScalingFactor = value;
  921. }
  922. public get BetweenDotsDistance(): number {
  923. return this.betweenDotsDistance;
  924. }
  925. public set BetweenDotsDistance(value: number) {
  926. this.betweenDotsDistance = value;
  927. }
  928. public get OrnamentAccidentalScalingFactor(): number {
  929. return this.ornamentAccidentalScalingFactor;
  930. }
  931. public set OrnamentAccidentalScalingFactor(value: number) {
  932. this.ornamentAccidentalScalingFactor = value;
  933. }
  934. public get ChordSymbolTextHeight(): number {
  935. return this.chordSymbolTextHeight;
  936. }
  937. public set ChordSymbolTextHeight(value: number) {
  938. this.chordSymbolTextHeight = value;
  939. }
  940. public get ChordSymbolXSpacing(): number {
  941. return this.chordSymbolXSpacing;
  942. }
  943. public set ChordSymbolXSpacing(value: number) {
  944. this.chordSymbolXSpacing = value;
  945. }
  946. public get ChordSymbolYOffset(): number {
  947. return this.chordSymbolYOffset;
  948. }
  949. public set ChordSymbolYOffset(value: number) {
  950. this.chordSymbolYOffset = value;
  951. }
  952. public setChordSymbolLabelText(key: ChordSymbolEnum, value: string): void {
  953. this.chordSymbolLabelTexts.setValue(key, value);
  954. }
  955. public get ChordSymbolLabelTexts(): Dictionary<ChordSymbolEnum, string> {
  956. return this.chordSymbolLabelTexts;
  957. }
  958. public set ChordSymbolLabelTexts(value: Dictionary<ChordSymbolEnum, string>) {
  959. this.chordSymbolLabelTexts = value;
  960. }
  961. public get MeasureNumberLabelHeight(): number {
  962. return this.measureNumberLabelHeight;
  963. }
  964. public set MeasureNumberLabelHeight(value: number) {
  965. this.measureNumberLabelHeight = value;
  966. }
  967. public get MeasureNumberLabelOffset(): number {
  968. return this.measureNumberLabelOffset;
  969. }
  970. public set MeasureNumberLabelOffset(value: number) {
  971. this.measureNumberLabelOffset = value;
  972. }
  973. public get MeasureNumberLabelXOffset(): number {
  974. return this.measureNumberLabelXOffset;
  975. }
  976. public set MeasureNumberLabelXOffset(value: number) {
  977. this.measureNumberLabelXOffset = value;
  978. }
  979. public get TupletsRatioed(): boolean {
  980. return this.tupletsRatioed;
  981. }
  982. public set TupletsRatioed(value: boolean) {
  983. this.tupletsRatioed = value;
  984. }
  985. public get TupletsBracketed(): boolean {
  986. return this.tupletsBracketed;
  987. }
  988. public set TupletsBracketed(value: boolean) {
  989. this.tupletsBracketed = value;
  990. }
  991. public get TripletsBracketed(): boolean {
  992. return this.tripletsBracketed;
  993. }
  994. public set TripletsBracketed(value: boolean) {
  995. this.tripletsBracketed = value;
  996. }
  997. public get TupletNumberLabelHeight(): number {
  998. return this.tupletNumberLabelHeight;
  999. }
  1000. public set TupletNumberLabelHeight(value: number) {
  1001. this.tupletNumberLabelHeight = value;
  1002. }
  1003. public get TupletNumberYOffset(): number {
  1004. return this.tupletNumberYOffset;
  1005. }
  1006. public set TupletNumberYOffset(value: number) {
  1007. this.tupletNumberYOffset = value;
  1008. }
  1009. public get LabelMarginBorderFactor(): number {
  1010. return this.labelMarginBorderFactor;
  1011. }
  1012. public set LabelMarginBorderFactor(value: number) {
  1013. this.labelMarginBorderFactor = value;
  1014. }
  1015. public get TupletVerticalLineLength(): number {
  1016. return this.tupletVerticalLineLength;
  1017. }
  1018. public set TupletVerticalLineLength(value: number) {
  1019. this.tupletVerticalLineLength = value;
  1020. }
  1021. public get RepetitionEndingLabelHeight(): number {
  1022. return this.repetitionEndingLabelHeight;
  1023. }
  1024. public set RepetitionEndingLabelHeight(value: number) {
  1025. this.repetitionEndingLabelHeight = value;
  1026. }
  1027. public get RepetitionEndingLabelXOffset(): number {
  1028. return this.repetitionEndingLabelXOffset;
  1029. }
  1030. public set RepetitionEndingLabelXOffset(value: number) {
  1031. this.repetitionEndingLabelXOffset = value;
  1032. }
  1033. public get RepetitionEndingLabelYOffset(): number {
  1034. return this.repetitionEndingLabelYOffset;
  1035. }
  1036. public set RepetitionEndingLabelYOffset(value: number) {
  1037. this.repetitionEndingLabelYOffset = value;
  1038. }
  1039. public get RepetitionEndingLineYLowerOffset(): number {
  1040. return this.repetitionEndingLineYLowerOffset;
  1041. }
  1042. public set RepetitionEndingLineYLowerOffset(value: number) {
  1043. this.repetitionEndingLineYLowerOffset = value;
  1044. }
  1045. public get RepetitionEndingLineYUpperOffset(): number {
  1046. return this.repetitionEndingLineYUpperOffset;
  1047. }
  1048. public set RepetitionEndingLineYUpperOffset(value: number) {
  1049. this.repetitionEndingLineYUpperOffset = value;
  1050. }
  1051. public get VoltaOffset(): number {
  1052. return this.voltaOffset;
  1053. }
  1054. public set VoltaOffset(value: number) {
  1055. this.voltaOffset = value;
  1056. }
  1057. public get LyricsAlignmentStandard(): TextAlignmentEnum {
  1058. return this.lyricsAlignmentStandard;
  1059. }
  1060. public set LyricsAlignmentStandard(value: TextAlignmentEnum) {
  1061. this.lyricsAlignmentStandard = value;
  1062. }
  1063. public get LyricsHeight(): number {
  1064. return this.lyricsHeight;
  1065. }
  1066. public set LyricsHeight(value: number) {
  1067. this.lyricsHeight = value;
  1068. }
  1069. public get LyricsYOffsetToStaffHeight(): number {
  1070. return this.lyricsYOffsetToStaffHeight;
  1071. }
  1072. public set LyricsYOffsetToStaffHeight(value: number) {
  1073. this.lyricsYOffsetToStaffHeight = value;
  1074. }
  1075. public get VerticalBetweenLyricsDistance(): number {
  1076. return this.verticalBetweenLyricsDistance;
  1077. }
  1078. public set VerticalBetweenLyricsDistance(value: number) {
  1079. this.verticalBetweenLyricsDistance = value;
  1080. }
  1081. public get HorizontalBetweenLyricsDistance(): number {
  1082. return this.horizontalBetweenLyricsDistance;
  1083. }
  1084. public set HorizontalBetweenLyricsDistance(value: number) {
  1085. this.horizontalBetweenLyricsDistance = value;
  1086. }
  1087. public get BetweenSyllableMaximumDistance(): number {
  1088. return this.betweenSyllableMaximumDistance;
  1089. }
  1090. public set BetweenSyllableMaximumDistance(value: number) {
  1091. this.betweenSyllableMaximumDistance = value;
  1092. }
  1093. public get BetweenSyllableMinimumDistance(): number {
  1094. return this.betweenSyllableMinimumDistance;
  1095. }
  1096. public set BetweenSyllableMinimumDistance(value: number) {
  1097. this.betweenSyllableMinimumDistance = value;
  1098. }
  1099. public get LyricOverlapAllowedIntoNextMeasure(): number {
  1100. return this.lyricOverlapAllowedIntoNextMeasure;
  1101. }
  1102. public set LyricOverlapAllowedIntoNextMeasure(value: number) {
  1103. this.lyricOverlapAllowedIntoNextMeasure = value;
  1104. }
  1105. public get MinimumDistanceBetweenDashes(): number {
  1106. return this.minimumDistanceBetweenDashes;
  1107. }
  1108. public set MinimumDistanceBetweenDashes(value: number) {
  1109. this.minimumDistanceBetweenDashes = value;
  1110. }
  1111. public get BezierCurveStepSize(): number {
  1112. return this.bezierCurveStepSize;
  1113. }
  1114. public set BezierCurveStepSize(value: number) {
  1115. this.bezierCurveStepSize = value;
  1116. }
  1117. public get TPow3(): number[] {
  1118. return this.tPower3;
  1119. }
  1120. public set TPow3(value: number[]) {
  1121. this.tPower3 = value;
  1122. }
  1123. public get OneMinusTPow3(): number[] {
  1124. return this.oneMinusTPower3;
  1125. }
  1126. public set OneMinusTPow3(value: number[]) {
  1127. this.oneMinusTPower3 = value;
  1128. }
  1129. public get BezierFactorOne(): number[] {
  1130. return this.factorOne;
  1131. }
  1132. public set BezierFactorOne(value: number[]) {
  1133. this.factorOne = value;
  1134. }
  1135. public get BezierFactorTwo(): number[] {
  1136. return this.factorTwo;
  1137. }
  1138. public set BezierFactorTwo(value: number[]) {
  1139. this.factorTwo = value;
  1140. }
  1141. public get TieGhostObjectWidth(): number {
  1142. return this.tieGhostObjectWidth;
  1143. }
  1144. public set TieGhostObjectWidth(value: number) {
  1145. this.tieGhostObjectWidth = value;
  1146. }
  1147. public get TieYPositionOffsetFactor(): number {
  1148. return this.tieYPositionOffsetFactor;
  1149. }
  1150. public set TieYPositionOffsetFactor(value: number) {
  1151. this.tieYPositionOffsetFactor = value;
  1152. }
  1153. public get MinimumNeededXspaceForTieGhostObject(): number {
  1154. return this.minimumNeededXspaceForTieGhostObject;
  1155. }
  1156. public set MinimumNeededXspaceForTieGhostObject(value: number) {
  1157. this.minimumNeededXspaceForTieGhostObject = value;
  1158. }
  1159. public get TieHeightMinimum(): number {
  1160. return this.tieHeightMinimum;
  1161. }
  1162. public set TieHeightMinimum(value: number) {
  1163. this.tieHeightMinimum = value;
  1164. }
  1165. public get TieHeightMaximum(): number {
  1166. return this.tieHeightMaximum;
  1167. }
  1168. public set TieHeightMaximum(value: number) {
  1169. this.tieHeightMaximum = value;
  1170. }
  1171. public get TieHeightInterpolationK(): number {
  1172. return this.tieHeightInterpolationK;
  1173. }
  1174. public set TieHeightInterpolationK(value: number) {
  1175. this.tieHeightInterpolationK = value;
  1176. }
  1177. public get TieHeightInterpolationD(): number {
  1178. return this.tieHeightInterpolationD;
  1179. }
  1180. public set TieHeightInterpolationD(value: number) {
  1181. this.tieHeightInterpolationD = value;
  1182. }
  1183. public get SlurNoteHeadYOffset(): number {
  1184. return this.slurNoteHeadYOffset;
  1185. }
  1186. public set SlurNoteHeadYOffset(value: number) {
  1187. this.slurNoteHeadYOffset = value;
  1188. }
  1189. public get SlurStemXOffset(): number {
  1190. return this.slurStemXOffset;
  1191. }
  1192. public set SlurStemXOffset(value: number) {
  1193. this.slurStemXOffset = value;
  1194. }
  1195. public get SlurSlopeMaxAngle(): number {
  1196. return this.slurSlopeMaxAngle;
  1197. }
  1198. public set SlurSlopeMaxAngle(value: number) {
  1199. this.slurSlopeMaxAngle = value;
  1200. }
  1201. public get SlurTangentMinAngle(): number {
  1202. return this.slurTangentMinAngle;
  1203. }
  1204. public set SlurTangentMinAngle(value: number) {
  1205. this.slurTangentMinAngle = value;
  1206. }
  1207. public get SlurTangentMaxAngle(): number {
  1208. return this.slurTangentMaxAngle;
  1209. }
  1210. public set SlurTangentMaxAngle(value: number) {
  1211. this.slurTangentMaxAngle = value;
  1212. }
  1213. public get SlursStartingAtSameStaffEntryYOffset(): number {
  1214. return this.slursStartingAtSameStaffEntryYOffset;
  1215. }
  1216. public set SlursStartingAtSameStaffEntryYOffset(value: number) {
  1217. this.slursStartingAtSameStaffEntryYOffset = value;
  1218. }
  1219. public get InstantaneousTempoTextHeight(): number {
  1220. return this.instantaneousTempoTextHeight;
  1221. }
  1222. public set InstantaneousTempoTextHeight(value: number) {
  1223. this.instantaneousTempoTextHeight = value;
  1224. }
  1225. public get ContinuousDynamicTextHeight(): number {
  1226. return this.continuousDynamicTextHeight;
  1227. }
  1228. public set ContinuousDynamicTextHeight(value: number) {
  1229. this.continuousDynamicTextHeight = value;
  1230. }
  1231. public get MoodTextHeight(): number {
  1232. return this.moodTextHeight;
  1233. }
  1234. public set MoodTextHeight(value: number) {
  1235. this.moodTextHeight = value;
  1236. }
  1237. public get ContinuousTempoTextHeight(): number {
  1238. return this.continuousTempoTextHeight;
  1239. }
  1240. public set ContinuousTempoTextHeight(value: number) {
  1241. this.continuousTempoTextHeight = value;
  1242. }
  1243. /** Distance of expressions inside a group */
  1244. public get DynamicExpressionMaxDistance(): number {
  1245. return this.dynamicExpressionMaxDistance;
  1246. }
  1247. public set DynamicExpressionMaxDistance(value: number) {
  1248. this.dynamicExpressionMaxDistance = value;
  1249. }
  1250. /** Space between expressions in a group */
  1251. public get DynamicExpressionSpacer(): number {
  1252. return this.dynamicExpressionSpacer;
  1253. }
  1254. public set DynamicExpressionSpacer(value: number) {
  1255. this.dynamicExpressionSpacer = value;
  1256. }
  1257. public get UnknownTextHeight(): number {
  1258. return this.unknownTextHeight;
  1259. }
  1260. public set UnknownTextHeight(value: number) {
  1261. this.unknownTextHeight = value;
  1262. }
  1263. public get StaffLineWidth(): number {
  1264. return this.staffLineWidth;
  1265. }
  1266. public set StaffLineWidth(value: number) {
  1267. this.staffLineWidth = value;
  1268. }
  1269. public get LedgerLineWidth(): number {
  1270. return this.ledgerLineWidth;
  1271. }
  1272. public set LedgerLineWidth(value: number) {
  1273. this.ledgerLineWidth = value;
  1274. }
  1275. public get LedgerLineStrokeStyle(): string {
  1276. return this.ledgerLineStrokeStyle;
  1277. }
  1278. public set LedgerLineStrokeStyle(value: string) {
  1279. this.ledgerLineStrokeStyle = value;
  1280. }
  1281. public get WedgeLineWidth(): number {
  1282. return this.wedgeLineWidth;
  1283. }
  1284. public set WedgeLineWidth(value: number) {
  1285. this.wedgeLineWidth = value;
  1286. }
  1287. public get TupletLineWidth(): number {
  1288. return this.tupletLineWidth;
  1289. }
  1290. public set TupletLineWidth(value: number) {
  1291. this.tupletLineWidth = value;
  1292. }
  1293. public get LyricUnderscoreLineWidth(): number {
  1294. return this.lyricUnderscoreLineWidth;
  1295. }
  1296. public set LyricUnderscoreLineWidth(value: number) {
  1297. this.lyricUnderscoreLineWidth = value;
  1298. }
  1299. public get SystemThinLineWidth(): number {
  1300. return this.systemThinLineWidth;
  1301. }
  1302. public set SystemThinLineWidth(value: number) {
  1303. this.systemThinLineWidth = value;
  1304. }
  1305. public get SystemBoldLineWidth(): number {
  1306. return this.systemBoldLineWidth;
  1307. }
  1308. public set SystemBoldLineWidth(value: number) {
  1309. this.systemBoldLineWidth = value;
  1310. }
  1311. public get SystemRepetitionEndingLineWidth(): number {
  1312. return this.systemRepetitionEndingLineWidth;
  1313. }
  1314. public set SystemRepetitionEndingLineWidth(value: number) {
  1315. this.systemRepetitionEndingLineWidth = value;
  1316. }
  1317. public get SystemDotWidth(): number {
  1318. return this.systemDotWidth;
  1319. }
  1320. public set SystemDotWidth(value: number) {
  1321. this.systemDotWidth = value;
  1322. }
  1323. public get DistanceBetweenVerticalSystemLines(): number {
  1324. return this.distanceBetweenVerticalSystemLines;
  1325. }
  1326. public set DistanceBetweenVerticalSystemLines(value: number) {
  1327. this.distanceBetweenVerticalSystemLines = value;
  1328. }
  1329. public get DistanceBetweenDotAndLine(): number {
  1330. return this.distanceBetweenDotAndLine;
  1331. }
  1332. public set DistanceBetweenDotAndLine(value: number) {
  1333. this.distanceBetweenDotAndLine = value;
  1334. }
  1335. public get OctaveShiftLineWidth(): number {
  1336. return this.octaveShiftLineWidth;
  1337. }
  1338. public set OctaveShiftLineWidth(value: number) {
  1339. this.octaveShiftLineWidth = value;
  1340. }
  1341. public get OctaveShiftVerticalLineLength(): number {
  1342. return this.octaveShiftVerticalLineLength;
  1343. }
  1344. public set OctaveShiftVerticalLineLength(value: number) {
  1345. this.octaveShiftVerticalLineLength = value;
  1346. }
  1347. public get GraceLineWidth(): number {
  1348. return this.graceLineWidth;
  1349. }
  1350. public set GraceLineWidth(value: number) {
  1351. this.graceLineWidth = value;
  1352. }
  1353. public get MinimumStaffLineDistance(): number {
  1354. return this.minimumStaffLineDistance;
  1355. }
  1356. public set MinimumStaffLineDistance(value: number) {
  1357. this.minimumStaffLineDistance = value;
  1358. }
  1359. public get MinSkyBottomDistBetweenStaves(): number {
  1360. return this.minSkyBottomDistBetweenStaves;
  1361. }
  1362. public set MinSkyBottomDistBetweenStaves(value: number) {
  1363. this.minSkyBottomDistBetweenStaves = value;
  1364. }
  1365. public get MinimumCrossedBeamDifferenceMargin(): number {
  1366. return this.minimumCrossedBeamDifferenceMargin;
  1367. }
  1368. public set MinimumCrossedBeamDifferenceMargin(value: number) {
  1369. this.minimumCrossedBeamDifferenceMargin = value;
  1370. }
  1371. public get DisplacedNoteMargin(): number {
  1372. return this.displacedNoteMargin;
  1373. }
  1374. public set DisplacedNoteMargin(value: number) {
  1375. this.displacedNoteMargin = value;
  1376. }
  1377. public get MinNoteDistance(): number {
  1378. return this.minNoteDistance;
  1379. }
  1380. public set MinNoteDistance(value: number) {
  1381. this.minNoteDistance = value;
  1382. }
  1383. public get SubMeasureXSpacingThreshold(): number {
  1384. return this.subMeasureXSpacingThreshold;
  1385. }
  1386. public set SubMeasureXSpacingThreshold(value: number) {
  1387. this.subMeasureXSpacingThreshold = value;
  1388. }
  1389. public get MeasureDynamicsMaxScalingFactor(): number {
  1390. return this.measureDynamicsMaxScalingFactor;
  1391. }
  1392. public set MeasureDynamicsMaxScalingFactor(value: number) {
  1393. this.measureDynamicsMaxScalingFactor = value;
  1394. }
  1395. public get WholeRestXShiftVexflow(): number {
  1396. return this.wholeRestXShiftVexflow;
  1397. }
  1398. public set WholeRestXShiftVexflow(value: number) {
  1399. this.wholeRestXShiftVexflow = value;
  1400. }
  1401. public get MetronomeMarksDrawn(): boolean {
  1402. return this.metronomeMarksDrawn;
  1403. }
  1404. public set MetronomeMarksDrawn(value: boolean) {
  1405. this.metronomeMarksDrawn = value;
  1406. }
  1407. public get MetronomeMarkXShift(): number {
  1408. return this.metronomeMarkXShift;
  1409. }
  1410. public set MetronomeMarkXShift(value: number) {
  1411. this.metronomeMarkXShift = value;
  1412. }
  1413. public get MetronomeMarkYShift(): number {
  1414. return this.metronomeMarkYShift;
  1415. }
  1416. public set MetronomeMarkYShift(value: number) {
  1417. this.metronomeMarkYShift = value;
  1418. }
  1419. public get MaxInstructionsConstValue(): number {
  1420. return this.maxInstructionsConstValue;
  1421. }
  1422. public set MaxInstructionsConstValue(value: number) {
  1423. this.maxInstructionsConstValue = value;
  1424. }
  1425. public get NoteDistances(): number[] {
  1426. return this.noteDistances;
  1427. }
  1428. public set NoteDistances(value: number[]) {
  1429. this.noteDistances = value;
  1430. }
  1431. public get NoteDistancesScalingFactors(): number[] {
  1432. return this.noteDistancesScalingFactors;
  1433. }
  1434. public set NoteDistancesScalingFactors(value: number[]) {
  1435. this.noteDistancesScalingFactors = value;
  1436. }
  1437. public get DurationDistanceDict(): {[_: number]: number; } {
  1438. return this.durationDistanceDict;
  1439. }
  1440. public get DurationScalingDistanceDict(): {[_: number]: number; } {
  1441. return this.durationScalingDistanceDict;
  1442. }
  1443. public get AlignRests(): number {
  1444. return this.alignRests;
  1445. }
  1446. public set AlignRests(value: number) {
  1447. this.alignRests = value;
  1448. }
  1449. public get FillEmptyMeasuresWithWholeRest(): FillEmptyMeasuresWithWholeRests | number {
  1450. return this.fillEmptyMeasuresWithWholeRest;
  1451. }
  1452. public set FillEmptyMeasuresWithWholeRest(value: FillEmptyMeasuresWithWholeRests | number) {
  1453. this.fillEmptyMeasuresWithWholeRest = value;
  1454. }
  1455. public get ArpeggiosGoAcrossVoices(): boolean {
  1456. return this.arpeggiosGoAcrossVoices;
  1457. }
  1458. public set ArpeggiosGoAcrossVoices(value: boolean) {
  1459. this.arpeggiosGoAcrossVoices = value;
  1460. }
  1461. public get RenderArpeggios(): boolean {
  1462. return this.renderArpeggios;
  1463. }
  1464. public set RenderArpeggios(value: boolean) {
  1465. this.renderArpeggios = value;
  1466. }
  1467. public get RenderSlurs(): boolean {
  1468. return this.renderSlurs;
  1469. }
  1470. public set RenderSlurs(value: boolean) {
  1471. this.renderSlurs = value;
  1472. }
  1473. public get ColoringMode(): ColoringMode {
  1474. return this.coloringMode;
  1475. }
  1476. public set ColoringMode(value: ColoringMode) {
  1477. this.coloringMode = value;
  1478. }
  1479. public get ColoringEnabled(): boolean {
  1480. return this.coloringEnabled;
  1481. }
  1482. public set ColoringEnabled(value: boolean) {
  1483. this.coloringEnabled = value;
  1484. }
  1485. public get ColorStemsLikeNoteheads(): boolean {
  1486. return this.colorStemsLikeNoteheads;
  1487. }
  1488. public set ColorStemsLikeNoteheads(value: boolean) {
  1489. this.colorStemsLikeNoteheads = value;
  1490. }
  1491. public get ColorFlags(): boolean {
  1492. return this.colorFlags;
  1493. }
  1494. public set ColorFlags(value: boolean) {
  1495. this.colorFlags = value;
  1496. }
  1497. public get ColorBeams(): boolean {
  1498. return this.colorBeams;
  1499. }
  1500. public set ColorBeams(value: boolean) {
  1501. this.colorBeams = value;
  1502. }
  1503. public get ColoringSetCurrent(): Dictionary<NoteEnum|number, string> {
  1504. return this.coloringSetCustom;
  1505. }
  1506. public set ColoringSetCurrent(value: Dictionary<NoteEnum|number, string>) {
  1507. this.coloringSetCustom = value;
  1508. }
  1509. public get DefaultColorNotehead(): string {
  1510. return this.defaultColorNotehead;
  1511. }
  1512. public set DefaultColorNotehead(value: string) {
  1513. this.defaultColorNotehead = value;
  1514. }
  1515. public get DefaultColorRest(): string {
  1516. return this.defaultColorRest;
  1517. }
  1518. public set DefaultColorRest(value: string) {
  1519. this.defaultColorRest = value;
  1520. }
  1521. public get DefaultColorStem(): string {
  1522. return this.defaultColorStem;
  1523. }
  1524. public set DefaultColorStem(value: string) {
  1525. this.defaultColorStem = value;
  1526. }
  1527. public get DefaultColorLabel(): string {
  1528. return this.defaultColorLabel;
  1529. }
  1530. public set DefaultColorLabel(value: string) {
  1531. this.defaultColorLabel = value;
  1532. }
  1533. public get DefaultColorTitle(): string {
  1534. return this.defaultColorTitle;
  1535. }
  1536. public set DefaultColorTitle(value: string) {
  1537. this.defaultColorTitle = value;
  1538. }
  1539. public get DefaultFontFamily(): string {
  1540. return this.defaultFontFamily;
  1541. }
  1542. public set DefaultFontFamily(value: string) {
  1543. this.defaultFontFamily = value;
  1544. }
  1545. public get DefaultFontStyle(): FontStyles {
  1546. return this.defaultFontStyle;
  1547. }
  1548. public set DefaultFontStyle(value: FontStyles) {
  1549. this.defaultFontStyle = value;
  1550. }
  1551. public get MaxMeasureToDrawIndex(): number {
  1552. return this.maxMeasureToDrawIndex;
  1553. }
  1554. public set MaxMeasureToDrawIndex(value: number) {
  1555. this.maxMeasureToDrawIndex = value;
  1556. }
  1557. public get MinMeasureToDrawIndex(): number {
  1558. return this.minMeasureToDrawIndex;
  1559. }
  1560. public set MinMeasureToDrawIndex(value: number) {
  1561. this.minMeasureToDrawIndex = value;
  1562. }
  1563. public get RenderComposer(): boolean {
  1564. return this.renderComposer;
  1565. }
  1566. public set RenderComposer(value: boolean) {
  1567. this.renderComposer = value;
  1568. }
  1569. public get RenderTitle(): boolean {
  1570. return this.renderTitle;
  1571. }
  1572. public set RenderTitle(value: boolean) {
  1573. this.renderTitle = value;
  1574. }
  1575. public get RenderSubtitle(): boolean {
  1576. return this.renderSubtitle;
  1577. }
  1578. public set RenderSubtitle(value: boolean) {
  1579. this.renderSubtitle = value;
  1580. }
  1581. public get RenderLyricist(): boolean {
  1582. return this.renderLyricist;
  1583. }
  1584. public set RenderLyricist(value: boolean) {
  1585. this.renderLyricist = value;
  1586. }
  1587. public get RenderPartNames(): boolean {
  1588. return this.renderPartNames;
  1589. }
  1590. public set RenderPartNames(value: boolean) {
  1591. this.renderPartNames = value;
  1592. if (!this.renderPartNames) {
  1593. this.renderPartAbbreviations = false;
  1594. }
  1595. }
  1596. public get RenderPartAbbreviations(): boolean {
  1597. return this.renderPartAbbreviations;
  1598. }
  1599. public set RenderPartAbbreviations(value: boolean) {
  1600. this.renderPartAbbreviations = value;
  1601. }
  1602. public get RenderFingerings(): boolean {
  1603. return this.renderFingerings;
  1604. }
  1605. public set RenderFingerings(value: boolean) {
  1606. this.renderFingerings = value;
  1607. }
  1608. public get RenderMeasureNumbers(): boolean {
  1609. return this.renderMeasureNumbers;
  1610. }
  1611. public set RenderMeasureNumbers(value: boolean) {
  1612. this.renderMeasureNumbers = value;
  1613. }
  1614. public get RenderLyrics(): boolean {
  1615. return this.renderLyrics;
  1616. }
  1617. public set RenderLyrics(value: boolean) {
  1618. this.renderLyrics = value;
  1619. }
  1620. public get FingeringPosition(): PlacementEnum {
  1621. return this.fingeringPosition;
  1622. }
  1623. public set FingeringPosition(value: PlacementEnum) {
  1624. this.fingeringPosition = value;
  1625. }
  1626. public get FingeringInsideStafflines(): boolean {
  1627. return this.fingeringInsideStafflines;
  1628. }
  1629. public set FingeringInsideStafflines(value: boolean) {
  1630. this.fingeringInsideStafflines = value;
  1631. }
  1632. public get FingeringLabelFontHeight(): number {
  1633. return this.fingeringLabelFontHeight;
  1634. }
  1635. public set FingeringLabelFontHeight(value: number) {
  1636. this.fingeringLabelFontHeight = value;
  1637. }
  1638. public get FingeringOffsetX(): number {
  1639. return this.fingeringOffsetX;
  1640. }
  1641. public set FingeringOffsetX(value: number) {
  1642. this.fingeringOffsetX = value;
  1643. }
  1644. public get NewSystemAtXMLNewSystemAttribute(): boolean {
  1645. return this.newSystemAtXMLNewSystemAttribute;
  1646. }
  1647. public set NewSystemAtXMLNewSystemAttribute(value: boolean) {
  1648. this.newSystemAtXMLNewSystemAttribute = value;
  1649. }
  1650. public get NewPageAtXMLNewPageAttribute(): boolean {
  1651. return this.newPageAtXMLNewPageAttribute;
  1652. }
  1653. public set NewPageAtXMLNewPageAttribute(value: boolean) {
  1654. this.newPageAtXMLNewPageAttribute = value;
  1655. }
  1656. public get PageFormat(): PageFormat {
  1657. return this.pageFormat;
  1658. }
  1659. public set PageFormat(value: PageFormat) {
  1660. this.pageFormat = value;
  1661. }
  1662. public get PageBackgroundColor(): string {
  1663. return this.pageBackgroundColor;
  1664. }
  1665. public set PageBackgroundColor(value: string) {
  1666. this.pageBackgroundColor = value;
  1667. }
  1668. public get RenderSingleHorizontalStaffline(): boolean {
  1669. return this.renderSingleHorizontalStaffline;
  1670. }
  1671. public set RenderSingleHorizontalStaffline(value: boolean) {
  1672. this.renderSingleHorizontalStaffline = value;
  1673. }
  1674. public get RestoreCursorAfterRerender(): boolean {
  1675. return this.restoreCursorAfterRerender;
  1676. }
  1677. public set RestoreCursorAfterRerender(value: boolean) {
  1678. this.restoreCursorAfterRerender = value;
  1679. }
  1680. public resetChordSymbolLabelTexts(chordtexts: Dictionary<ChordSymbolEnum, string>): Dictionary<ChordSymbolEnum, string> {
  1681. chordtexts.setValue(ChordSymbolEnum.minor, "m");
  1682. chordtexts.setValue(ChordSymbolEnum.augmented, "aug");
  1683. chordtexts.setValue(ChordSymbolEnum.diminished, "dim");
  1684. chordtexts.setValue(ChordSymbolEnum.dominant, "7");
  1685. chordtexts.setValue(ChordSymbolEnum.majorseventh, "maj7");
  1686. chordtexts.setValue(ChordSymbolEnum.minorseventh, "m7");
  1687. chordtexts.setValue(ChordSymbolEnum.diminishedseventh, "dim7");
  1688. chordtexts.setValue(ChordSymbolEnum.augmentedseventh, "aug7");
  1689. chordtexts.setValue(ChordSymbolEnum.halfdiminished, "m7b5");
  1690. chordtexts.setValue(ChordSymbolEnum.majorminor, "m(maj7)");
  1691. chordtexts.setValue(ChordSymbolEnum.majorsixth, "maj6");
  1692. chordtexts.setValue(ChordSymbolEnum.minorsixth, "m6");
  1693. chordtexts.setValue(ChordSymbolEnum.dominantninth, "9");
  1694. chordtexts.setValue(ChordSymbolEnum.majorninth, "maj9");
  1695. chordtexts.setValue(ChordSymbolEnum.minorninth, "m9");
  1696. chordtexts.setValue(ChordSymbolEnum.dominant11th, "11");
  1697. chordtexts.setValue(ChordSymbolEnum.major11th, "maj11");
  1698. chordtexts.setValue(ChordSymbolEnum.minor11th, "m11");
  1699. chordtexts.setValue(ChordSymbolEnum.dominant13th, "13");
  1700. chordtexts.setValue(ChordSymbolEnum.major13th, "maj13");
  1701. chordtexts.setValue(ChordSymbolEnum.minor13th, "m13");
  1702. chordtexts.setValue(ChordSymbolEnum.suspendedsecond, "sus2");
  1703. chordtexts.setValue(ChordSymbolEnum.suspendedfourth, "sus4");
  1704. chordtexts.setValue(ChordSymbolEnum.power, "5");
  1705. return chordtexts;
  1706. }
  1707. /**
  1708. * This method maps NoteDurations to Distances and DistancesScalingFactors.
  1709. */
  1710. private populateDictionaries(): void {
  1711. for (let i: number = 0; i < this.noteDistances.length; i++) {
  1712. switch (i) {
  1713. case 0:
  1714. this.durationDistanceDict[0.015625] = this.noteDistances[i];
  1715. this.durationScalingDistanceDict[0.015625] = this.noteDistancesScalingFactors[i];
  1716. break;
  1717. case 1:
  1718. this.durationDistanceDict[0.03125] = this.noteDistances[i];
  1719. this.durationScalingDistanceDict[0.03125] = this.noteDistancesScalingFactors[i];
  1720. break;
  1721. case 2:
  1722. this.durationDistanceDict[0.0625] = this.noteDistances[i];
  1723. this.durationScalingDistanceDict[0.0625] = this.noteDistancesScalingFactors[i];
  1724. break;
  1725. case 3:
  1726. this.durationDistanceDict[0.125] = this.noteDistances[i];
  1727. this.durationScalingDistanceDict[0.125] = this.noteDistancesScalingFactors[i];
  1728. break;
  1729. case 4:
  1730. this.durationDistanceDict[0.25] = this.noteDistances[i];
  1731. this.durationScalingDistanceDict[0.25] = this.noteDistancesScalingFactors[i];
  1732. break;
  1733. case 5:
  1734. this.durationDistanceDict[0.5] = this.noteDistances[i];
  1735. this.durationScalingDistanceDict[0.5] = this.noteDistancesScalingFactors[i];
  1736. break;
  1737. case 6:
  1738. this.durationDistanceDict[1.0] = this.noteDistances[i];
  1739. this.durationScalingDistanceDict[1.0] = this.noteDistancesScalingFactors[i];
  1740. break;
  1741. case 7:
  1742. this.durationDistanceDict[2.0] = this.noteDistances[i];
  1743. this.durationScalingDistanceDict[2.0] = this.noteDistancesScalingFactors[i];
  1744. break;
  1745. default:
  1746. // FIXME
  1747. }
  1748. }
  1749. }
  1750. /**
  1751. * Calculate Curve-independend factors, to be used later in the Slur- and TieCurvePoints calculation
  1752. */
  1753. private calculateCurveParametersArrays(): void {
  1754. this.tPower3 = new Array(this.bezierCurveStepSize);
  1755. this.oneMinusTPower3 = new Array(this.bezierCurveStepSize);
  1756. this.factorOne = new Array(this.bezierCurveStepSize);
  1757. this.factorTwo = new Array(this.bezierCurveStepSize);
  1758. for (let i: number = 0; i < this.bezierCurveStepSize; i++) {
  1759. const t: number = i / this.bezierCurveStepSize;
  1760. this.tPower3[i] = Math.pow(t, 3);
  1761. this.oneMinusTPower3[i] = Math.pow((1 - t), 3);
  1762. this.factorOne[i] = 3 * Math.pow((1 - t), 2) * t;
  1763. this.factorTwo[i] = 3 * (1 - t) * Math.pow(t, 2);
  1764. }
  1765. }
  1766. }
  1767. // TODO maybe this should be moved to OSMDOptions. Also see OpenSheetMusicDisplay.PageFormatStandards
  1768. export class PageFormat {
  1769. constructor(width: number, height: number, idString: string = "noIdStringGiven") {
  1770. this.width = width;
  1771. this.height = height;
  1772. this.idString = idString;
  1773. }
  1774. public width: number;
  1775. public height: number;
  1776. public idString: string;
  1777. public get aspectRatio(): number {
  1778. if (!this.IsUndefined) {
  1779. return this.width / this.height;
  1780. } else {
  1781. return 0; // infinite page height
  1782. }
  1783. }
  1784. /** Undefined page format: use default page format. */
  1785. public get IsUndefined(): boolean {
  1786. return this.width === undefined || this.height === undefined || this.height === 0 || this.width === 0;
  1787. }
  1788. public static get UndefinedPageFormat(): PageFormat {
  1789. return new PageFormat(0, 0);
  1790. }
  1791. public Equals(otherPageFormat: PageFormat): boolean {
  1792. if (!otherPageFormat) {
  1793. return false;
  1794. }
  1795. return otherPageFormat.width === this.width && otherPageFormat.height === this.height;
  1796. }
  1797. }