UI text is blurry

Choicebutton text is blurry, but MenuItem text isn’t. I guess the blurry text is anti-aliased? Why are some widgets anti-aliased and some aren’t? Is there an “easy” way to make all text be aliased? My browser and all my editors display what I would consider “sharp” text. image

oops - the above was taken from v1.0, but the zoom was set to 105%. When back to 100 it looks fine. For sure the font rendering isn’t “perfect” as you change the zoom, but that’s to be expected.

I’ve always noticed that some letters in the default font don’t seem to render optimally. Look at how the left side of “M” is nice and sharp, but it’s blurry on the right side. I’m guessing this is because the font renderer is not snapping the vertical lines to the nearest pixel, so the right side is landing on a half pixel position. Is this a limitation of nano-vg? Or of the font? It definitely makes drawn text look sloppy. image

If you have a solution, as either a patch to NanoVG or as a suggestion of how nvgText calls should be handled in Rack, let me know.

Yeah, I talked to a friend who knows more about graphics that me. He said that since nanovg renders all its text to a “texture atlas” It doesn’t know where the pixels are when it’s rendering the text. So it can’t do the hinting that most font renders (windows, os x, skia) do. If I run into any magic work-arounds I will report back.

The magic workaround is to render font glyphs to a black and white atlas, with extra space, and generating a signed distance field from the atlas. It’s a common trick in some of the fancier rendering engines because with the right shaders and inputs it emulates vector fonts fairly okay.

Ok, but that is way, way, way more effort than it takes to render sharp text using Core Graphics, or win32.

WINAPI can’t render to OpenGL :thinking:

It doesn’t take any more effort on the user-side (select font, render) for a sufficiently well designed API. I don’t know how difficult patching it on to nanoVG is (ex. does nanovg render through GDI to a texture and transmit it, or does it already make atlasses, etc.)

this