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 can i get the bearing information for text rendering? #85

Open
sry948749099 opened this issue Jul 3, 2023 · 5 comments
Open

How can i get the bearing information for text rendering? #85

sry948749099 opened this issue Jul 3, 2023 · 5 comments

Comments

@sry948749099
Copy link

Now, this crate could only get the offset from baseline to left of glyph, but i want to know how to get the offset from baseline to top of glyph, Please let me know at your convenience what interface i should call

@alexheretic
Copy link
Owner

Do you mean ascent?

@sry948749099
Copy link
Author

Do you mean ascent?

thanks for your reply
I don't think it's ascent, because ascent in ab glyph crate doesn't depend on glyph id, but all glyph are the same

@alexheretic
Copy link
Owner

Ascent is generally what you use for layout kind of work. What do you need the per-glyph height for? Rasterization?

@sry948749099
Copy link
Author

Ascent is generally what you use for layout kind of work. What do you need the per-glyph height for? Rasterization?

find the baseline of this glyph, by the way to get the rectangle coords of each glyph for text rendering.

@alexheretic
Copy link
Owner

alexheretic commented Jul 5, 2023

find the baseline of this glyph, by the way to get the rectangle coords of each glyph for text rendering.

Sorry, I'm not 100% understanding your questions.

But related to rendering, to render you first outline the glyph. From that you can draw pixels. The outlined glyph provides the OutlinedGlyph::px_bounds a rectangle covering the glyph's pixels. This is perhaps what you are looking for?

The image example demonstrates usage.

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