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

Font::measure returns wrong values #43

Closed
hecrj opened this issue Jun 10, 2019 · 1 comment · Fixed by #51
Closed

Font::measure returns wrong values #43

hecrj opened this issue Jun 10, 2019 · 1 comment · Fixed by #51
Labels
bug Something isn't working
Milestone

Comments

@hecrj
Copy link
Owner

hecrj commented Jun 10, 2019

I found this issue when working on #35.

Right now, the UI renderer applies a correction when measuring Text widgets. This is a dirtyfix and it probably doesn't work well with different fonts.

Here is what happens if we do not apply the correction with Inconsolata Regular:

image

I think GlyphBrush::pixel_bounds is not returning a correct value. We should probably investigate why and file an issue/PR in the glyph-brush repo.

@hecrj hecrj added bug Something isn't working help wanted Extra attention is needed labels Jun 10, 2019
@hecrj
Copy link
Owner Author

hecrj commented Jun 13, 2019

Issue reproduced and reported: alexheretic/glyph-brush#68

It turns out that pixel_bounds is not compatible with Section::bounds. Totally my fault! 😅 The former are the conservative pixel boundaries for the Section, the latter are the bounds available for the text layout. While these may seem like the same thing, they are not (fonts are complicated!). I suspected something like that could be the issue.

We need a GlyphBrush::layout_bounds method. The glyph_brush author has already a working version! 🎉

So we just need to wait until a new glyph_brush release.

@hecrj hecrj changed the title Font::measure seems to return wrong values Font::measure returns wrong values Jun 13, 2019
@hecrj hecrj removed the help wanted Extra attention is needed label Jun 13, 2019
@hecrj hecrj added this to the 0.3.0 milestone Jun 14, 2019
@hecrj hecrj closed this as completed in #51 Jun 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant