简体   繁体   中英

NSFont not working properly in macOS Catalina

NSFont *fontRef = [NSFont fontWithName:@".SFNS-Light" size:20];

Above line of code used to work just fine but now it is not working in Catalina. I am getting nil for fontRef. .SFNS-Light stills show as available Fonts. Interesting enough it is still working for

[NSFont fontWithName:@"Arial" size:size];

Anyone experience this issue? What is the best way to resolve it?

Your code was always wrong. It is illegal and unsupported to specify by name a font whose name begins with a dot, like your fontWithName:@".SFNS-Light" . If the goal is to use the system font, ask for the system font.

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