My application has to use some custom font so I start to add the font by copy it to the application folder and create the "Fonts provided by application" in info.plist, everything work fine in my Mac but when I start to debug in my phone the font turn back to the system font, How can I fix this?
-
What is your current code/setup?user3151675– user31516752018-02-01 14:04:22 +00:00Commented Feb 1, 2018 at 14:04
-
I didn't setup any code in my application, I just drank and drop the font file in to Xcode and create the "Fonts provided by application" in info.plist and change the font to custom and font face to my font, It work in my Mac, but it didn't on my phoneSiratee K.– Siratee K.2018-02-01 14:06:16 +00:00Commented Feb 1, 2018 at 14:06
-
Did you set the Target Membership of your font file?user3151675– user31516752018-02-01 14:06:57 +00:00Commented Feb 1, 2018 at 14:06
-
Yes I already did thatSiratee K.– Siratee K.2018-02-01 14:10:57 +00:00Commented Feb 1, 2018 at 14:10
-
Im glad I could help you. If you have any more issues just ask me.E. Huckabee– E. Huckabee2018-02-01 15:07:08 +00:00Commented Feb 1, 2018 at 15:07
1 Answer
This is pretty easy to do, actually. Firstly, you need to make sure that the font file is in your app file hierarchy:
you can see mine here "small_pixel.ttf"
Secondly you need to make sure that the info.plist file has the EXACT file name as your custom font:
you can see that here.
Thirdly, you need to make sure that the font is included in bundle resources you can navigate to it by going:
to add it to bundle resources simply drag and drop the file into the hierarchy.
Finally you can see all of your fonts by doing...
for family in UIFont.familyNames {
print("Family: \(family)")
for name in UIFont.fontNames(forFamilyName: family) {
print(" - \(name)")
}
}
...in some function that gets called when you launch your app. Simply scroll down through the Debug area until you find your font.
(ps. this is from my first really trashy game. If you want to check it out, search "Crappy Duck" on the AppStore)


