Learn iOS with Examples, Code Snippets and Video Tutorials

How to Add Custom Fonts to Your Sprite Kit Game

How to Add Custom Fonts to Your Sprite Kit Game

A great looking font is as important as any other graphic in your game. Relying on system apps just won’t cut it! Fortunately adding your own fonts to use in your Xcode project (and ultimately your app) is easy.

  1. Find the font file in your Finder. Easiest way to do this is to open Font Book. Select the font, right click and choose Show in Finder. I’m going to pick one of my favorite author’s fonts: Back Issues (available at Blambot.com)

Finding where a font ttf file is in Finder

2. Drag the font file into the file navigator area of Xcode…

3. When you import the file, be sure you click Add to Targets.

Add to Targets Prompt in Xcode

4. Next find your Info.plist file, and add a new entry.

  1. Hover over an existing entry, or at the top of the plist, and click a + sign.
  2. Xcode will add a new key.
  3. Set it to an Array (it should be by default)
  4. Just begin typing “Font” for the key name, and Fonts Provided by Application should fill itself in.
  5. Unfold the Array and tap another + to add the first array item (Item 0).
  6. For the value, enter the exact filename of the font, including the extension.
  7. Do this for as many custom fonts as you require.

Fonts provided by applications


How to Set the Font on an SKLabelNode

Using Swift / Sprite Kit you’d write this…


How to Set the Font in the Scene Editor

Add a Label to your scene, then set the font in the Attribute Inspector.

Setting SKLabelNode to Custom Font

 

Check out our premium Swift and Sprite Kit Tutorial content!

Visit CartoonSmart.com