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

getting the correct bounding box of text #2552

Closed
dshep4 opened this issue Oct 14, 2015 · 3 comments
Closed

getting the correct bounding box of text #2552

dshep4 opened this issue Oct 14, 2015 · 3 comments

Comments

@dshep4
Copy link

dshep4 commented Oct 14, 2015

The bounding box of text seems to be based on the font size rather than the properties of the actual font.. maybe its based on a single font's properties (but which one?). It causes problems when loading the serialized data into another platforms canvas because the 'top' position isn't accurate.

How would you go about getting the actual top position of the text? The baseline of text always seems to be the same ascension from the top of the box, for a given text size, but there doesn't seem to be a way to get that value.

@dshep4
Copy link
Author

dshep4 commented Oct 15, 2015

Each one of these text objects has the same font size

text1
text2
text3

@asturur
Copy link
Member

asturur commented Oct 15, 2015

text metric in javascript returns only the width of text, not the height nor the position of baseline. we guess the height looking at fontsize.

to have better metrics we need an external lib or newer apis from browsers.

@asturur
Copy link
Member

asturur commented Sep 3, 2017

duplicate of #1108

@asturur asturur closed this as completed Sep 3, 2017
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