Help with Freetype and AudioPlugin


Hi there,

I’m struggling to get Freetype working in JUCE so I’ve edited the Demo Audio Plugin to be capable of rendering freetype fonts:

This includes the FreeTypeAmalgam and Vinnie’s FreetypeFaces, and compiles and runs fine. However when running, the command:

fails to load the font, so the code reverts back to the default font. Would anyone be able to help get this simple example working? I’ve tried a couple of font files (one of which is included) but no luck… It seems that I’m getting error = 2 from the line:

If there is a simple solution for this I would be eternally grateful for suggestions (can comment here or pull request on github). Basically I’m trying to work out if it is an error with the code or with the font…

EDIT: note that I had to comment out the following lines to get it to compile:


Many thanks, Hemmer


I’ve been messing with this only yesterday (and today…). Firstly, using the latest FreeTypeAmalgam works for me. I did not have to comment out those lines, although i do get a warning about FT_Bitmap_Convert.

I would suggest, try a simple and known TTF font file. Your error could be due to corrupt font data.


Ok with the latest version I don’t need to comment those lines, thanks. I worked out what was wrong, you only need add the font directly (and add it to Binary Resources) - I was serializing it first (as this is how I used to use fonts with JUCE)!

As it happens I’m still having difficulty using it to render pixel accurate fonts consistently on Win (, Mac ( and Linux (…

NOTE: I 100% do not want to restart the whole “should we use pixel fonts”, I just want to try to get them working for me personally…


That looks like SilkScreen to me - I use the JUCE font renderer for that and FreeType for everything else. Seems a waste of effort to use FT on a pixel accurate font!

BTW for SilkScreen, set the height to 7.4f to get it to look right with the JUCE renderer.

…and yeah serialising the font first has tripped me up a few times in the past too!


I actually had the exact same problem (fine on Win and Linux, not on Mac) with the JUCE renderer (using the 7.4f) which led to this whole experiment. You wouldn’t know of a bulletproof way to do this cross platform would you? I had thought that Freetype might have been the answer…


Sorry, no. I’m not targeting Linux at all.

Btw, what height do you use with FreeType? Have you tried varying it to look OK on the different platforms