v2.0.2
New Features
- Added
fontHintingattribute (off by default to better match font weights in browser rendering). Setting it totruemay result in crisper edges but adds some weight to the font.
Bugfixes
- Text spacing
- Setting
letterSpacingno longer indents text at beginning of line letterSpacingnow properly handles negative values
- Setting
Misc. Improvements
- Improved accuracy of
measureText()- Now uses font metrics' default leading when the line-height is left unspecified in the
ctx.fontstring (NB: this is likely to cause vertical shifts for non-alphabeticbaselines) - Updated baseline offset calculations for
middle&hangingto better match browsers - The
actualBoundingBox*&lines[].x/y/width/heightrectangles returned by measureText() are now just the glyph-occupied area, not the whole line-height of the textblock - Fixed the sign on
actualBoundingBoxLeft(positive values now mean left of the origin) lines[].baselinenow corresponds to the selectedctx.textBaseline, previously it was always the alphabetic baseline
- Now uses font metrics' default leading when the line-height is left unspecified in the
- TypeScript definitions no longer include the entire DOM library (which had been pulling in tons of non-Canvas-related object types that this library doesn't emulate)