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); myLabel.setFont(OpenSans);
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 ....?