• 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: Graham Cox <email@hidden>
  • Date: Sat, 14 Nov 2015 09:37:33 +1100

Thanks- main() is the only place that works. I tried run() and even init() of the application, but even they were too late.

It does prove my working theory - that NSTextView is accessing NSFontManager directly rather than using the sender passed to -changeFont:, even though Apple’s docs tell the rest of us to do it that way. It’s a pity, because it means that I now need a ”thick” shim instead of a “thin” one to intercept font changing operations sent to text views (by which I mean I now have to subclass NSFontManager instead of passing a simple object as sender that can intercept the callback to -[<sender> convertFont:]. Bah.

Am I alone in thinking the design of the font changing mechanism is simply horrible? No wonder the Font Panel itself is so horrible, with all of the different text properties and attributes conflated into an indistinct porridge of settings that are hard to separate out. Just look at NSFontAction to see what I mean.


—Graham





> On 12 Nov 2015, at 1:07 PM, Ken Thomases <email@hidden> wrote:
>
> 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>)
 >Re: Customising NSFontManager (From: Ken Thomases <email@hidden>)

  • Prev by Date: Images in NSOutlineView disappear on dataReload
  • Next by Date: how to change the name of my variable in main.storyboard to BrowseAirports? This is what I want to call in the code when I type the code to connect to my web view?
  • Previous by thread: Re: Customising NSFontManager
  • Next by thread: Re: Customising NSFontManager
  • Index(es):
    • Date
    • Thread