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

A text element's width is sometimes smaler than the containing text #1844

Closed
kirschkern opened this issue Nov 20, 2014 · 4 comments
Closed

Comments

@kirschkern
Copy link

The text element can be larger than its actual width property so the text has some overflow. See it here => http://jsfiddle.net/tQCTd/5/ on the "r" character. The selection border, which visualizes the elements width, "cuts" off the "r" at the right side.
How can I get the real width for the text element?

I need this as I use the text element only as a wrapper to draw on a hidden canvas, get the image data from it and do some image manipulation on it. (Mainly removing anti-aliasing and adding a border.) However, when using the width of the text element to size my hidden canvas, some characters get cut off.

@kangax
Copy link
Member

kangax commented Nov 24, 2014

I haven't looked much into it but I think this might have to do with browsers reporting inaccurate width for characters at such large scale. We could fix it by employing per-pixel bounds detection of some sort, which would be especially useful for non-standard fonts (think Lobster, etc.)

@asturur
Copy link
Member

asturur commented Nov 24, 2014

We should merge this with the custom font problem, at the end is one big issue.

@kangax
Copy link
Member

kangax commented Nov 24, 2014

Let's do it.

@asturur
Copy link
Member

asturur commented Nov 24, 2014

Similar to #1108 and #1326.

@asturur asturur closed this as completed Nov 24, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants