49 lines
1.2 KiB
Swift
49 lines
1.2 KiB
Swift
//
|
|
// UIFont+SPAdd.swift
|
|
// MoviaBox
|
|
//
|
|
// Created by 曾觉新 on 2025/4/8.
|
|
//
|
|
|
|
import UIKit
|
|
|
|
extension UIFont {
|
|
|
|
static func regularFontName() -> String {
|
|
return ".AppleSystemUIFont"
|
|
}
|
|
|
|
static func mediumFontName() -> String {
|
|
return ".AppleSystemUIFontMedium"
|
|
}
|
|
|
|
static func boldFontName() -> String {
|
|
return ".AppleSystemUIFontBold"
|
|
}
|
|
|
|
static func fontRegular(ofSize: CGFloat) -> UIFont {
|
|
return .systemFont(ofSize: ofSize, weight: .regular)
|
|
}
|
|
|
|
static func fontMedium(ofSize: CGFloat) -> UIFont {
|
|
return .systemFont(ofSize: ofSize, weight: .medium)
|
|
}
|
|
|
|
static func fontBold(ofSize: CGFloat) -> UIFont {
|
|
return .systemFont(ofSize: ofSize, weight: .bold)
|
|
}
|
|
|
|
static func fontLight(ofSize: CGFloat) -> UIFont {
|
|
return .systemFont(ofSize: ofSize, weight: .light)
|
|
}
|
|
|
|
static func fontWeight(ofSize: CGFloat, weight: CGFloat) -> UIFont {
|
|
return .systemFont(ofSize: ofSize, weight: UIFont.Weight(weight))
|
|
}
|
|
|
|
static func fontInterExtraBold(ofSize: CGFloat) -> UIFont {
|
|
|
|
return .init(name: "Inter-ExtraBold", size: ofSize) ?? fontBold(ofSize: ofSize)
|
|
}
|
|
}
|