简体   繁体   中英

How can I get NSFontManager selected font?

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.

NSString *selectedFontName = [[[NSFontManager sharedFontManager] selectedFont] displayName];

(取决于您的预期用途,您可能要使用fontName而不是displayName 。)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM