Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Investigate writeTextToCanvas and measureText function #9767

Open
ebogo1 opened this issue Aug 30, 2021 · 2 comments
Open

Investigate writeTextToCanvas and measureText function #9767

ebogo1 opened this issue Aug 30, 2021 · 2 comments

Comments

@ebogo1
Copy link
Contributor

ebogo1 commented Aug 30, 2021

In #9765 we settled on a manual pixel-counting approach instead of using the stock browser function CanvasRenderingContext2D.measureText(). This is because browser results were inconsistent, and at the time of the PR, some of the TextMetrics properties were unsupported by Firefox for Android.

If CanvasRenderingContext2D.measureText(), it would be cleaner to use it instead of drawing the text to a canvas and counting each pixel. Instead we could replace ascent, descent, and minx by the TextMetrics properties actualBoundingBoxAscent, actualBoundingBoxDescent, and actualBoundingBoxLeft.

Until then, maybe it's worth taking another look at why writeTextToCanvas is needed..

@javagl
Copy link
Contributor

javagl commented Dec 16, 2023

Related to #10649 (comment) : It might be easy to replace this function with the built-in functions now.

@ggetz
Copy link
Contributor

ggetz commented Jan 2, 2024

Additional issues reported in #11705.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants