EngravingRules.ts 63 KB

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