On 2/8/2017 at 1:07 AM, formerly_known_as_samoth said:
For those unaware, while we're at "rendering text", I'd like to use the occasion to point out this guy's technique which I stumbled upon a few months ago:
http://wdobbie.com/post/gpu-text-rendering-with-vector-textures/ (live demo: http://wdobbie.com/pdf/)
What's special about it? He stores the actual bezier curves (splitting cubic ones into several quadratics) in a texture buffer and renders them in realtime in the fragment shader, with supersampled antialiasing. Which is just fffffffffffffffucking awesome quality, irrespective of how far you zoom. What's the most stunning, it isn't even painfully slow. You would think it's crawling, but it's not.
I only wish there were tools available to convert any TTF font, too...
Back in December, I started playing around with new font rendering techniques, and I ran into some serious numerical robustness issues with the above method. You can see some of the problems in this Twitter thread:
I spent about a month full-time trying to make it work, but failed over and over. I could fix some artifacts, but doing so would always introduce others. There is simply no way to make this approach work cleanly for all fonts, sizes, etc., due to the finite precision of floating-point operations and the manner in which the technique determines whether a pixel is inside the glyph or not.
So I started doing some R&D and came up with a new method that I've now turned into this product:
http://sluglibrary.com/
It is 100% robust for all possible inputs, it's about 8 times faster than the above method, and it doesn't have the glyph complexity limits that the above method has.
To my knowledge, this is the only production-ready solution for rendering text directly from glyph outlines, and it has arrived right as GPUs are becoming powerful enough to justify it and right as higher-DPI displays are becoming common enough to create a need for it.
And there's even a conversion tool so you can try out any TTF font.