18

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.

2
  • 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 Commented Aug 18, 2015 at 3:27
  • Possible duplicate of Swift Custom Fonts Xcode 7
    – ٴٴٴ
    Commented Nov 18, 2018 at 14:55

3 Answers 3

43

Fist make sure that your font is .ttf or .otf format

  1. Import your font into the project
  2. 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

enter image description here

yourLabel.font = UIFont.init(name: YourFont, size: size)
2
  • Can you add instructions on how to programmatically set the newly added font.
    – 3366784
    Commented May 22, 2017 at 7:46
  • @3366784, I have updated it for programmatically.
    – Hemang
    Commented Aug 22, 2017 at 10:54
17
  1. First of all you need to drag the font into the project.
  2. After that you need to select the font and select the target Membership checkmark for your app as seen in the picture.

Xcode window with selected target membership for the custom font

  1. After that you go to your Info.plist and add the Name of the font in "Fonts Provided By Application"

  2. 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

2
  • Thank you the font is awesome but the explanation on how to use it is not
    – reojased
    Commented Aug 18, 2015 at 11:14
  • I get it :D no problem Commented Aug 18, 2015 at 11:37
2

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)
}

Not the answer you're looking for? Browse other questions tagged or ask your own question.