-
Notifications
You must be signed in to change notification settings - Fork 299
Investigation: Font glyph rendering doesn't seem quite right. #22
Comments
First of all, thanks for starting this project! I think there's a lot of promise in a native Go UI library and I'm looking forward to how it will develop! I don't know about you, but what I find disagreeable about the fonts in GXUI is the lack of subpixel rendering. This has become so commonplace nowadays that fonts rendered with "conventional" smoothing techniques look "not quite right", as you wrote, at least on low-DPI screens. I have investigated a bit, and unfortunately freetype-go doesn't support subpixel rendering at the moment - which makes sense considering that the initial application was drawing text into images, but is unfortunate when you want to use it for a UI library. I'd even volunteer to do it, but there's a lot of theory involved that I'm not familiar with, so the task is pretty daunting. Maybe looking at the subpixel rendering code of the original freetype library and porting that to go is more feasible? |
Thank you and welcome.
This is certainly likely to be a contributor to the poor quality and I definitely would love to have support for sub-pixel rendering, but is unfortunately a minefield for patents. Last time I checked sub-pixel rendering was still disabled by default in freetype. I'm sure there's other things that could be done to improve the quality though. Glyphy looks interesting, although the pre-computation and rendering cost seems quite scary. |
Another factor to take into account is that anti-aliasing is turned on with 4 samples: Line 71 in e602021
glfw.WindowHint(glfw.Samples, 4) |
MSAA does not affect texture sampling. It is only used to anti-alias the polygon edges, which in the case of the glyphs should always be fully transparent. |
Ah, so each glyph is just a textured quad? I see; I hadn't looked into its details yet. In that case you are right, MSAA should not affect it. |
Yes. A very brief overview of how they work:
|
I've spent a few days looking into what exactly I'm finding disagreeable, and I have a few theories starting from most likely to least:
I will need to spend a bit more time investigating what isn't quite right here.
The text was updated successfully, but these errors were encountered: