• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Why is NSFontManager lying to me ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Why is NSFontManager lying to me ?
      • From: Pascal Pochet <email@hidden>
    • Re: Why is NSFontManager lying to me ?
      • From: John Nunez <email@hidden>
    • Re: Why is NSFontManager lying to me ?
      • From: Scott Thompson <email@hidden>
  • Prev by Date: Re: keychain secure note
  • Next by Date: [CORE DATA] multithreading
  • Previous by thread: Re:Objective-C programming
  • Next by thread: Re: Why is NSFontManager lying to me ?
  • Index(es):
    • Date
    • Thread