Hello guys !
Not sure why it happens, but I have noticed some issues on Windows with the DirectWrite renderer. To make the issue appear, you need to follow these instructions :
- Enable the DirectWrite renderer in the Projucer
- Load a font file (on the hard drive or embedded) using for example the code below
- Draw some text using that new Font (it should work)
- Try again using that Font and a style different from “plain”
- The rendering should display Times New Roman or any other default font instead of the one in the file
[code]const Font loadFontFile(File fileFont)
{
if (fileFont.existsAsFile() == false)
{
return Font();
}
FileInputStream theStream(fileFont);
MemoryBlock theMemoryBlock;
theStream.readIntoMemoryBlock(theMemoryBlock);
Typeface::Ptr ptr = Typeface::createSystemTypefaceFor(theMemoryBlock.getData(), theMemoryBlock.getSize());
if (ptr == nullptr)
return Font();
else
return Font(ptr);
return Font();
}
[/code]
The strange thing about that issue is that you can use the same font if it has been already installed on the system without any problem. And if you disable DirectWrite in the Projucer, everything works as expected too. Same for Mac OS X.
That’s not a very important problem (I just disable DirectWrite all the time in general), but important enough to report I think, in a case of other people seeing a problem with embedded fonts too…