[World] Much better text

Daniel Phillips phillips at phunq.net
Wed May 23 17:55:45 PDT 2012


Eureka!

To tell the truth, I was less than totally pleased with my text rendering 
results from yesterday. Better than GLC, yes, but starting to look like a long 
slog to get to something really pleasant. Happily it didn't turn out that way. 
Instead we were already just a bit of tweaking away from satisfaction, see 
font9.png. I don't know about you, but I'll put up with that text quality any 
day. Font4.png was a rest stop on the way there, some details were still a 
little shaky.

The main thing is to use a good quality hinted font, in this case Liberation 
Sans Bold, thank you very much Red Hat.

See the cheeky announcement here:

    https://www.redhat.com/promo/fonts/

With this donation to the public, Red Hat effectively broke Microsoft's lock on 
font usage which up till then had been an annoying issue for open source. This 
gives us proper hinting and high quality glyph design. In fact, where I see 
significant differences from the Microsoft equivalents, I generally prefer the 
Liberation version.

Other small tweaks were in the bitmap loader, mainly doing a better job of 
calculating alpha values for blending to the background image. But still not 
perfect - for no reason other than not having got around to it, I do not have 
a way to load Freetype's gray scale bitmap as an alpha map, so instead of 
fixing that I hacked around it by calculating an RGBA equivalent, which won't 
deliver quite the same quality without a lot more effort on fancy filtering. But 
that hack might actually turn out to be not completely wasted effort because 
later on it could be adapted to support arbitrary textured glyphs. In any 
case, proper gray scale alpha map loading goes on the list of things to do.

I slept on it and settled the memory format question: it's going to err on the 
side of OpenGL friendliness, which means, upside down from the point of view 
of an old PC hack.  So the messy vertical flip happens at font load time and 
doesn't contribute to obfuscating the layout math later - which is another big 
squiggling can of worms coming up soon that can use all the help it can get.

The bottom line is, this text rendering is now good enough. Better than good 
enough, actually, roughly 100 times better than I've had to put up with to 
date. Now there is just a modest amount of work left to put it into service.

Regards,

Daniel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://phunq.net/pipermail/world/attachments/20120523/018be360/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: font9.png
Type: image/png
Size: 23218 bytes
Desc: not available
URL: <http://phunq.net/pipermail/world/attachments/20120523/018be360/attachment-0002.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: font4.png
Type: image/png
Size: 205991 bytes
Desc: not available
URL: <http://phunq.net/pipermail/world/attachments/20120523/018be360/attachment-0003.png>


More information about the World mailing list