views:

241

answers:

3

I'm having trouble with some ttf fonts not working in GDI+. I cannot seem to find any differences between some of the working and non working fonts. Some can be read and rendered without a problem. For some fonts GDI+ just reports the file as missing (which it is not). Something must be wrong with the format but I cannot for the life of me find out what it is... any pointers?

+1  A: 

The thing about fonts is that they are the one of the least understood aspects of programming. I had a similar problem (see Corrupt TrueType font detection). Have a go through my question -- it may help.

Can you post some more details about your problem such as the API you are using, the fonts that work, the ones that don't etc?

dirkgently
I cannot seem to get any information of what the error actually is - it seems deeply embedded in GDI+. It occurs however when calling PrivateFontCollection.AddFontFile(string path). Unfortunately I cannot post the fonts that do not work since our client owns them. examples of fonts that do work are all the standard ttf:s delivered with Windows.
Johan Öbrink
I am assuming this is an outline font, do validate. If it is, then you may actually have to read up on the TTF specification and have a go at the font file(s) in question (either through MS Font Validator or a custom parser) to figure this out. Note that you may also be bitten by an implementation bug (i.e. a deviation from what the TTF spec says -- which is what had bitten me).
dirkgently
The odds are -- your client's fonts are corrupt. Do talk to your clients as well. Also, what font related tools do you have in your coterie?
dirkgently
It is my firm belief that my client's font is corrupt. My main problem is that they look to me for explanations on WHY and HOW it is broken :(. My experience with fonts is as bad as my tool set for fonts. That is why I just love the Font Validator. It allows me to send a list of errors to my client and MY part of the problem is out of the way :)
Johan Öbrink
+2  A: 

Microsoft has a decent tool called the Microsoft Font Validator which is a free download.

Robert Paulson
I still have absolutely no clue what the errors actually mean, but at least I have a list of them... a LONG list for the fonts that do not work which I can pass on to the font provider. Very useful, thanks!
Johan Öbrink
+2  A: 

GDI+ is picky, it only works with true TrueType fonts and not with OpenType or PostScript fonts, so that support is less than with GDI.

Have a look at this link, it may help you out.

Lucero