forked from OfficeDev/ui-fabric-ios
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Fonts.swift
60 lines (56 loc) · 1.83 KB
/
Fonts.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
//
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
//
@objcMembers
public final class MSFonts: NSObject {
/// Semibold 28pt
public static var title1: UIFont { return UIFont.preferredFont(forTextStyle: .title1).withWeight(.semibold) }
/// Semibold 22pt
public static var title2: UIFont { return UIFont.preferredFont(forTextStyle: .title2).withWeight(.semibold) }
/// Semibold 17pt
public static var headline: UIFont { return .preferredFont(forTextStyle: .headline) }
/// Regular 17pt
public static var body: UIFont { return .preferredFont(forTextStyle: .body) }
/// Regular 15pt
public static var subhead: UIFont { return .preferredFont(forTextStyle: .subheadline) }
/// Regular 13pt
public static var footnote: UIFont { return .preferredFont(forTextStyle: .footnote) }
/// Regular 12pt
public static var caption1: UIFont { return .preferredFont(forTextStyle: .caption1) }
/// Regular 11pt
public static var caption2: UIFont { return .preferredFont(forTextStyle: .caption2) }
private override init() {
super.init()
}
}
@objc public enum MSTextStyle: Int, CaseIterable {
case title1
case title2
case headline
case body
case subhead
case footnote
case caption1
case caption2
public var font: UIFont {
switch self {
case .title1:
return MSFonts.title1
case .title2:
return MSFonts.title2
case .headline:
return MSFonts.headline
case .body:
return MSFonts.body
case .subhead:
return MSFonts.subhead
case .footnote:
return MSFonts.footnote
case .caption1:
return MSFonts.caption1
case .caption2:
return MSFonts.caption2
}
}
}