Skip to content

Commit 5612f65

Browse files
committed
Feat: CustomFontStyle 추가
- 디자인 시스템에 정의되어 있는 폰트 외에도 정의해서 사용할 수 있도록 custom 케이스 추가
1 parent b2ebbf1 commit 5612f65

2 files changed

Lines changed: 19 additions & 0 deletions

File tree

Projects/Presentation/Sources/Common/DesignSystem/Font/BitnagilFont.swift

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff 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)

Projects/Presentation/Sources/Common/DesignSystem/Font/FontStyle.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff 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
}

0 commit comments

Comments
 (0)