Help with Freetype and AudioPlugin


#1

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:

#define FT_CONFIG_OPTION_USE_LZW #define FT_CONFIG_OPTION_USE_ZLIB

Many thanks, Hemmer


#2

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.


#3

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 (http://i.imgur.com/QEmxVrd.png), Mac (http://i.imgur.com/d3dmfRa.png) and Linux (http://i.imgur.com/QS65OYL.png)…

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…


#4

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!


#5

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…


#6

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