Dave's Blog

[ home ]

 

...

This blog has no purpose

...



David Scott
dave@recoil.org

August 2005
Sun Mon Tue Wed Thu Fri Sat
 
     

RSS Feed
Subscribe to an RSS feed.

Affiliations

Other blogs


Creative Commons License
Except where otherwise noted, this blog is licensed under a Creative Commons License.

     
Mon, 01 Aug 2005

Camlimages, freetype and kerning
I decided to revamp the font rendering code used by my OpenGL apps. The font support (originally written by Anil) predates (I think) the time when camlimages had bindings for the freetype library. Now that the bindings exist it makes sense to me to take advantage of them. Anyway, I threw together a simple bit of code to extract font outlines (a mix of linear, quadratic and cubic curves) and perform adaptive subdivision to convert the quadratic and cubic curves to straight-line segments. This was a fairly straight-forward implementation of de Casteljau's algorithm with a slightly hacky "flatness criterion" for the time-being (some notes on this topic can be found here).

Once the basics were working I noticed that the camlimages/freetype binding seems to lack an API to extract kerning information (definition of kerning from wikipedia). So I added that and it seems to work! Check out these two pictures:

The topmost picture is without kerning enabled and the bottommost one has kerning enabled. Check out the relative distance between the "A" and the "V". Now to work on ligatures...

[/misc] permanent link