• 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
NSFont system help or documentation needed
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSFont system help or documentation needed


  • Subject: NSFont system help or documentation needed
  • From: Robert Clair <email@hidden>
  • Date: Tue, 16 Dec 2003 13:31:37 -0500

Is there any better source of documentation or information on NSFont, NSFontManager, NSFontPanel, etc. ? A lot of this is non-obvious and badly/un documented.

Problem N:

When you use the system font panel and choose a font with an odd encoding
(Zapf Dingbats or some Asian font) and then start typing, the font immediately switches back to Lucida Grande or some such thing.

Is there any way to tell this has happened ? There doesn't seem to be any kind of notification or issuing of changeFont: . (I have my own action routine registered for NSFontManager: it is grabbed by one of my routines at the top of the responder chain which posts a custom fontChanged notification for my own use and then sends changeFont: out to the responder chain. I have it logged so I can tell what is going on.)

Is there anyway to tell programmatically which fonts will cause this ? I'd like to filter them out.


Problem N-1:

I have a popup for font families, I wanted one for Typeface. Each font has three names -
[myFont fontName] which gives something like "TimesRoman", [myFont family] which gives "Times" and [myFont displayName] which gives "Times Regular". There is no reasonable way to parse the fontName's - some have the face separated by a "-", some by space, some just by caps. [NSFontManager availableFonts] returns an array of fontNames. But I couldn't find a way to go from fontName to displayName. The only way I could figure out to do this was, for every fontName returned by availableFonts -

1) create an instance of the font using [NS fontWithName:size:]
2) get the family name and compare it with the currently selected family
3) strip the family name off of the display name and add it to the popup
4) keep an array of the fontNames corresponding to the items in the Typeface popup to
actually select the font ( using the displayName to get the font does not work reliably -
it works most of the time but fails miserably for some fonts, even if you remember to strip out "Regular".)

This works and is fast enough to go in a dialog box validation routine, but still it feels like a kludge. There ought to be a better way.

I understand some of why this is designed this way, the difficulties of dealing with multiple selection, etc, but a lot of this seems overly byzantine. Why should you have to resort to private hackery to get the font currently shown by the font panel ??

.....Bob
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: NSFont system help or documentation needed
      • From: Dustin Voss <email@hidden>
  • Prev by Date: Modifier keys and panther...
  • Next by Date: Re: selected table row color ala itunes ? [2]
  • Previous by thread: Fwd: Modifier keys and panther...
  • Next by thread: Re: NSFont system help or documentation needed
  • Index(es):
    • Date
    • Thread