File tree Expand file tree Collapse file tree
Projects/Presentation/Sources/Common/DesignSystem/Font Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -16,6 +16,21 @@ struct BitnagilFont {
1616 self . weight = weight
1717 }
1818
19+ init ( fontSize: CGFloat ,
20+ lineHeight: CGFloat ,
21+ letterSpacing: CGFloat = 0 ,
22+ underline: Bool = false ,
23+ weight: FontWeight
24+ ) {
25+ let attributes = FontAttributes (
26+ fontSize: fontSize,
27+ lineHeight: lineHeight,
28+ letterSpacing: letterSpacing,
29+ underline: underline)
30+ self . style = . custom( fontAttribute: attributes)
31+ self . weight = weight
32+ }
33+
1934 var font : UIFont {
2035 guard let font = UIFont ( name: weight. fontName, size: style. fontAttributes. fontSize) else {
2136 return UIFont . systemFont ( ofSize: style. fontAttributes. fontSize)
Original file line number Diff line number Diff line change @@ -25,6 +25,8 @@ enum FontStyle {
2525 case button1
2626 case button2
2727
28+ case custom( fontAttribute: FontAttributes )
29+
2830 var fontAttributes : FontAttributes {
2931 switch self {
3032 case . headline1: FontAttributes ( fontSize: 26 , lineHeight: 38 , letterSpacing: - 0.5 )
@@ -45,6 +47,8 @@ enum FontStyle {
4547
4648 case . button1: FontAttributes ( fontSize: 16 , lineHeight: 24 )
4749 case . button2: FontAttributes ( fontSize: 14 , lineHeight: 20 )
50+
51+ case . custom( let fontAttribute) : fontAttribute
4852 }
4953 }
5054}
You can’t perform that action at this time.
0 commit comments