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 |
Beta Was this translation helpful? Give feedback.
0 replies
-
This work has been completed in PR #75 and merged into |
Beta Was this translation helpful? Give feedback.
0 replies
-
Released as part of v8.13.0. Marking discussion as completed. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
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
textBaseline
considerations 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:fontBoundingBox
attributes are not supported in Firefoxbaseline
and 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.
Beta Was this translation helpful? Give feedback.
All reactions