How can I get NSFontManager selected font?

2.1k Views Asked by At

I can't get selected font in NSFontManager. What I need:

1) I need to get selected font title, size, color?

I am calling NSFontManager with button like this:

[[NSFontManager sharedFontManager] orderFrontFontPanel:self];

It's opening but I don't know how to get selected font. As string for example: Verdana.

I have read apple's docs but I can't understand how to get what font is selected. I'm not changing or converting any fonts. I just need to get what font was selected.

1

There are 1 best solutions below

3
omz On BEST ANSWER
NSString *selectedFontName = [[[NSFontManager sharedFontManager] selectedFont] displayName];

(depending on your intended use, you may want to use fontName instead of displayName.)