Detailed changes are listed on the wiki: https://github.com/0xfe/vexflow/wiki/Changelog-ver-4.0
- VexFlow is written in TypeScript with a ES6 target.
- Supports ES module in addition to CommonJS environments.
- Improved automatic layout of notes.
- Improved handling of music fonts and text fonts.
- Supports lazy loading of music fonts.
- Improved
setFont(...)method in Element class.
-
The tsconfig.json
compilerOptions.targethas been updated to ES6 / ES2015. -
Stave.setNumLines(n: number)requires a number. Previously, a string would also work. See: stave.ts and #1083. -
Note.addModifier(modifier: Modifier, index?: number): thisnow throws a RuntimeError if the parameters are reversed. -
TickContext.getTickableForVoice(voiceIndex: number): Tickablewas previously namedgetTickablesForVoice(voiceIndex: number): Note. We removed thesbecause the method returns a single Tickable. You will need to update calls to this function if you are upgrading from a build from between April 2020 to August 2021. -
Elementand its subclasses have a staticCATEGORYstring property, used by VexFlow internally to differentiate objects. This string has been standardized to be singular, with UpperCamelCase capitalization.- Examples:
Accidental.CATEGORYis now'Accidental'instead of'accidentals'.Modifier.CATEGORYis now'Modifier'instead of'none'.
- Examples:
-
ChordSymbol
ChordSymbol.NO_TEXT_FORMATwas previously namedChordSymbol.NOTEXTFORMAT.ChordSymbol.metricswas previously namedChordSymbol.chordSymbolMetrics.
-
StaveNote.LEDGER_LINE_OFFSETwas previously namedStaveNote.DEFAULT_LEDGER_LINE_OFFSET. -
Fonts
TextFontMetricshas been merged intoFontGlyphdue to substantial overlap.Flow.NOTATION_FONT_SCALEwas previously namedFlow.DEFAULT_NOTATION_FONT_SCALE.setFont(...)inCanvasContextandSVGContextpreviously took arguments:family,size,weight. Theweightargument allowed strings like'italic bold'. This no longer works, and'italic'must now be passed into thestyleargument.
-
Build Process
- Gruntfile environment variable
VEX_DEVTOOLwas previously namedVEX_GENMAP. This environment variable sets the webpack devtool configuration option.
- Gruntfile environment variable
- Support Bravura, the reference font for Standard Music Font Layout.
Accidental.ApplyAccidentals()no longer breaks onNotesthat ignore ticks (ie:TimeSigNote)Accidental.applyAccidentals()now applies accidentals toGraceNotes- Fix a
BoundingBox#mergeWithcase when one box contains another - Fix blurry canvas rendering on retina screens
- Rebuild noteheads after
StaveNote#setKeyLineis called - Ensure
StaveNote.extraLeftPxandStaveNote.extraRightPxget recalculated inStaveNote#reset Factoryexposes a lot more elements -- API is subject to changeFactoryconstructoroptions.renderer.selectorrenamed tooptions.renderer.elementIdto more appropriately reflect the what the string represents- Sori and koron microtonal accidentals have been added
- Tests have been refactored to use
FactoryandEasyScore - The font transformation tool (
transform.html) has been refactored, and generates a font by combining both theGonvilleandMicrotonalfonts.