Archive for February, 2013

C++ FreeFontStack

I’ve been doing a lot of research into free software font technologies and as a consequence I’ve been playing around a lot with Freetype2 and Fontconfig (actually the library interface libfontconfig). These are “straight up” c-libraries and so I (personally) find the interface a bit “clunky” in C++ code. Don’t get me wrong, I wouldn’t presume to criticize their design as it is clear the authors/maintainers are far more knowledgeable about this stuff than I am… but from a users perspective I desire a bit more.

So… I’ve written some C++ wrappers for freetype2 and fontconfig. The main goals in these projects are:

  • Don’t change the usage patterns of the library
  • Provide a pointer-like type which automatically performs reference counting for reference counted objects
  • Provide a pointer-like type which exposes member-functions where relevant
  • Provide a pointer-like type which still allows access to the public data members of the underlying structures
  • Allow access to the native c-pointer for use in parts of the library that I haven’t finished wrapping

So far… cppfontconfig wraps more or less all the functionality of libfontconfig. I’d still like to add some interface for assignment by touples in order to grab error codes when desired without the error being part of the function signature. Perhaps in the future.

cppfreetype isn’t nearly as complete (freetype2 is a much larger library). I still haven’t decided the appropriate way to deal with structures which are normally stack allocated. I do however have wrappers for FT_Face, FT_GlyphSlot, and an iterface for iterating over contours and points in an FT_Outline.

These libraries are released as GPLv3. I have public git repositories and publicly accessible doxygen documentation available in the links below. No bug tracker though since I’m giving up on redmine.

library source repository documentation
cppfreetype git://
cppfontconfig git://

No Comments