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

Text blurry with femtovg renderer #5177

Open
CryZe opened this issue May 5, 2024 · 1 comment
Open

Text blurry with femtovg renderer #5177

CryZe opened this issue May 5, 2024 · 1 comment
Labels
a:text Text rendering, fonts, Text input (mS,bF)

Comments

@CryZe
Copy link

CryZe commented May 5, 2024

I just tried slint for the first time. In general I judge the usability of a GUI framework based on how well it handles text, and while I noticed a few problems, it seems like font fallback and some IME support is there, which surprised me positively. Nevertheless one of the most common issues with text is unclear rendering. Turns out that it's particularly bad here in slint with the default femtovg renderer.

I however already figured out the problem. It turns out that the text is not aligned to the pixel grid. So when femtovg blits the glyphs from its glyph atlas, it uses a bilinear filter. So if the text is off by half a pixel you essentially get two source pixel averaged together per target pixel, meaning you effectively reduce the resolution of the text by half.

image

The left is the default text rendering with femtovg and the right is me having patched femtovg to use nearest neighbor for their glyph atlas (you can do so via the ImageFlags here).

Now I don't know if that's the actual solution, but it at least worked around the problem for the most part. There's still some rare edge case where the two triangles making up each glyph end up blitting the texture off by 1 pixel respectively.

@ogoffart
Copy link
Member

ogoffart commented May 6, 2024

Thanks for the bug report.
This seems similar to #4868

@ogoffart ogoffart added the a:text Text rendering, fonts, Text input (mS,bF) label May 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:text Text rendering, fonts, Text input (mS,bF)
Projects
None yet
Development

No branches or pull requests

2 participants