Proposed improvement: text metrics interface #32
Closed
KaliedaRik
started this conversation in
Ideas
Replies: 3 comments
|
Currently in development for the new Label and EnhancedLabel entitys, which will replace Phrase entitys in v8.13.0 |
0 replies
|
This work has been completed in PR #75 and merged into |
0 replies
|
Released as part of v8.13.0. Marking discussion as completed. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Issue:
SC's current Phrase entity text handling is fairly rudimentary. While words and glyphs can be styled individually, and SC does what it can to support multiline Phrases, glyph positioning deliberately ignores
textBaselineconsiderations and forces the baseline to the top. This is good when we are treating the Phrase's text content as a single graphic, but limits the mixing of different fonts and font sizing within a single Phrase.Investigation:
The Canvas API's TextMetrics interface has improved over the years and some of its key metrics (around
actualBoundingBox) are widely supported. However:fontBoundingBoxattributes are not supported in Firefoxbaselineand other metrics are only supported in SafariWhile improved baseline support is probably out of scope for SC at this time, there may be an opportunity for better, more accurate line height support which can be introduced sooner rather than later
Risks:
Text and font support in the canvas remain a nightmare. Direct interactive canvas text will never be in-scope for SC, which must never become a replacement for existing DOM/CSS text layout/interaction functionality.
All reactions