Font

extension Font
  • 全局自定义字体句柄,优先调用

    Declaration

    Swift

    public static var fontBlock: (@Sendable (CGFloat, Font.Weight) -> Font?)? { get set }
  • 返回系统Thin字体,自动等比例缩放

    Declaration

    Swift

    public static func thinFont(size: CGFloat, autoScale: Bool? = nil) -> Font
  • 返回系统Light字体,自动等比例缩放

    Declaration

    Swift

    public static func lightFont(size: CGFloat, autoScale: Bool? = nil) -> Font
  • 返回系统Medium字体,自动等比例缩放

    Declaration

    Swift

    public static func mediumFont(size: CGFloat, autoScale: Bool? = nil) -> Font
  • 返回系统Semibold字体,自动等比例缩放

    Declaration

    Swift

    public static func semiboldFont(size: CGFloat, autoScale: Bool? = nil) -> Font
  • 返回系统Bold字体,自动等比例缩放

    Declaration

    Swift

    public static func boldFont(size: CGFloat, autoScale: Bool? = nil) -> Font
  • 创建指定尺寸和weight的系统字体,自动等比例缩放

    Declaration

    Swift

    public static func font(size: CGFloat, weight: Font.Weight = .regular, autoScale: Bool? = nil) -> Font
  • 创建指定尺寸和weight的不缩放系统字体

    Declaration

    Swift

    public static func nonScaleFont(size: CGFloat, weight: Font.Weight = .regular) -> Font
  • 获取指定名称、字重、斜体字体的完整规范名称

    Declaration

    Swift

    public static func fontName(_ name: String, weight: Font.Weight, italic: Bool = false) -> String