Loading font from a file

Hi all !

Is there a way with JUCE to load a font from a file or, better, include a font in the executable ?


Absolutely. Do a search for CustomTypeface…

Thx for this quick answer.

However, when i try to serialise my font, i only get a small file and Loading this file back does not give me access to my original font ( No characters at all ).
Using my font after this code does work, so the issue does not come from an “empty” font.

here is my code:

    String str("Eurostile");
bFont = new Font(str,12,Font::plain);
Typeface tf(*(bFont->getTypeface()));
File file("/Users/drolland/Eurostile_font.h");
FileOutputStream fileos(file);

what i am doing wrong ?

Thx !

It’ll only save any characters that have been loaded into the typeface (by drawing them).

have a look here
and here