-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathFontToolkit+Font.swift
81 lines (65 loc) · 3.85 KB
/
FontToolkit+Font.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
//
// FontToolkit+Font.swift
//
// Made with ❤️ by Novum
//
// Copyright © Telefonica. All rights reserved.
//
import Foundation
import SwiftUI
// MARK: Font
public extension Font {
static func textPreset1(weight: FontStyle.TextPreset1Weight, constrainedToPreferredSize: UIContentSizeCategory? = nil) -> Font {
FontStyle.textPreset1.preferredFont(weight: weight.value.systemWeight, constrainedToPreferredSize: constrainedToPreferredSize)
}
static func textPreset2(weight: FontStyle.TextPreset2Weight, constrainedToPreferredSize: UIContentSizeCategory? = nil) -> Font {
FontStyle.textPreset2.preferredFont(weight: weight.value.systemWeight, constrainedToPreferredSize: constrainedToPreferredSize)
}
static func textPreset3(weight: FontStyle.TextPreset3Weight, constrainedToPreferredSize: UIContentSizeCategory? = nil) -> Font {
FontStyle.textPreset3.preferredFont(weight: weight.value.systemWeight, constrainedToPreferredSize: constrainedToPreferredSize)
}
static func textPreset4(weight: FontStyle.TextPreset4Weight, constrainedToPreferredSize: UIContentSizeCategory? = nil) -> Font {
FontStyle.textPreset4.preferredFont(weight: weight.value.systemWeight, constrainedToPreferredSize: constrainedToPreferredSize)
}
static func textPreset5(constrainedToPreferredSize: UIContentSizeCategory? = nil) -> Font {
FontStyle.textPreset5.preferredFont(weight: MisticaConfig.currentFontWeights.text5.systemWeight, constrainedToPreferredSize: constrainedToPreferredSize)
}
static func textPreset6(constrainedToPreferredSize: UIContentSizeCategory? = nil) -> Font {
FontStyle.textPreset6.preferredFont(weight: MisticaConfig.currentFontWeights.text6.systemWeight, constrainedToPreferredSize: constrainedToPreferredSize)
}
static func textPreset7(constrainedToPreferredSize: UIContentSizeCategory? = nil) -> Font {
FontStyle.textPreset7.preferredFont(weight: MisticaConfig.currentFontWeights.text7.systemWeight, constrainedToPreferredSize: constrainedToPreferredSize)
}
static func textPreset8(constrainedToPreferredSize: UIContentSizeCategory? = nil) -> Font {
FontStyle.textPreset8.preferredFont(weight: MisticaConfig.currentFontWeights.text8.systemWeight, constrainedToPreferredSize: constrainedToPreferredSize)
}
static func textPreset9(constrainedToPreferredSize: UIContentSizeCategory? = nil) -> Font {
FontStyle.textPreset9.preferredFont(weight: MisticaConfig.currentFontWeights.text9.systemWeight, constrainedToPreferredSize: constrainedToPreferredSize)
}
static func textPreset10(constrainedToPreferredSize: UIContentSizeCategory? = nil) -> Font {
FontStyle.textPreset10.preferredFont(weight: MisticaConfig.currentFontWeights.text10.systemWeight, constrainedToPreferredSize: constrainedToPreferredSize)
}
static func textPresetTabsLabel(constrainedToPreferredSize: UIContentSizeCategory? = nil) -> Font {
FontStyle.textPresetTabsLabel.preferredFont(
weight: MisticaConfig.currentFontWeights.tabsLabel.systemWeight,
constrainedToPreferredSize: constrainedToPreferredSize
)
}
static func textTitle3(constrainedToPreferredSize: UIContentSizeCategory? = nil) -> Font {
FontStyle.textTitle3.preferredFont(
weight: MisticaConfig.currentFontWeights.title3.systemWeight,
constrainedToPreferredSize: constrainedToPreferredSize
)
}
static func preferredFont(for fontStyle: FontStyle, weight: Font.Weight, constrainedToPreferredSize constrainedPreferredSize: UIContentSizeCategory) -> Font {
fontStyle.preferredFont(weight: weight, constrainedToPreferredSize: constrainedPreferredSize)
}
static var isDynamicTypeEnabled: Bool {
get {
_isDynamicTypeEnabled
}
set {
_isDynamicTypeEnabled = newValue
}
}
}