createSystemTypefaceFor with bold style fonts

I really like that new feature. I was able to load different "normal" fonts like "impact" without any issues, but it seems that it does not work with bold fonts like "arial bold" or "verdana bold". I do following:

typeface = Typeface::createSystemTypefaceFor(TalResources::verdanab_ttf, TalResources::verdanab_ttfSize);
Font f(this->typeface);

I also tried to set the bold style flag and the font height, but the font renderer always takes a standard font for that fonts. 

Any help is welcome. Thanks.


verdanab_png ??

...verdanab_png sounds like an image. I just don't know how to use the binary builder with different file extensions. It's a renamed ttf file. I changed it in the code block.

I made some more tests and i can load all types of fonts expect of the bold fonts that are in a font group like "arial bold" and "verdana bold". Can you reproduce this?


Edit: It seems that it loads the bold typefaces, but the final output looks plain.

Search for TTFNameExtractor and have a read of my comment above it - that's probably related to the problem.

I'm afraid I can't spare the many hours this could take to investigate/fix right now, but keep me posted if you have a look in there.

I tried to find the issue, but the font loads ok. The font name is "Verdana Bold". The style is "0" when loaded from the binary ttf data.

The font name is "Verdana" and the style is "Bold" if its loaded from the windows fonts as default sans serife font.

I do not understand the whole font architectur. I even do not know if the font or the typeface was first :) it's simple to reproduce this if you have some time. Just load a "Arial Bold" or "Verdana Bold" font with the ttf loader. Maybe i do something wrong, but i think there is something wrong with the loader. Maybe the Font Style is wrong.

Yes, like I said, it's probably related to that TTFNameExtractor stuff. There's no way I'm going to write an full-blown TTF parser to extract the name from every possible kind of font-file, so there will be ones that may not get parsed correctly.

But also, bear in mind that like my comment explains, on Windows the only way to load a font from memory is to load it and then request the font by name - if the name is slightly wrong, or if it clashes with a system font with the same name, all bets are off. This is a really stupid piece of API design, but should work fine for the unusual kinds of font that you'd normally want to embed, since they'll generally have unusual names, and you could even hard-code the name into your code if necessary. There's really no sense in using it for Verdana or Arial because every machine in the world already has that, and the memory font will be clashing with names of the ones already installed.

Thanks for the infos. It works perfectly for special fonts. I thought it's super save to embed even verdana and arial - i'm happy to hear that this isnt necessary. It works for me this way :-)