I have an application where I user need to modify style (font, size, bold, back and fore colors,...) How can I load the initial style in the FontPanel and get the new attributes after user validation?
I tried a lot of different things but without any success.
Thanks
Use the setPanelFont:isMultiple:
to set the initially selected font.
Use [NSFontManager sharedFontManager] setSelectedAttributes:isMultiple:
to change the initially colors; the dictionary keys are NSForegroundColorAttributeName
and @"NSDocumentBackgroundColor"
for the colors and NSUnderlineStyleAttributeName
and NSStrikethroughStyleAttributeName
for the styles.
When the font changes the changeFont:
method of the delegate instance will be called.
Ditto styles: changeAttributes:
method.
And text & doc colors: setColor:forAttribute:
method.
To get the new attributes in the changeAttributes method:
NSDictionary * newAttributes = [sender convertAttributes:@{}];