[World] Text rendering wrapup

Daniel Phillips phillips at phunq.net
Tue May 29 22:14:43 PDT 2012


After the extended round of mathematical hacking on the weekend, when it came 
time to drop the prototype text rendering code into the production engine it 
was really sweet and just worked.

Not to understate the gratitude I feel towards the GLC developers for 
providing me with usable if less than stunningly beautiful OpenGL text 
rendering these last few years, and for the usual cost... nothing... but the 
time has come to say goodbye to GLC.

    Font28.png

And hello to proper antialiased text rendering.

    Font29.png.

Here is what the wheel looks like in follow-the-dots form (just dump out the 
vertex ids): font31.png

And one more typical use case: font23.png.

This text rendering component is capable of a lot more than simple pixel 
aligned text. It can do all the things I showed in the last few posts, like 
Unicode fonts, 3D aligned text, special effects and so on. The attached images 
just use the simple v3print/v3printf interface, like this:

	v3print({0, 0, 0}, "Hello World!");

or:

	v3printf({1, 2, 3}, "%i", foo);

This is the C style function interface. There is a more capable C++ class 
interface where calls look like:

     font.print({1, 2, 3}, text...);

to give access to all the fonts on the system, 3D alignment, special effects, 
and so on. The C interface is actually just a wrapper for the C++ font class. 

There is now an interface to the fontconfig library to access fonts by 
descriptive names like "DroidSans:Bold" instead of filenames. As a nicety, you 
can give a path to a file in place of a font name and that font file will be 
used directly without going through fontconfig. This lets you try out fonts 
before you install them, or access fonts that you ship as part of a tarball 
for example.

The complete code base to replace GLC weighed in at 600 lines and does 
considerably more, like modeling 3D text with a little help from the mesh 
library.

Maybe this code should be turned into a proper standalone library to push 
upstream. Maybe call it GLD.  Unfortunately, GLC has not had a check-in for 
two years, so this would likely be appreciated.

Finally, thankyou very much for bearing with me through this relatively 
prosaic round of development. I know that what we really want to see is more 
3D modeling, and more models that look like they could drop right into a game 
engine. But this text thing was a big deal for me, an itch I've been wanting 
to scratch for a few years now. And it is fair to say, this particular itch is 
now well and truly scratched.

Regards,

Daniel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://phunq.net/pipermail/world/attachments/20120529/88ce0b1d/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: font28.png
Type: image/png
Size: 6221 bytes
Desc: not available
URL: <http://phunq.net/pipermail/world/attachments/20120529/88ce0b1d/attachment-0004.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: font30.png
Type: image/png
Size: 7306 bytes
Desc: not available
URL: <http://phunq.net/pipermail/world/attachments/20120529/88ce0b1d/attachment-0005.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: font31.png
Type: image/png
Size: 282453 bytes
Desc: not available
URL: <http://phunq.net/pipermail/world/attachments/20120529/88ce0b1d/attachment-0006.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: font32.png
Type: image/png
Size: 91583 bytes
Desc: not available
URL: <http://phunq.net/pipermail/world/attachments/20120529/88ce0b1d/attachment-0007.png>


More information about the World mailing list