this.size
is specified in points. Convert to pixels.
The glyphs table is indexed by the character (e.g., 'C', '@'). See: robotoslab_glyphs.ts & petalumascript_glyphs.ts.
Retrieve the character's advanceWidth as a fraction of an em
unit.
For the space character ' ' as defined in the:
petalumascript_glyphs.ts: 250 advanceWidth in the 1000 unitsPerEm font returns 0.25.
robotoslab_glyphs.ts: 509 advanceWidth in the 2048 unitsPerEm font returns 0.2485.
Retrieve the total width of text
in em
units.
The width of the text (in em
) is scaled by the font size (in px
).
in pt.
Create a hash with the current font data, so we can cache computed widths.
Call TextFormatter.registerInfo(info)
to register font information before using this method.
This method creates a formatter for the font that most closely matches the requested font. We compare font family, bold, and italic attributes. This method will return a fallback formatter if there are no matches.
Return all registered font families.
used as a key to the font registry.
the same info object that was passed in via TextFormatter.registerInfo(info)
Apps may register their own fonts and metrics, and those metrics will be available to the app for formatting.
Metrics can be generated from a font file using fontgen_text.js in the tools/fonts directory.
To enable logging for this class. Set
Vex.Flow.TextFormatter.DEBUG
totrue
.