NSFont not working properly in macOS Catalina

171 views Asked by At
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?

1

There are 1 answers

0
matt On

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.