The documentation for [NSFontManager modifyFont:] doesn't make sense to me. It 
says:



When a responder replies by providing a font to convert in a convertFont: 
message, the receiver converts the font in the manner specified by sender. The 
conversion is determined by sending a tag message to sender and invoking a 
corresponding method:

Sender’s Tag                            Method Used
NSNoFontChangeAction            None; the font is returned unchanged.
NSViaPanelFontAction            The Font panel’s panelConvertFont:.
NSAddTraitFontAction            convertFont:toHaveTrait:.
NSRemoveTraitFontAction convertFont:toNotHaveTrait:.
NSSizeUpFontAction                      convertFont:toSize:.
NSSizeDownFontAction            convertFont:toSize:.
NSHeavierFontAction                     convertWeight:ofFont:.
NSLighterFontAction                     convertWeight:ofFont:.



Consider the case of wanting toggle the "bold" trait of a font. I set the 
sender's tag to NSAddTraitFontAction, but how do I specify the bold trait, 
rather than any other trait, e.g. italic? The tag of the sender doesn't have 
enough information to set the traits mask and there is no other place this 
information could be supplied that I can see.

What I'm trying to do is to add a toolbar button that can toggle the traits of 
a font, so it has segments for bold, italic, etc. If I make the button invoke 
[NSFontManager addFontTrait:], then I can turn ON bold, but I can't turn it 
off. In fact, I'm puzzled as to how the standard "Bold" text menu item works, 
because it too simply calls addFontTrait: (according to the action set in IB) 
and has a tag indicating bold. How then does it REMOVE the bold trait? Is the 
Font Manager manipulating the action of the menu item when it validates it? 
Would make sense but I can find no documentation to that effect.

How can I achieve my aim?

--Graham





_______________________________________________

Cocoa-dev mailing list ([email protected])

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 [email protected]

Reply via email to