Embedded Font Size


I am using this great method that Jules did last year called Typeface::createSystemTypefaceFor().

My goal is to use a font called "Open Sans" and I have 4 files that I loaded into Binary using IntroJucer.

Files are called OpenSans_regular.ttf, OpenSans-Bold.ttf, OpenSans-Semibold.ttf, OpenSans-Light.ttf.

I tried with one file to generate a Font that I want to use specifically in a Label. Here is the code:

Typeface::Ptr tface = Typeface::createSystemTypefaceFor(BinaryData::OpenSansRegular_ttf, BinaryData::OpenSansRegular_ttfSize);

String tfaceName = tface->getName();
// DOES NOT WORK                     Font OpenSans(tfaceName,48,0);
// WORKS WITH SMALL DEFAULT SIZE     Font OpenSans(tface);

As stated in the comments, if I try to define a size for the font it does not work and uses a default font. If I only use the typeface name it oviously has a wrong size (but the desired font is used).

Can someone tell me why ? ... and how to fix this ....?


Any clue ? anyone ? Please.....


I'm sure it's something very simple... :-8


You realise that you can change the size of a Font after you've created it?


Thank you thank you thank you !!!

I had tried (among a million other things) the setHeight() method but it did not work as I stupidly left another line of code overwrite it so I thought it was a bad track...

But since you confirmed it was the way to go I tried again and of course it works...

Thanx again.