memononen / nanovg

Antialiased 2D vector drawing library on top of OpenGL for UI and visualizations.
zlib License
5.07k stars 767 forks source link

Sharper text drawing? #532

Open orange451 opened 5 years ago

orange451 commented 5 years ago

Look at these two images:

1. https://i.imgur.com/kWBvx6Y.png 2. https://i.imgur.com/7W8u9Fg.png

Image 1 is drawn via JavaFX. Image 2 is drawn via NanoVG. I cannot use JavaFX as per the scope of my project; I need to use NanoVG. Text drawing in JavaFX looks much sharper though, and I was wondering if there was a way this could be implemented into NanoVG. This blurry text only seems to appear on standard displays. On high pixel density monitors (things like retina macbook) the text drawing looks great regardless.

orange451 commented 5 years ago

Some research shows that this is called Subpixel rendering. https://computergraphics.stackexchange.com/questions/2034/why-does-black-text-have-orange-and-blue-pixels https://en.wikipedia.org/wiki/Subpixel_rendering

Still think this may need to be implemented on your end. Let me know if that's not the case.

orange451 commented 4 years ago

Would love a response on this. My textboxes look quite blurry without subpixel rendering!

namark commented 4 years ago

@orange451 There is this fork that implements a version of that algorithm https://github.com/Const-me/nanovg might be worth trying it out.

orange451 commented 4 years ago

Unfortunately, I am using nanovg as a part of LWJGL (Java), which auto-generates a wrapper jar file from this repository, so as far as I'm aware, I can't use another repository's code base.

Is it possible to integrate this with the base project? @memononen