Jio
Jio

Reputation: 1146

Custom fonts in Mac sdk using storyboard

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

Upvotes: 1

Views: 514

Answers (1)

Michael Dautermann
Michael Dautermann

Reputation: 89509

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

Info.plist file

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:

embed font into application bundle

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.

Upvotes: 4

Related Questions