Question

I have followed the steps discussed in this related question, but without success.

  1. Added file fontFile.ttf to Xcode Project resources.
  2. Added fontFile.ttf as a string in the UIAppFonts array in Info.plist.
  3. Added actualFontName in the code.
  4. Added file fontFile.ttf to target.

I have checked that I am using the actual font name as recognized by Font Book and Finder info (CMD + i in each). I have also double-checked the spelling and case-sensitivity of the included file name.

The code rendering the label works with other embedded system fonts, but not with the custom TTF. What else could be missing?

Was it helpful?

Solution

Answer: Check that the file is added to the "Copy Bundle Resources" build phase

The problem was that I was adding the file to "Compile Sources" instead of "Copy Bundle Resources".

Thus, step 4 should read as follows:

4. Add file fontFile.ttf to bundle resources of target

To check that the file is in the right place, navigate to the Build Phases tab of the project, scroll down to "Copy Bundle Resources" and verify the file's presence. If not there, simply add it by clicking the corresponding "+" button.

NOTE: This whole situation can be avoided if you select the "Add to target" checkbox when first dragging the file into your project.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top