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

Customising NSFontManager


  • Subject: Customising NSFontManager
  • From: Graham Cox <email@hidden>
  • Date: Thu, 12 Nov 2015 12:51:10 +1100
  • X_v_e_cd: f573355e92dcf1bdfab31de1b0ce59d1
  • X_v_r_cd: fa99bd4d8815e0337c36c51eb57d82e2

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?

You might wonder why I need to do this. My app replaces the Font Panel with an interface of its own. In order to hook this interface in correctly for standard text views, I need to partially replace or supplement the standard font conversion mechanism which requires that a text object implements -changeFont:, and in turn invokes -convertFont: on the SENDER of the changeFont: message. Fine, except that NSTextView isn’t doing that - it’s invoking methods on [NSFontManager sharedFontManager] directly instead (at least that is my working theory, so I need to subclass NSFontManager to test that), so passing a different sender to -changeFont: even though it implements the -convertFont: message, means I don’t get the chance to step in and modify the text view’s contents in the normal way - I’m going to have to subclass NSFontManager instead.

I won’t comment on what I think of this architecture.

—Graham





_______________________________________________

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: Ken Thomases <email@hidden>
  • Prev by Date: Re: Stack View Question
  • Next by Date: Re: Customising NSFontManager
  • Previous by thread: Re: Stack View Question
  • Next by thread: Re: Customising NSFontManager
  • Index(es):
    • Date
    • Thread