-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
measureText returns incorrect actualBoundingBoxLeft and actualBoundingBoxRight #1703
measureText returns incorrect actualBoundingBoxLeft and actualBoundingBoxRight #1703
Comments
I do have the same issue. Looking at the code in CanvasRenderingContext2d.cc, I might have found something in the following lines: node-canvas/src/CanvasRenderingContext2d.cc Line 2701 in 12e671d
node-canvas/src/CanvasRenderingContext2d.cc Line 2704 in 12e671d
Shoul |
@zbjornson : thanks for your thumbs up. Should I create a pull request with these changes or can it be handle by one of the official maintainers? |
@mserege it would be fantastic if you want to work on a pull request with those changes. I don't know for certain if what you proposed is correct, but it sounds promising. |
@zbjornson : it is done here : #1776. It fixes the issue for me. |
Thanks @mserege for fixing this - ran into a similar problem. @zbjornson could you give me a timeline when we can expect 2.8.0 to be released ? |
@zbjornson : could you give us an estimated date for the next release that will include this fix? |
Issue
When using
measureText
, the returnedTextMetrics
object doesn't return accurate values foractualBoundingBoxLeft
andactualBoundingBoxRight
. In fact, they seem to fall back to 0 and the value ofwidth
respectively.This might overlap with #331, #801, and #1553, as indeed the output differs between a browser and Node.js (also between integer or floating point numbers), but none of these refer to the bounding box.
Steps to reproduce
I'm using Open Sans in this example. In Node, I'm using
fs-extra
to output the image as a PNG.Begin the Node.js version with the following.
Begin the browser version with the following, ensuring that a canvas with id
canvas
exists on the page:Then add the following to both:
Browser output:
Node.js output:
Your environment
The text was updated successfully, but these errors were encountered: