Loading font from a file


#1

Hi all !

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

thx.


#2

Absolutely. Do a search for CustomTypeface…


#3

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);
tf.serialise(fileos);
fileos.flush();

what i am doing wrong ?

Thx !


#4

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


#5

have a look here
http://www.rawmaterialsoftware.com/viewtopic.php?f=6&t=54
and here

http://edoapp.googlecode.com/svn/trunk/Tools/Fserialize/