I need a font for swift sprite kit, iOS. this font is for commercial purposes and im trying to have a kind of arcade font. I would want to create my own font, or to get a public font which i can use for commercial purposes, and how do I install this font, how do I implement it on swift. Thank you.
-
I know the question has been answered, but I would like to share this resource with you. Make sure the font you use is permitted for commercial use in the license: dafont.com– TheCodeComposerCommented Aug 18, 2015 at 3:27
-
Possible duplicate of Swift Custom Fonts Xcode 7– ٴٴٴCommented Nov 18, 2018 at 14:55
3 Answers
Fist make sure that your font is .ttf or .otf format
- Import your font into the project
- Add new key "Fonts provided by application" on application's info.plist file and add your font names Now you can use custom fonts with interface builder or programatically
yourLabel.font = UIFont.init(name: YourFont, size: size)
-
Can you add instructions on how to programmatically set the newly added font.– 3366784Commented May 22, 2017 at 7:46
-
- First of all you need to drag the font into the project.
- After that you need to select the font and select the target Membership checkmark for your app as seen in the picture.
After that you go to your Info.plist and add the Name of the font in "Fonts Provided By Application"
Now you can finally use the font als you would use every other font. If it doesn't work as ir should you can find out the name Xcode gave the font with
for name in UIFont.familyNames() { println(name) if let nameString = name as? String { println(UIFont.fontNamesForFamilyName(nameString)) } }
UPDATE
The Font is called Fipps-Regular and 100% free to use Download here
-
Thank you the font is awesome but the explanation on how to use it is not– reojasedCommented Aug 18, 2015 at 11:14
-
i would like to add this code if you know your font family name (which you can see in the fontPicker in the IterfaceBuilder) use this to apply the font programatically
func apply_font(FontFamilyName:String)
{
label.font = UIFont(name: UIFont.fontNames(forFamilyName:
**FontFamilyName**)[0], size: 15)
}