问题
How to add a custom font to storyboard in Mac app development. I went through some blogs and tried by adding font book and develop one NStextfield using this custom font using storyboard. But it is system dependent. I created the DMG and install in another computer it uses the default font. I did it programmatically, but my requirement is through storyboard. Please help me on this
回答1:
I spent a bit of time trying to figure this out and found the solution in this related question.
In your info.plist file, which you made available to me at
It turns out you can safely get rid of the "Fonts Provided By Application" section (it's an iOS specific key and is ignored by macOS).
And for "Application Fonts resource path", make certain you have the font going into a "Fonts" folder (or some subfolder within your application bundle's Resources folder).
Lastly, do a custom copy build phase like this:
This is copying the font into the "Fonts" subfolder specified in your "Application Fonts resource path". You don't want the font in your Resources folder, but you do want it in a subfolder underneath Resources.
来源:https://stackoverflow.com/questions/44786741/custom-fonts-in-mac-sdk-using-storyboard