-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #234 from APP-iOS5th/Feature/LetterWriteDIContainer
Feature/LetterWirteDIContainer
- Loading branch information
Showing
14 changed files
with
239 additions
and
216 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
// | ||
// FontUtility.swift | ||
// Kabinett | ||
// | ||
// Created by Song Kim on 10/24/24. | ||
// | ||
|
||
import Foundation | ||
import UIKit | ||
import SwiftUI | ||
|
||
class FontUtility { | ||
static let screenSize = UIScreen.main.bounds.width | ||
|
||
static func selectedUIFont(font: String, size: CGFloat) -> UIFont { | ||
if font == "SFMONO" { | ||
return UIFont.monospacedSystemFont(ofSize: size, weight: .regular) | ||
} else if font == "SFDisplay" { | ||
return UIFont.systemFont(ofSize: size) | ||
} else { | ||
return UIFont(name: font, size: size) ?? UIFont.systemFont(ofSize: size) | ||
} | ||
} | ||
|
||
static func selectedFont(font: String, size: CGFloat) -> Font { | ||
if font == "SFMONO" { | ||
return .system(size: size, design: .monospaced) | ||
} else if font == "SFDisplay" { | ||
return .system(size: size) | ||
} else { | ||
return .custom(font, size: size) | ||
} | ||
} | ||
|
||
static func fontSize(font: String) -> CGFloat { | ||
if font == "SourceHanSerifK-Regular" { | ||
return screenSize * 0.0333 | ||
} else if font == "NanumMyeongjoOTF" { | ||
return screenSize * 0.0392 | ||
} else if font == "Baskervville-Regular" { | ||
return screenSize * 0.0369 | ||
} else if font == "Pecita" { | ||
return screenSize * 0.037 | ||
} | ||
return (screenSize * 0.0382) | ||
} | ||
|
||
static func lineSpacing(font: String) -> CGFloat { | ||
if font == "Pecita" { | ||
return screenSize * 0.0069 | ||
} else if font == "SFDisplay" { | ||
return screenSize * 0.0013 | ||
} else if font == "goormSansOTF4" { | ||
return screenSize * 0.0013 | ||
} else if font == "Baskervville-Regular" { | ||
return screenSize * 0.002 | ||
} | ||
return 0.0 | ||
} | ||
|
||
static func kerning(font: String) -> CGFloat { | ||
if font == "SFMONO" { | ||
return -(screenSize * 0.0025) | ||
} else if font == "SFDisplay" { | ||
return (screenSize * 0.0005) | ||
} else if font == "goormSansOTF4" { | ||
return (screenSize * 0.001) | ||
} | ||
return 0.0 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.