EngravingRules.ts 65 KB

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