Re: Why is NSFontManager lying to me ?
Re: Why is NSFontManager lying to me ?
- Subject: Re: Why is NSFontManager lying to me ?
- From: Scott Thompson <email@hidden>
- Date: Mon, 27 Feb 2006 08:54:03 -0600
On Feb 27, 2006, at 7:10 AM, Robert Clair wrote:
A friend was testing an app for me and it crashed on his system at
start-up. The immediate problem was a piece of code like this:
</code sample snipped>
The problem is that font came back nil at some point and
[NSDictionary dictionaryWithObject: forKey] spit up and crashed
because it didn't like the nil.
OK - My fault for not checking for nil and easy to fix. But the
larger issue is why is NSFontManger telling me a font is available
when NSFont refuses to create an instance ?
Two thoughts come to mind... neither of which may be accurate.
The first thought I had was that perhaps the font was registered by
some application but the font is not available in "global scope".
When an application registers a font, it can keep that font
information private. It would seem that, were that the case,
"availableFonts" shouldn't return that font to you because it's not
really available to you... but that could be a bug.
The second thought was that the font is damaged. Maybe there is
enough information for the font to be registered with the system, but
then when the system actually tries to instantiate the font, it
cannot do so because the font information is corrupted somehow.
On further investigation the guilty fonts are:
GloucesterMT-ExtraCondensed
and
AbadiMT-CondensedExtraBold
Looking in the usual font locations there are no font files of
these names nor does
find / -name "*GloucesterMT-ExtraCondensed*" -print > findResults,
etc show up any font files. A good reason not to create an instance.
The first thing that strikes me about your attempt to track down the
fonts is the fact that the font names and the file names very rarely
match. A particular font file on disk may actually contain several
fonts. For example, "Times.ttf" would typically contain "Times-
Roman", "Times-Bold", "Times-Italic" and "Times-BoldItalic". You
might try looking for files named just "*Glouchester*" or "*Adabi*"
and see if those files show up.
See if the fonts show up in the "All Fonts" list of /Applications/
Font Book. If they do, then you should be able to get info on the
font (cmd-I) and read the file it came from off of the "location" field.
A Spotlight search showed that those names appear in:
~Library/Application Support/Adobe/TypeSpt/AdobeFnt06.lst.
I don't know about AdobeFnt.lst files, but a little Googling shows
they seem to be the cause of lots of trouble. The friend is a math
type not a graphic arts type and says he didn't consciously install
those fonts.
That increases my suspicion that some application may be registering
a font that does not exist in fact on the system. If there were any
Adobe applications running before you ran your test app, You might
try your test again, but reboot the machine and don't start those
other applications first and see if you still get the problem. It
also might be interesting to write a small app that runs through the
font list and prints out a list of fonts with this behavior and see
if there are others in the Adobe font list.
Scott
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden