vexflow 4.0.1-beta.1 → 4.0.1-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (331) hide show
  1. package/build/cjs/vexflow-bravura.js +2 -2
  2. package/build/cjs/vexflow-bravura.js.map +1 -1
  3. package/build/cjs/vexflow-core.js +2 -2
  4. package/build/cjs/vexflow-core.js.map +1 -1
  5. package/build/cjs/vexflow-debug-with-tests.js +92 -24
  6. package/build/cjs/vexflow-debug-with-tests.js.map +1 -1
  7. package/build/cjs/vexflow-debug.js +38 -16
  8. package/build/cjs/vexflow-debug.js.map +1 -1
  9. package/build/cjs/vexflow-font-gonville.js +1 -1
  10. package/build/cjs/vexflow-font-gonville.js.map +1 -1
  11. package/build/cjs/vexflow-gonville.js +2 -2
  12. package/build/cjs/vexflow-gonville.js.map +1 -1
  13. package/build/cjs/vexflow-petaluma.js +2 -2
  14. package/build/cjs/vexflow-petaluma.js.map +1 -1
  15. package/build/cjs/vexflow.js +2 -2
  16. package/build/cjs/vexflow.js.map +1 -1
  17. package/build/esm/entry/vexflow-bravura.js +11 -0
  18. package/build/esm/entry/vexflow-core.js +54 -0
  19. package/build/esm/entry/vexflow-debug-with-tests.js +4 -0
  20. package/build/esm/entry/vexflow-debug.js +3 -0
  21. package/build/esm/entry/vexflow-font-bravura.js +7 -0
  22. package/build/esm/entry/vexflow-font-custom.js +7 -0
  23. package/build/esm/entry/vexflow-font-gonville.js +7 -0
  24. package/build/esm/entry/vexflow-font-petaluma.js +7 -0
  25. package/build/esm/entry/vexflow-gonville.js +11 -0
  26. package/build/esm/entry/vexflow-petaluma.js +11 -0
  27. package/build/esm/entry/vexflow.js +9 -0
  28. package/build/esm/src/accidental.js +348 -0
  29. package/build/esm/src/annotation.js +232 -0
  30. package/build/esm/src/articulation.js +267 -0
  31. package/build/esm/src/barnote.js +58 -0
  32. package/build/esm/src/beam.js +632 -0
  33. package/build/esm/src/bend.js +202 -0
  34. package/build/esm/src/boundingbox.js +59 -0
  35. package/build/esm/src/boundingboxcomputation.js +107 -0
  36. package/build/esm/src/canvascontext.js +202 -0
  37. package/build/esm/src/chordsymbol.js +578 -0
  38. package/build/esm/src/clef.js +153 -0
  39. package/build/esm/src/clefnote.js +65 -0
  40. package/build/esm/src/crescendo.js +77 -0
  41. package/build/esm/src/curve.js +118 -0
  42. package/build/esm/src/dot.js +137 -0
  43. package/build/esm/src/easyscore.js +374 -0
  44. package/build/esm/src/element.js +216 -0
  45. package/build/esm/src/factory.js +440 -0
  46. package/build/esm/src/flow.js +275 -0
  47. package/build/esm/src/font.js +264 -0
  48. package/build/esm/src/fonts/bravura_glyphs.js +3239 -0
  49. package/build/esm/src/fonts/bravura_metrics.js +507 -0
  50. package/build/esm/src/fonts/custom_glyphs.js +78 -0
  51. package/build/esm/src/fonts/custom_metrics.js +5 -0
  52. package/build/esm/src/fonts/gonville_glyphs.js +828 -0
  53. package/build/esm/src/fonts/gonville_metrics.js +421 -0
  54. package/build/esm/src/fonts/load_all.js +10 -0
  55. package/build/esm/src/fonts/load_bravura.js +6 -0
  56. package/build/esm/src/fonts/load_custom.js +6 -0
  57. package/build/esm/src/fonts/load_gonville.js +6 -0
  58. package/build/esm/src/fonts/load_petaluma.js +6 -0
  59. package/build/esm/src/fonts/petaluma_glyphs.js +1335 -0
  60. package/build/esm/src/fonts/petaluma_metrics.js +536 -0
  61. package/build/esm/src/fonts/petalumascript_glyphs.js +863 -0
  62. package/build/esm/src/fonts/robotoslab_glyphs.js +863 -0
  63. package/build/esm/src/fonts/textfonts.js +44 -0
  64. package/build/esm/src/formatter.js +568 -0
  65. package/build/esm/src/fraction.js +171 -0
  66. package/build/esm/src/frethandfinger.js +156 -0
  67. package/build/esm/src/ghostnote.js +50 -0
  68. package/build/esm/src/glyph.js +331 -0
  69. package/build/esm/src/glyphnote.js +55 -0
  70. package/build/esm/src/gracenote.js +133 -0
  71. package/build/esm/src/gracenotegroup.js +128 -0
  72. package/build/esm/src/gracetabnote.js +12 -0
  73. package/build/esm/src/index.js +91 -0
  74. package/build/esm/src/keymanager.js +99 -0
  75. package/build/esm/src/keysignature.js +250 -0
  76. package/build/esm/src/keysignote.js +28 -0
  77. package/build/esm/src/modifier.js +128 -0
  78. package/build/esm/src/modifiercontext.js +110 -0
  79. package/build/esm/src/multimeasurerest.js +173 -0
  80. package/build/esm/src/music.js +322 -0
  81. package/build/esm/src/note.js +371 -0
  82. package/build/esm/src/notehead.js +169 -0
  83. package/build/esm/src/notesubgroup.js +59 -0
  84. package/build/esm/src/ornament.js +206 -0
  85. package/build/esm/src/parenthesis.js +76 -0
  86. package/build/esm/src/parser.js +164 -0
  87. package/build/esm/src/pedalmarking.js +192 -0
  88. package/build/esm/src/registry.js +81 -0
  89. package/build/esm/src/rendercontext.js +24 -0
  90. package/build/esm/src/renderer.js +112 -0
  91. package/build/esm/src/repeatnote.js +22 -0
  92. package/build/esm/src/stave.js +547 -0
  93. package/build/esm/src/stavebarline.js +182 -0
  94. package/build/esm/src/staveconnector.js +196 -0
  95. package/build/esm/src/stavehairpin.js +120 -0
  96. package/build/esm/src/staveline.js +218 -0
  97. package/build/esm/src/stavemodifier.js +77 -0
  98. package/build/esm/src/stavenote.js +855 -0
  99. package/build/esm/src/staverepetition.js +155 -0
  100. package/build/esm/src/stavesection.js +58 -0
  101. package/build/esm/src/stavetempo.js +91 -0
  102. package/build/esm/src/stavetext.js +82 -0
  103. package/build/esm/src/stavetie.js +141 -0
  104. package/build/esm/src/stavevolta.js +67 -0
  105. package/build/esm/src/stem.js +131 -0
  106. package/build/esm/src/stemmablenote.js +193 -0
  107. package/build/esm/src/stringnumber.js +231 -0
  108. package/build/esm/src/strokes.js +200 -0
  109. package/build/esm/src/svgcontext.js +414 -0
  110. package/build/esm/src/system.js +116 -0
  111. package/build/esm/src/tables.js +1102 -0
  112. package/build/esm/src/tabnote.js +299 -0
  113. package/build/esm/src/tabslide.js +76 -0
  114. package/build/esm/src/tabstave.js +17 -0
  115. package/build/esm/src/tabtie.js +19 -0
  116. package/build/esm/src/textbracket.js +144 -0
  117. package/build/esm/src/textdynamics.js +81 -0
  118. package/build/esm/src/textformatter.js +177 -0
  119. package/build/esm/src/textnote.js +176 -0
  120. package/build/esm/src/tickable.js +214 -0
  121. package/build/esm/src/tickcontext.js +170 -0
  122. package/build/esm/src/timesigglyph.js +85 -0
  123. package/build/esm/src/timesignature.js +89 -0
  124. package/build/esm/src/timesignote.js +32 -0
  125. package/build/esm/src/tremolo.js +47 -0
  126. package/build/esm/src/tuning.js +54 -0
  127. package/build/esm/src/tuplet.js +240 -0
  128. package/build/esm/src/typeguard.js +30 -0
  129. package/build/esm/src/util.js +58 -0
  130. package/build/esm/src/version.js +3 -3
  131. package/build/esm/src/vex.js +51 -0
  132. package/build/esm/src/vibrato.js +100 -0
  133. package/build/esm/src/vibratobracket.js +50 -0
  134. package/build/esm/src/voice.js +187 -0
  135. package/build/esm/src/web.js +15 -0
  136. package/build/esm/tests/accidental_tests.js +974 -0
  137. package/build/esm/tests/annotation_tests.js +377 -0
  138. package/build/esm/tests/articulation_tests.js +365 -0
  139. package/build/esm/tests/auto_beam_formatting_tests.js +548 -0
  140. package/build/esm/tests/bach_tests.js +335 -0
  141. package/build/esm/tests/barline_tests.js +52 -0
  142. package/build/esm/tests/beam_tests.js +595 -0
  143. package/build/esm/tests/bend_tests.js +215 -0
  144. package/build/esm/tests/boundingbox_tests.js +53 -0
  145. package/build/esm/tests/boundingboxcomputation_tests.js +183 -0
  146. package/build/esm/tests/chordsymbol_tests.js +320 -0
  147. package/build/esm/tests/clef_tests.js +131 -0
  148. package/build/esm/tests/curve_tests.js +118 -0
  149. package/build/esm/tests/dot_tests.js +123 -0
  150. package/build/esm/tests/easyscore_tests.js +459 -0
  151. package/build/esm/tests/factory_tests.js +44 -0
  152. package/build/esm/tests/font_tests.js +135 -0
  153. package/build/esm/tests/formatter/framestack.js +61 -0
  154. package/build/esm/tests/formatter/tests.js +203 -0
  155. package/build/esm/tests/formatter_tests.js +669 -0
  156. package/build/esm/tests/fraction_tests.js +72 -0
  157. package/build/esm/tests/ghostnote_tests.js +77 -0
  158. package/build/esm/tests/glyphnote_tests.js +113 -0
  159. package/build/esm/tests/gracenote_tests.js +413 -0
  160. package/build/esm/tests/gracetabnote_tests.js +79 -0
  161. package/build/esm/tests/index.js +68 -0
  162. package/build/esm/tests/key_clef_tests.js +103 -0
  163. package/build/esm/tests/keymanager_tests.js +68 -0
  164. package/build/esm/tests/keysignature_tests.js +308 -0
  165. package/build/esm/tests/mocks.js +71 -0
  166. package/build/esm/tests/modifier_tests.js +24 -0
  167. package/build/esm/tests/multimeasurerest_tests.js +141 -0
  168. package/build/esm/tests/music_tests.js +161 -0
  169. package/build/esm/tests/notehead_tests.js +137 -0
  170. package/build/esm/tests/notesubgroup_tests.js +149 -0
  171. package/build/esm/tests/offscreencanvas_tests.js +47 -0
  172. package/build/esm/tests/ornament_tests.js +298 -0
  173. package/build/esm/tests/parser_tests.js +122 -0
  174. package/build/esm/tests/pedalmarking_tests.js +64 -0
  175. package/build/esm/tests/percussion_tests.js +180 -0
  176. package/build/esm/tests/registry_tests.js +64 -0
  177. package/build/esm/tests/renderer_tests.js +113 -0
  178. package/build/esm/tests/rests_tests.js +248 -0
  179. package/build/esm/tests/rhythm_tests.js +357 -0
  180. package/build/esm/tests/stave_tests.js +560 -0
  181. package/build/esm/tests/staveconnector_tests.js +402 -0
  182. package/build/esm/tests/stavehairpin_tests.js +90 -0
  183. package/build/esm/tests/staveline_tests.js +122 -0
  184. package/build/esm/tests/stavemodifier_tests.js +51 -0
  185. package/build/esm/tests/stavenote_tests.js +867 -0
  186. package/build/esm/tests/stavetie_tests.js +108 -0
  187. package/build/esm/tests/stringnumber_tests.js +259 -0
  188. package/build/esm/tests/strokes_tests.js +275 -0
  189. package/build/esm/tests/style_tests.js +98 -0
  190. package/build/esm/tests/support/qunit.js +2765 -0
  191. package/build/esm/tests/tabnote_tests.js +474 -0
  192. package/build/esm/tests/tabslide_tests.js +135 -0
  193. package/build/esm/tests/tabstave_tests.js +23 -0
  194. package/build/esm/tests/tabtie_tests.js +173 -0
  195. package/build/esm/tests/textbracket_tests.js +100 -0
  196. package/build/esm/tests/textformatter_tests.js +24 -0
  197. package/build/esm/tests/textnote_tests.js +215 -0
  198. package/build/esm/tests/threevoice_tests.js +132 -0
  199. package/build/esm/tests/tickcontext_tests.js +36 -0
  200. package/build/esm/tests/timesignature_tests.js +134 -0
  201. package/build/esm/tests/tremolo_tests.js +75 -0
  202. package/build/esm/tests/tuning_tests.js +56 -0
  203. package/build/esm/tests/tuplet_tests.js +450 -0
  204. package/build/esm/tests/typeguard_tests.js +82 -0
  205. package/build/esm/tests/vexflow_test_helpers.js +266 -0
  206. package/build/esm/tests/vf_prefix_tests.js +115 -0
  207. package/build/esm/tests/vibrato_tests.js +92 -0
  208. package/build/esm/tests/vibratobracket_tests.js +45 -0
  209. package/build/esm/tests/voice_tests.js +69 -0
  210. package/build/types/entry/vexflow-bravura.d.ts +3 -0
  211. package/build/types/entry/vexflow-core.d.ts +3 -0
  212. package/build/types/entry/vexflow-debug.d.ts +3 -0
  213. package/build/types/entry/vexflow-font-bravura.d.ts +3771 -0
  214. package/build/types/entry/vexflow-font-custom.d.ts +86 -0
  215. package/build/types/entry/vexflow-font-gonville.d.ts +1267 -0
  216. package/build/types/entry/vexflow-font-petaluma.d.ts +1896 -0
  217. package/build/types/entry/vexflow-gonville.d.ts +3 -0
  218. package/build/types/entry/vexflow-petaluma.d.ts +3 -0
  219. package/build/types/entry/vexflow.d.ts +3 -0
  220. package/build/types/src/accidental.d.ts +66 -0
  221. package/build/types/src/annotation.d.ts +60 -0
  222. package/build/types/src/articulation.d.ts +62 -0
  223. package/build/types/src/barnote.d.ts +29 -0
  224. package/build/types/src/beam.d.ts +124 -0
  225. package/build/types/src/bend.d.ts +73 -0
  226. package/build/types/src/boundingbox.d.ts +42 -0
  227. package/build/types/src/boundingboxcomputation.d.ts +33 -0
  228. package/build/types/src/canvascontext.d.ts +89 -0
  229. package/build/types/src/chordsymbol.d.ts +149 -0
  230. package/build/types/src/clef.d.ts +48 -0
  231. package/build/types/src/clefnote.d.ts +25 -0
  232. package/build/types/src/crescendo.d.ts +27 -0
  233. package/build/types/src/curve.d.ts +41 -0
  234. package/build/types/src/dot.d.ts +20 -0
  235. package/build/types/src/easyscore.d.ts +148 -0
  236. package/build/types/src/element.d.ts +202 -0
  237. package/build/types/src/factory.d.ts +271 -0
  238. package/build/types/src/flow.d.ts +245 -0
  239. package/build/types/src/font.d.ts +181 -0
  240. package/build/types/src/fonts/bravura_glyphs.d.ts +3239 -0
  241. package/build/types/src/fonts/bravura_metrics.d.ts +533 -0
  242. package/build/types/src/fonts/custom_glyphs.d.ts +78 -0
  243. package/build/types/src/fonts/custom_metrics.d.ts +5 -0
  244. package/build/types/src/fonts/gonville_glyphs.d.ts +828 -0
  245. package/build/types/src/fonts/gonville_metrics.d.ts +440 -0
  246. package/build/types/src/fonts/load_all.d.ts +1 -0
  247. package/build/types/src/fonts/load_bravura.d.ts +1 -0
  248. package/build/types/src/fonts/load_custom.d.ts +1 -0
  249. package/build/types/src/fonts/load_gonville.d.ts +1 -0
  250. package/build/types/src/fonts/load_petaluma.d.ts +1 -0
  251. package/build/types/src/fonts/petaluma_glyphs.d.ts +1335 -0
  252. package/build/types/src/fonts/petaluma_metrics.d.ts +562 -0
  253. package/build/types/src/fonts/petalumascript_glyphs.d.ts +863 -0
  254. package/build/types/src/fonts/robotoslab_glyphs.d.ts +863 -0
  255. package/build/types/src/fonts/textfonts.d.ts +1 -0
  256. package/build/types/src/formatter.d.ts +203 -0
  257. package/build/types/src/fraction.d.ts +62 -0
  258. package/build/types/src/frethandfinger.d.ts +22 -0
  259. package/build/types/src/ghostnote.d.ts +16 -0
  260. package/build/types/src/glyph.d.ts +139 -0
  261. package/build/types/src/glyphnote.d.ts +17 -0
  262. package/build/types/src/gracenote.d.ts +19 -0
  263. package/build/types/src/gracenotegroup.d.ts +33 -0
  264. package/build/types/src/gracetabnote.d.ts +5 -0
  265. package/build/types/src/index.d.ts +91 -0
  266. package/build/types/src/keymanager.d.ts +25 -0
  267. package/build/types/src/keysignature.d.ts +50 -0
  268. package/build/types/src/keysignote.d.ts +11 -0
  269. package/build/types/src/modifier.d.ts +97 -0
  270. package/build/types/src/modifiercontext.d.ts +45 -0
  271. package/build/types/src/multimeasurerest.d.ts +61 -0
  272. package/build/types/src/music.d.ts +91 -0
  273. package/build/types/src/note.d.ts +231 -0
  274. package/build/types/src/notehead.d.ts +70 -0
  275. package/build/types/src/notesubgroup.d.ts +18 -0
  276. package/build/types/src/ornament.d.ts +76 -0
  277. package/build/types/src/parenthesis.d.ts +22 -0
  278. package/build/types/src/parser.d.ts +45 -0
  279. package/build/types/src/pedalmarking.d.ts +69 -0
  280. package/build/types/src/registry.d.ts +40 -0
  281. package/build/types/src/rendercontext.d.ts +64 -0
  282. package/build/types/src/renderer.d.ts +35 -0
  283. package/build/types/src/repeatnote.d.ts +6 -0
  284. package/build/types/src/stave.d.ts +186 -0
  285. package/build/types/src/stavebarline.d.ts +28 -0
  286. package/build/types/src/staveconnector.d.ts +67 -0
  287. package/build/types/src/stavehairpin.d.ts +56 -0
  288. package/build/types/src/staveline.d.ts +57 -0
  289. package/build/types/src/stavemodifier.d.ts +44 -0
  290. package/build/types/src/stavenote.d.ts +154 -0
  291. package/build/types/src/staverepetition.d.ts +32 -0
  292. package/build/types/src/stavesection.d.ts +15 -0
  293. package/build/types/src/stavetempo.d.ts +25 -0
  294. package/build/types/src/stavetext.d.ts +25 -0
  295. package/build/types/src/stavetie.d.ts +59 -0
  296. package/build/types/src/stavevolta.d.ts +21 -0
  297. package/build/types/src/stem.d.ts +58 -0
  298. package/build/types/src/stemmablenote.d.ts +39 -0
  299. package/build/types/src/stringnumber.d.ts +27 -0
  300. package/build/types/src/strokes.d.ts +33 -0
  301. package/build/types/src/svgcontext.d.ts +131 -0
  302. package/build/types/src/system.d.ts +92 -0
  303. package/build/types/src/tables.d.ts +96 -0
  304. package/build/types/src/tabnote.d.ts +44 -0
  305. package/build/types/src/tabslide.d.ts +34 -0
  306. package/build/types/src/tabstave.d.ts +7 -0
  307. package/build/types/src/tabtie.d.ts +18 -0
  308. package/build/types/src/textbracket.d.ts +55 -0
  309. package/build/types/src/textdynamics.d.ts +39 -0
  310. package/build/types/src/textformatter.d.ts +109 -0
  311. package/build/types/src/textnote.d.ts +49 -0
  312. package/build/types/src/tickable.d.ts +140 -0
  313. package/build/types/src/tickcontext.d.ts +82 -0
  314. package/build/types/src/timesigglyph.d.ts +14 -0
  315. package/build/types/src/timesignature.d.ts +26 -0
  316. package/build/types/src/timesignote.d.ts +11 -0
  317. package/build/types/src/tremolo.d.ts +17 -0
  318. package/build/types/src/tuning.d.ts +23 -0
  319. package/build/types/src/tuplet.d.ts +105 -0
  320. package/build/types/src/typeguard.d.ts +99 -0
  321. package/build/types/src/util.d.ts +27 -0
  322. package/build/types/src/version.d.ts +3 -0
  323. package/build/types/src/vex.d.ts +18 -0
  324. package/build/types/src/vibrato.d.ts +29 -0
  325. package/build/types/src/vibratobracket.d.ts +33 -0
  326. package/build/types/src/voice.d.ts +108 -0
  327. package/build/types/src/web.d.ts +2 -0
  328. package/package.json +1 -1
  329. package/src/annotation.ts +27 -6
  330. package/src/articulation.ts +8 -2
  331. package/src/fonts/gonville_glyphs.ts +4 -4
@@ -0,0 +1,135 @@
1
+ import { VexFlowTests } from './vexflow_test_helpers.js';
2
+ import { Accidental } from '../src/accidental.js';
3
+ import { Bend } from '../src/bend.js';
4
+ import { CanvasContext } from '../src/canvascontext.js';
5
+ import { Element } from '../src/element.js';
6
+ import { Flow } from '../src/flow.js';
7
+ import { Font, FontStyle, FontWeight } from '../src/font.js';
8
+ import { PedalMarking } from '../src/pedalmarking.js';
9
+ import { StaveNote } from '../src/stavenote.js';
10
+ import { TextBracket } from '../src/textbracket.js';
11
+ import { TextNote } from '../src/textnote.js';
12
+ import { Voice } from '../src/voice.js';
13
+ const FontTests = {
14
+ Start() {
15
+ QUnit.module('Font');
16
+ test('setFont', setFont);
17
+ test('Parsing', fontParsing);
18
+ test('Sizes', fontSizes);
19
+ const run = VexFlowTests.runTests;
20
+ run('Set Text Font to Georgia', setTextFontToGeorgia);
21
+ run('Set Music Font to Petaluma', setMusicFontToPetaluma);
22
+ },
23
+ };
24
+ function setFont() {
25
+ const canvas = document.createElement('canvas');
26
+ canvas.width = 800;
27
+ canvas.height = 400;
28
+ const ctx = new CanvasContext(canvas.getContext('2d'));
29
+ ctx.setFont('PetalumaScript', '100px', 'normal', 'italic');
30
+ equal(ctx.font, 'italic 100px PetalumaScript');
31
+ const voice = new Voice();
32
+ propEqual(voice.fontInfo, Element.TEXT_FONT);
33
+ voice.setFont('bold 32pt Arial');
34
+ const fontInfo = voice.fontInfo;
35
+ equal(fontInfo === null || fontInfo === void 0 ? void 0 : fontInfo.size, '32pt');
36
+ const flat = new Accidental('b');
37
+ equal(flat.textFont, undefined);
38
+ flat.setFont(undefined, undefined, undefined, FontStyle.ITALIC);
39
+ equal(flat.getFont(), 'italic 10pt Arial, sans-serif');
40
+ flat.setFont(undefined, undefined, FontWeight.BOLD, undefined);
41
+ equal(flat.getFont(), 'bold 10pt Arial, sans-serif');
42
+ flat.setFont(undefined, undefined, FontWeight.BOLD, FontStyle.ITALIC);
43
+ equal(flat.getFont(), 'italic bold 10pt Arial, sans-serif');
44
+ flat.setFont(undefined, undefined, FontWeight.BOLD, 'oblique');
45
+ equal(flat.getFont(), 'oblique bold 10pt Arial, sans-serif');
46
+ flat.setFont(undefined, undefined, 'normal', '');
47
+ equal(flat.getFont(), '10pt Arial, sans-serif');
48
+ }
49
+ function fontParsing() {
50
+ const b = new Bend('1/2', true);
51
+ const bFont = b.fontInfo;
52
+ equal(bFont === null || bFont === void 0 ? void 0 : bFont.family, Font.SANS_SERIF);
53
+ equal(bFont === null || bFont === void 0 ? void 0 : bFont.size, Font.SIZE);
54
+ equal(bFont === null || bFont === void 0 ? void 0 : bFont.weight, FontWeight.NORMAL);
55
+ equal(bFont === null || bFont === void 0 ? void 0 : bFont.style, FontStyle.NORMAL);
56
+ const f1 = 'Roboto Slab, serif';
57
+ const t = new TextNote({ duration: '4', font: { family: f1 } });
58
+ equal(f1, t.fontInfo.family);
59
+ const n1 = new StaveNote({ keys: ['e/5'], duration: '4' });
60
+ const n2 = new StaveNote({ keys: ['c/5'], duration: '4' });
61
+ const tb = new TextBracket({ start: n1, stop: n2 });
62
+ const f2 = tb.fontInfo;
63
+ equal(f2 === null || f2 === void 0 ? void 0 : f2.size, 15);
64
+ equal(f2 === null || f2 === void 0 ? void 0 : f2.style, FontStyle.ITALIC);
65
+ const f3 = Font.fromCSSString(`bold 1.5em/3 "Lucida Sans Typewriter", "Lucida Console", Consolas, monospace`);
66
+ const f3SizeInPx = Font.convertSizeToPixelValue(f3.size);
67
+ equal(f3SizeInPx, 24);
68
+ }
69
+ function fontSizes() {
70
+ {
71
+ const size = '17px';
72
+ const sizeInEm = Font.convertSizeToPixelValue(size) / Font.scaleToPxFrom.em;
73
+ equal(sizeInEm, 1.0625);
74
+ }
75
+ {
76
+ const size = '2em';
77
+ const sizeInPx = Font.convertSizeToPixelValue(size);
78
+ equal(sizeInPx, 32);
79
+ }
80
+ {
81
+ const pedal = new PedalMarking([]);
82
+ equal(pedal.getFont(), 'italic bold 12pt Times New Roman, serif');
83
+ equal(pedal.fontSizeInPoints, 12);
84
+ equal(pedal.fontSizeInPixels, 16);
85
+ const doubledSizePx = pedal.fontSizeInPixels * 2;
86
+ equal(doubledSizePx, 32);
87
+ const doubledSizePt = Font.scaleSize(pedal.fontSizeInPoints, 2);
88
+ equal(doubledSizePt, 24);
89
+ equal(Font.scaleSize('1.5em', 3), '4.5em');
90
+ }
91
+ }
92
+ function setTextFontToGeorgia(options) {
93
+ const factory = VexFlowTests.makeFactory(options, 400, 200);
94
+ const stave = factory.Stave({ y: 40 });
95
+ const score = factory.EasyScore();
96
+ const voice1 = score.voice([
97
+ factory.StaveNote({ keys: ['c/4', 'e/4', 'a/4'], stem_direction: -1, duration: 'h' }),
98
+ factory.StaveNote({ keys: ['d/4', 'f/4'], stem_direction: -1, duration: 'q' }),
99
+ factory.StaveNote({ keys: ['c/4', 'f/4', 'a/4'], stem_direction: -1, duration: 'q' }),
100
+ ]);
101
+ const defaultFont = TextNote.TEXT_FONT;
102
+ TextNote.TEXT_FONT = {
103
+ family: 'Georgia, Courier New, serif',
104
+ size: 14,
105
+ weight: 'bold',
106
+ style: 'italic',
107
+ };
108
+ const voice2 = score.voice([
109
+ factory
110
+ .TextNote({ text: 'Here are some fun lyrics...', duration: 'w' })
111
+ .setJustification(TextNote.Justification.LEFT),
112
+ ]);
113
+ const formatter = factory.Formatter();
114
+ formatter.joinVoices([voice1, voice2]).formatToStave([voice1, voice2], stave);
115
+ factory.draw();
116
+ TextNote.TEXT_FONT = defaultFont;
117
+ ok(true);
118
+ }
119
+ function setMusicFontToPetaluma(options) {
120
+ Flow.setMusicFont('Petaluma');
121
+ const factory = VexFlowTests.makeFactory(options, 400, 200);
122
+ const stave = factory.Stave({ y: 40 });
123
+ const score = factory.EasyScore();
124
+ const voice = score.voice([
125
+ factory.StaveNote({ keys: ['c/4', 'e/4', 'a/4'], stem_direction: -1, duration: 'h' }),
126
+ factory.StaveNote({ keys: ['d/4', 'f/4'], stem_direction: -1, duration: 'q' }),
127
+ factory.StaveNote({ keys: ['c/4', 'f/4', 'a/4'], stem_direction: -1, duration: 'q' }),
128
+ ]);
129
+ const formatter = factory.Formatter();
130
+ formatter.joinVoices([voice]).formatToStave([voice], stave);
131
+ factory.draw();
132
+ ok(true);
133
+ }
134
+ VexFlowTests.register(FontTests);
135
+ export { FontTests };
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ class FrameStack {
3
+ constructor(parentEl, numFrames, params) {
4
+ this.parentEl = parentEl;
5
+ this.numFrames = numFrames;
6
+ this.options = Object.assign({ prefix: 'vex-frame-', width: 700, height: 800, iterationCallback: null }, params);
7
+ this.frames = [];
8
+ this.currentFrame = 0;
9
+ document.getElementById(this.parentEl).innerHTML = '';
10
+ for (let i = 0; i < this.numFrames; i++) {
11
+ const div = document.createElement('div');
12
+ div.id = this.frameID(i);
13
+ div.style.position = 'absolute';
14
+ div.style.top = 0;
15
+ div.style.left = 0;
16
+ div.style.width = `${this.options.width}px`;
17
+ div.style.height = `${this.options.height}px`;
18
+ div.style.display = 'none';
19
+ this.frames[i] = div;
20
+ }
21
+ }
22
+ frameID(i) {
23
+ return `${this.options.prefix}${i}`;
24
+ }
25
+ install() {
26
+ this.show(0);
27
+ setTimeout(() => {
28
+ const fragment = document.createDocumentFragment();
29
+ for (let i = 0; i < this.numFrames; i++) {
30
+ fragment.appendChild(this.frames[i]);
31
+ }
32
+ const parent = document.getElementById(this.parentEl);
33
+ parent.appendChild(fragment);
34
+ parent.style.width = `${this.options.width}px`;
35
+ parent.style.height = `${this.options.height}px`;
36
+ }, 0);
37
+ }
38
+ get(i) {
39
+ return this.frames[i];
40
+ }
41
+ show(i) {
42
+ this.frames[this.currentFrame].style.display = 'none';
43
+ this.frames[i].style.display = 'block';
44
+ this.currentFrame = i;
45
+ }
46
+ start(params) {
47
+ const options = Object.assign({ start: 0, end: this.numFrames, intervalms: 100 }, params);
48
+ this.animationTimer = setInterval(() => {
49
+ const frame = this.currentFrame + 1 === this.numFrames ? 0 : this.currentFrame + 1;
50
+ this.show(frame);
51
+ if (this.options.iterationCallback)
52
+ this.options.iterationCallback(frame);
53
+ }, options.intervalms);
54
+ }
55
+ stop() {
56
+ clearInterval(this.animationTimer);
57
+ }
58
+ }
59
+ if (typeof module != 'undefined') {
60
+ module.exports = { FrameStack };
61
+ }
@@ -0,0 +1,203 @@
1
+ "use strict";
2
+ const VF = Vex.Flow;
3
+ function subgroup(el, iterations, params) {
4
+ const options = Object.assign({ systemWidth: 550, debug: true }, params);
5
+ const f = new VF.Factory({
6
+ renderer: {
7
+ elementId: el,
8
+ width: options.width,
9
+ height: options.height,
10
+ },
11
+ });
12
+ f.StaveNote = f.StaveNote.bind(f);
13
+ const stave1 = f.Stave({ x: 15, y: 40, width: options.systemWidth }).setClef('treble');
14
+ const notes1 = [
15
+ { keys: ['f/5'], stem_direction: 1, duration: '4' },
16
+ { keys: ['d/4'], stem_direction: 1, duration: '4', clef: 'bass' },
17
+ { keys: ['c/5'], stem_direction: 1, duration: '4', clef: 'alto' },
18
+ { keys: ['c/5'], stem_direction: 1, duration: '4', clef: 'soprano' },
19
+ ].map(f.StaveNote);
20
+ const notes2 = [
21
+ { keys: ['c/4'], stem_direction: -1, duration: '4' },
22
+ { keys: ['c/3'], stem_direction: -1, duration: '4', clef: 'bass' },
23
+ { keys: ['d/4'], stem_direction: -1, duration: '4', clef: 'alto' },
24
+ { keys: ['f/4'], stem_direction: -1, duration: '4', clef: 'soprano' },
25
+ ].map(f.StaveNote);
26
+ const stave2 = f.Stave({ x: 15, y: 160, width: options.systemWidth }).setClef('bass');
27
+ const notes3 = [
28
+ { keys: ['e/3'], duration: '8', stem_direction: -1, clef: 'bass' },
29
+ { keys: ['g/4'], duration: '8', stem_direction: 1, clef: 'treble' },
30
+ { keys: ['d/4'], duration: '8', stem_direction: 1, clef: 'treble' },
31
+ { keys: ['f/4'], duration: '8', stem_direction: 1, clef: 'treble' },
32
+ { keys: ['c/4'], duration: '8', stem_direction: 1, clef: 'treble' },
33
+ { keys: ['g/3'], duration: '8', stem_direction: -1, clef: 'bass' },
34
+ { keys: ['d/3'], duration: '8', stem_direction: -1, clef: 'bass' },
35
+ { keys: ['f/3'], duration: '8', stem_direction: -1, clef: 'bass' },
36
+ ].map(f.StaveNote);
37
+ f.StaveConnector({ top_stave: stave1, bottom_stave: stave2, type: 'brace' });
38
+ f.StaveConnector({ top_stave: stave1, bottom_stave: stave2, type: 'singleLeft' });
39
+ f.StaveConnector({ top_stave: stave1, bottom_stave: stave2, type: 'singleRight' });
40
+ function addAccidental(note, acc) {
41
+ return note.addModifier(f.Accidental({ type: acc }), 0);
42
+ }
43
+ function addSubGroup(note, subNotes) {
44
+ return note.addModifier(f.NoteSubGroup({ notes: subNotes }), 0);
45
+ }
46
+ f.Beam({ notes: notes3.slice(1, 4) });
47
+ f.Beam({ notes: notes3.slice(5) });
48
+ addAccidental(notes1[1], '#');
49
+ addSubGroup(notes1[1], [f.ClefNote({ type: 'bass', options: { size: 'small' } }), f.TimeSigNote({ time: '3/4' })]);
50
+ addSubGroup(notes2[2], [f.ClefNote({ type: 'alto', options: { size: 'small' } }), f.TimeSigNote({ time: '9/8' })]);
51
+ addSubGroup(notes1[3], [f.ClefNote({ type: 'soprano', options: { size: 'small' } })]);
52
+ addSubGroup(notes3[1], [f.ClefNote({ type: 'treble', options: { size: 'small' } })]);
53
+ addSubGroup(notes3[5], [f.ClefNote({ type: 'bass', options: { size: 'small' } })]);
54
+ addAccidental(notes3[0], '#');
55
+ addAccidental(notes3[3], 'b');
56
+ addAccidental(notes3[5], '#');
57
+ addAccidental(notes1[2], 'b');
58
+ addAccidental(notes2[3], '#');
59
+ const voice = f.Voice().addTickables(notes1);
60
+ const voice2 = f.Voice().addTickables(notes2);
61
+ const voice3 = f.Voice().addTickables(notes3);
62
+ const formatter = f.Formatter();
63
+ formatter.joinVoices([voice, voice2]).joinVoices([voice3]).formatToStave([voice, voice2, voice3], stave1);
64
+ for (let i = 0; i < iterations; i++) {
65
+ formatter.tune({ alpha: 0.01 });
66
+ }
67
+ f.draw();
68
+ if (options.debug) {
69
+ VF.Formatter.plotDebugging(f.getContext(), formatter, stave1.getNoteStartX(), 20, 320);
70
+ }
71
+ }
72
+ function tuplets(el, iterations, params) {
73
+ const options = Object.assign({ systemWidth: 500, debug: true }, params);
74
+ const f = new VF.Factory({
75
+ renderer: {
76
+ elementId: el,
77
+ width: options.width,
78
+ height: options.height,
79
+ },
80
+ });
81
+ const system = f.System({
82
+ x: 50,
83
+ width: options.systemWidth,
84
+ debugFormatter: options.debug,
85
+ formatIterations: iterations,
86
+ });
87
+ const score = f.EasyScore();
88
+ const newVoice = function (notes) {
89
+ return score.voice(notes, { time: '1/4' });
90
+ };
91
+ const newStave = function (voice) {
92
+ return system
93
+ .addStave({ voices: [voice], debugNoteMetrics: options.debug })
94
+ .addClef('treble')
95
+ .addTimeSignature('1/4');
96
+ };
97
+ const voices = [
98
+ score.notes('c5/8, c5'),
99
+ score.tuplet(score.notes('a4/8, a4, a4'), { notes_occupied: 2 }),
100
+ score.notes('c5/16, c5, c5, c5'),
101
+ score.tuplet(score.notes('a4/16, a4, a4, a4, a4'), { notes_occupied: 4 }),
102
+ score.tuplet(score.notes('a4/32, a4, a4, a4, a4, a4, a4'), { notes_occupied: 8 }),
103
+ ];
104
+ voices.map(newVoice).forEach(newStave);
105
+ system.addConnector().setType(VF.StaveConnector.type.BRACKET);
106
+ f.draw();
107
+ }
108
+ function multistave(el, iterations, params) {
109
+ const options = Object.assign({ systemWidth: 550, debug: true, justify: true, alpha: 0.1 }, params);
110
+ const f = new VF.Factory({
111
+ renderer: {
112
+ elementId: el,
113
+ width: options.width,
114
+ height: options.height,
115
+ },
116
+ });
117
+ const score = f.EasyScore();
118
+ const stave11 = f.Stave({ y: 20, width: 275 }).addTrebleGlyph().addTimeSignature('6/8');
119
+ const notes11 = score.notes('f4/4, d4/8, g4/4, eb4/8');
120
+ const voice11 = score.voice(notes11, { time: '6/8' });
121
+ const stave21 = f.Stave({ y: 130, width: 275 }).addTrebleGlyph().addTimeSignature('6/8');
122
+ const notes21 = score.notes('d4/8, d4, d4, d4, eb4, eb4');
123
+ const voice21 = score.voice(notes21, { time: '6/8' });
124
+ const stave31 = f.Stave({ y: 250, width: 275 }).addClef('bass').addTimeSignature('6/8');
125
+ const notes31 = score.notes('a5/8, a5, a5, a5, a5, a5', { stem: 'down' });
126
+ const voice31 = score.voice(notes31, { time: '6/8' });
127
+ f.StaveConnector({
128
+ top_stave: stave21,
129
+ bottom_stave: stave31,
130
+ type: 'brace',
131
+ });
132
+ f.Beam({ notes: notes21.slice(0, 3) });
133
+ f.Beam({ notes: notes21.slice(3, 6) });
134
+ f.Beam({ notes: notes31.slice(0, 3) });
135
+ f.Beam({ notes: notes31.slice(3, 6) });
136
+ let formatter = f.Formatter().joinVoices([voice11]).joinVoices([voice21]).joinVoices([voice31]);
137
+ if (options.justify) {
138
+ formatter.formatToStave([voice11, voice21, voice31], stave11);
139
+ }
140
+ else {
141
+ formatter.format([voice11, voice21, voice31], 0);
142
+ }
143
+ for (let i = 0; i < iterations; i++) {
144
+ formatter.tune({ alphs: options.alpha });
145
+ }
146
+ if (options.debug) {
147
+ VF.Formatter.plotDebugging(f.getContext(), formatter, stave11.getNoteStartX(), 20, 320);
148
+ }
149
+ const stave12 = f.Stave({
150
+ x: stave11.width + stave11.x,
151
+ y: stave11.y,
152
+ width: stave11.width,
153
+ });
154
+ var notes12 = score.notes('ab4/4, bb4/8, (cb5 eb5)/4[stem="down"], d5/8[stem="down"]');
155
+ var voice12 = score.voice(notes12, { time: '6/8' });
156
+ f.Stave({
157
+ x: stave21.width + stave21.x,
158
+ y: stave21.y,
159
+ width: stave21.width,
160
+ });
161
+ var notes22 = score.notes('(eb4 ab4)/4., (c4 eb4 ab4)/4, db5/8', { stem: 'up' });
162
+ var voice22 = score.voice(notes22, { time: '6/8' });
163
+ f.Stave({
164
+ x: stave31.width + stave31.x,
165
+ y: stave31.y,
166
+ width: stave31.width,
167
+ });
168
+ var notes32 = score.notes('a5/8, a5, a5, a5, a5, a5', { stem: 'down' });
169
+ var voice32 = score.voice(notes32, { time: '6/8' });
170
+ formatter = f.Formatter().joinVoices([voice12]).joinVoices([voice22]).joinVoices([voice32]);
171
+ if (options.justify) {
172
+ formatter.formatToStave([voice12, voice22, voice32], stave12);
173
+ }
174
+ else {
175
+ formatter.format([voice12, voice22, voice32], 0);
176
+ }
177
+ for (var j = 0; j < iterations; j++) {
178
+ formatter.tune({ alpha: options.alpha });
179
+ }
180
+ f.Beam({ notes: notes32.slice(0, 3) });
181
+ f.Beam({ notes: notes32.slice(3, 6) });
182
+ f.draw();
183
+ if (options.debug) {
184
+ VF.Formatter.plotDebugging(f.getContext(), formatter, stave12.getNoteStartX(), 20, 320);
185
+ }
186
+ }
187
+ const Tests = {
188
+ tuplets: {
189
+ options: { width: 600, height: 750, debug: true },
190
+ fn: tuplets,
191
+ },
192
+ subgroup: {
193
+ options: { width: 650, height: 350, debug: true },
194
+ fn: subgroup,
195
+ },
196
+ multistave: {
197
+ options: { width: 650, height: 350, debug: true },
198
+ fn: multistave,
199
+ },
200
+ };
201
+ if (typeof module != 'undefined') {
202
+ module.exports = Tests;
203
+ }