0

I am trying to find the narrowest font, that I can use in iOS. Screen space is limited and I want something I can use in 11 pts size still keeping 8 characters on the line. Is the Apple Watch font available for iPhone?

MMiroslav
  • 1,672
  • 20
  • 32
KexAri
  • 3,867
  • 6
  • 40
  • 80

3 Answers3

2

I made a script to check:

import UIKit

let allFontFamilies = UIFont.familyNames() as [String]
var allFontNames: [String] = []
for family in allFontFamilies {
    allFontNames += UIFont.fontNamesForFamilyName(family) as [String]
}

let string = "the quick brown fox jumped over the lazy dog"
var minimum: (width: CGFloat, font: String) = (width: CGFloat.max, font: "")
for fontName in allFontNames {
    let label = UILabel()
    label.text = string
    label.font = UIFont(name: fontName, size: 11)
    let size = label.sizeThatFits(CGSize(width: CGFloat.max, height: CGFloat.max))
    if size.width < minimum.width {
        minimum = (width: size.width, font: fontName)
    }
}

minimum.width
minimum.font

Which outputs:

PartyLetPlain

Not sure about text spacing for a specific word., but you could replace the string with your own and drop this in a playground to see.

Logan
  • 52,262
  • 20
  • 99
  • 128
0

Either try IOS Fonts

or

Check the official site. There is a list included with fonts, that can be downloaded from apps if necessary.

TheCoolFrood
  • 367
  • 2
  • 15
0

Watchkit's font SanFrancisco not available in the system fonts but you can import to your project.

In order to do that

  1. You need to download font and other sources from here
  2. Than import TTF files to your project add Fonts provided by application parameter with font names to your plist file this answer could has better explanation.
Community
  • 1
  • 1
mert
  • 1,090
  • 13
  • 26