1

I import my fonts in my project

enter image description here

I create a class style.swift

struct Style {


    //fonts
    static var GothamBlackItalic = UIFont(name: "Gotham-BlackItalic.ttf", size: 12)
    static var GothamBold = UIFont(name: "Gotham-Bold.ttf", size: 12)
    static var GothamBoldItalic = UIFont(name: "Gotham-BoldItalic.ttf", size: 12)
    static var GothamBook = UIFont(name: "Gotham-Book.ttf", size: 12)
    static var GothamBookItalic = UIFont(name: "Gotham-BookItalic.ttf", size: 12)
    static var GothamLight = UIFont(name: "Gotham-Light.ttf", size: 12)
    static var GothamLightItalic = UIFont(name: "Gotham-LightItalic.ttf", size: 12)
    static var GothamMedium = UIFont(name: "Gotham-Medium.ttf", size: 4)
    static var GothamMediumItalic = UIFont(name: "Gotham-MediumItalic.ttf", size: 12)
    static var GothamThin = UIFont(name: "Gotham-Thin.ttf", size: 12)
    static var GothamThinItalic = UIFont(name: "Gotham-ThinItalic.ttf", size: 12)
    static var GothamUltra = UIFont(name: "Gotham-Ultra.ttf", size: 12)
    static var GothamUltraItalic = UIFont(name: "Gotham-UltraItalic.ttf", size: 12)
    static var GothamExtraLight = UIFont(name: "Gotham-XLight.ttf", size: 12)
    static var GothamExtraLightItalic = UIFont(name: "Gotham-XLightItalic.ttf", size: 12)

}

In my view controller, i call the font GothamMedium in my Label :

myLabel.font=Style.GothamMedium

The font is correct but the fontsize is not working. Can you tell me how can I change the font size ?

Eric Aya
  • 69,473
  • 35
  • 181
  • 253
Malicia
  • 154
  • 1
  • 14
  • Not working how? What settings on the label? Have you debugged to check the label settings at runtime? – Wain Oct 05 '15 at 11:06

1 Answers1

7

There is difference between font name and font file name, you've mentioned font file name, not font name. Double click the font, it'll open in Font Book, title is the font name now the font should be created as

static var GothamBlackItalic = UIFont(name: "Gotham Black", size: 12)

Font Name

Also add Fonts provided by application in your plist. See this link

Community
  • 1
  • 1
arthankamal
  • 6,341
  • 4
  • 36
  • 51