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

Incorrect glyph icon width in layout when using a non-monospaced font. #182

Open
aakamenov opened this issue Sep 16, 2023 · 0 comments
Open

Comments

@aakamenov
Copy link

The line_w field is less than the actual icon glyph when calling buffer.layout_runs() whenever the line contains a single icon glyph. Actual rendering is correct. However, this becomes an issue when rendering to a surface with dimensions based on the measured layout size, since the glyph gets cut off and ends up looking like this:

20230916_17h44m23s_grim

The behaviour occurs with any of the several icons that I've tried. The screenshot above was taken from my own project, however the same issue can be observed in Iced when using the WGPU renderer (doesn't happen with the tiny-skia renderer since the glyphs are being rendered directly to the window surface which is much larger):

20230916_18h01m12s_grim

If it matters, I'm using the icons through a Nerd font, but Iced and the editor-libcosmic example don't afaik.

It's also possible to see that the cursor is also placed incorrectly in the editor-libcosmic example:
20230916_18h00m35s_grim

Interestingly, I noticed the exact same behaviour in both Nano and Sublime 4. So my questions are:

  • Is this a bug or it's how "things are supposed to work" when using a non-monospaced font.
  • Is this measuring logic in Iced incorrect then?
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

1 participant