문제

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];

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top