Why is NSFontManager lying to me ?
Why is NSFontManager lying to me ?
- Subject: Why is NSFontManager lying to me ?
- From: Robert Clair <email@hidden>
- Date: Mon, 27 Feb 2006 08:10:03 -0500
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:
NSArray* fontList = [[NSFontManager sharedFontManager]
availableFonts];
int fontCount = [fontList count];
for ( j=0; j < fontCount; j++ )
{
NSFont* font =
[NSFont fontWithName: [fontList objectAtIndex: j]
size: 18.0];
NSDictionary* fontStringAttributes =
[NSDictionary dictionaryWithObject: font
forKey: NSFontAttributeName];
...
}
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 ?
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.
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.
Bob Clair
_______________________________________________
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