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 (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to