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

[How to] How to measure a single character with some font ? #467

Open
eric5f3759df opened this issue Oct 10, 2021 · 1 comment
Open

[How to] How to measure a single character with some font ? #467

eric5f3759df opened this issue Oct 10, 2021 · 1 comment

Comments

@eric5f3759df
Copy link

How to do this in druid?
like some measure text function in some 2d graphic lib.
this feature needed by developing complex rich text app like ms word.
return non-mono char width, font height, ascent, descent, baseline etc.

@cmyr
Copy link
Member

cmyr commented Oct 16, 2021

we don't provide direct access to character information, and the actual visible bounds of a glyph may not correspond to the reported layout metrics.

You can get this information the usual way, though, by creating a TextLayout and then accessing metrics through the methods on that object.

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

2 participants