garethdn
garethdn

Reputation: 12373

Using a custom font in Xcode

I'm trying to use a custom font (Sassoon Infant) in Xcode. Despite looking at the numerous posts here on this issue, i haven't been able to resolve the problem.

These are the steps i have taken so far.

  1. Added font to resources
  2. Added font to Font Book
  3. Added SassoonInfantCom-Regular.ttf to Fonts Provided by Application
  4. Tried using fontWithName:@"Sassoon Infant Com", the name in Font Book
  5. Also tried just @"Sassoon"

The font name is not showing up in IB either under the dropdown font menu. The above seems to work for most people but i can't get it working. Anyone have any ideas?

enter image description here

Upvotes: 2

Views: 856

Answers (4)

Felipe Ferri
Felipe Ferri

Reputation: 3588

Also make sure you are editing the correct plist file for the "Fonts provided by application property"! I spent two days trying everything to make some custom fonts work. Then I realised I was editing the APPTest-info.plist (which is in the resources folder of the Tests folder in XCODE) instead of editing the APP-info.plist file!

In my defence, both files are really close to each other in the files navigator in Xcode... ;-)

Upvotes: 1

Alvar
Alvar

Reputation: 31

Remove the extension .otf / .ttf from the file and the plist.

Upvotes: 2

Matthias Bauch
Matthias Bauch

Reputation: 90117

  1. Make sure that the font is added to your target. Select the font and check the target membership in the left Xcode sidebar.

  2. Make sure that you got the correct font name. Open the font in "Font Book" and see its name.

Upvotes: 0

Popeye
Popeye

Reputation: 12113

I just added it into the bundle and did this

myLabel.font = [UIFont fontWithName:@"MyCustomFont" size:19];

MyCustomFont being a .ttf file.

Hope this helps.

Upvotes: 0

Related Questions