• 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
Re: Customising NSFontManager
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Customising NSFontManager


  • Subject: Re: Customising NSFontManager
  • From: Ken Thomases <email@hidden>
  • Date: Wed, 11 Nov 2015 20:07:20 -0600

On Nov 11, 2015, at 7:51 PM, Graham Cox <email@hidden> wrote:
>
> According to the docs for NSFontManager:
>
>
> + setFontPanelFactory:
> Sets the class used to create the Font panel to the given class.
>
> Discussion
> Invoke this method before accessing the Font panel in any way, such as in the application delegate’s applicationWillFinishLaunching: method.
>
>
> I’m doing exactly this, as the very first line of -applicationWillFinishLaunching, but I get an error that the shared Font Manager instance already exists. Is there an earlier time I can use, or a better way to reliably set the FM factory class?

Probably best to put it in main().

The app delegate is typically instantiated in the MainMenu NIB (or storyboard, I guess).  Therefore, there's no possibility that any method will be invoked on it until that NIB is loaded.  If the NIB contains a placeholder for the shared font manager or anything which uses it (like the Font menu), then you can't get in front of it reliably in methods of the app delegate.  So, you have to make the call before the NIB is loaded.  main() is the easiest place for that.

If that doesn't work, you may need to use a custom subclass of NSApplication and put it in an override of -run, before calling through to super.

Regards,
Ken


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


  • Follow-Ups:
    • Re: Customising NSFontManager
      • From: Graham Cox <email@hidden>
References: 
 >Customising NSFontManager (From: Graham Cox <email@hidden>)

  • Prev by Date: Customising NSFontManager
  • Next by Date: Re: Set editable string into NSTextFieldCell
  • Previous by thread: Customising NSFontManager
  • Next by thread: Re: Customising NSFontManager
  • Index(es):
    • Date
    • Thread