FreeType Support

Woopsi now has FreeType support. That means it will load TrueType, OpenType, FNT and nearly a dozen other types of font.

Many thanks to Lakedaemon for his hard work implementing this. All I had to do was tidy up the code a bit, split the classes into three separate cpp/h file combos and make a couple of minor alterations to the build files.

Lakedaemon, if you’re interested in getting hold of the latest version, pull down the Woopsi branches folder from SVN and take a look at the “woopsi_with_freetype” branch. To compile with FreeType support:

  • Deploy libwoopsi as usual to your devkitPro folder.
  • Copy “libfreetype” to your devkitPro folder from the “libs” directory within the “libwoopsi” folder.

Here’s your FreeType demo altered to use the new structure. It’s identical except for two more includes.

I need to do some testing and see if I can get your suggested monochrome version working. I’d also like to try and use the pre-ported version of FreeType hosted by the devkitPro guys instead of a custom build, but their instructions for how to use the port libraries don’t seem to be terribly accurate. Once I’m happy with it I’ll merge the branch into the trunk and we’ll have another release to play with.

I’m not sure how this is going to work with the SDL version yet.


Lakedaemon on 2010-01-31 at 13:14 said:

I’ll have a look when I can (have been busy with life recently…Can’t wait to spend more time hacking away…)

Lakedaemon on 2010-02-03 at 08:18 said:

Found time to hack a little bit. Here is the result : http://www.lakedaemon.org/demo.zip

There are quite a few issues that need to be resolved yet.

On a side note, concerning the freetype font, it’s working ok, but I think that there are little flaws because of the differences of the drawing models between Woopsi and Freetype :

Woopsi draws bitmap that have an height and a width on the bottomline

Freetype draws bitmap on a baseline that isn’t the bottom line. More precisely, it draws a bitmap with “width” & “height” with offsets : “top” is vertical the distance from baseline to the top of the bitmap and “left” is the distance from the pen to the left of the bitmap and each char has an “advance”, which means that after freetype draws achar, the x position advances with a value that isn’t necessarily the total width of a char.

You might notice this behaviour with the aforementionned demo (look at the cursive/calligraphic font).

At some point, slight changes might have to be done in woopsi to accomodate that. (I’ll keep experimenting and report back).