Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Why is NSFontManager lying to me ?



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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.