UIFont
@_spi(FW) extension UIFont
-
自定义全局自动等比例缩放适配句柄,默认nil,开启后如需固定大小调用fixed即可
Declaration
Swift
public static var fw_autoScaleBlock: ((CGFloat) -> CGFloat)?
-
快捷启用全局自动等比例缩放字体,自动设置默认autoScaleBlock
Declaration
Swift
public static var fw_autoScaleFont: Bool { get set }
-
是否启用全局自动像素取整字体,默认false
Declaration
Swift
public static var fw_autoFlatFont: Bool
-
全局自定义字体句柄,优先调用,返回nil时使用系统字体
Declaration
Swift
public static var fw_fontBlock: ((CGFloat, UIFont.Weight) -> UIFont?)?
-
返回系统Thin字体,自动等比例缩放
Declaration
Swift
public static func fw_thinFont(ofSize: CGFloat, autoScale: Bool? = nil) -> UIFont
-
返回系统Light字体,自动等比例缩放
Declaration
Swift
public static func fw_lightFont(ofSize: CGFloat, autoScale: Bool? = nil) -> UIFont
-
返回系统Medium字体,自动等比例缩放
Declaration
Swift
public static func fw_mediumFont(ofSize: CGFloat, autoScale: Bool? = nil) -> UIFont
-
返回系统Semibold字体,自动等比例缩放
Declaration
Swift
public static func fw_semiboldFont(ofSize: CGFloat, autoScale: Bool? = nil) -> UIFont
-
返回系统Bold字体,自动等比例缩放
Declaration
Swift
public static func fw_boldFont(ofSize: CGFloat, autoScale: Bool? = nil) -> UIFont
-
创建指定尺寸和weight的系统字体,自动等比例缩放
Declaration
Swift
public static func fw_font(ofSize size: CGFloat, weight: UIFont.Weight = .regular, autoScale: Bool? = nil) -> UIFont
-
获取指定名称、字重、斜体字体的完整规范名称
Declaration
Swift
public static func fw_fontName(_ name: String, weight: UIFont.Weight, italic: Bool = false) -> String
-
是否是粗体
Declaration
Swift
public var fw_isBold: Bool { get }
-
是否是斜体
Declaration
Swift
public var fw_isItalic: Bool { get }
-
当前字体的粗体字体
Declaration
Swift
public var fw_boldFont: UIFont { get }
-
当前字体的非粗体字体
Declaration
Swift
public var fw_nonBoldFont: UIFont { get }
-
当前字体的斜体字体
Declaration
Swift
public var fw_italicFont: UIFont { get }
-
当前字体的非斜体字体
Declaration
Swift
public var fw_nonItalicFont: UIFont { get }
-
字体空白高度(上下之和)
Declaration
Swift
public var fw_spaceHeight: CGFloat { get }
-
根据字体计算指定倍数行间距的实际行距值(减去空白高度),示例:行间距为0.5倍实际高度
Declaration
Swift
public func fw_lineSpacing(multiplier: CGFloat) -> CGFloat
-
根据字体计算指定倍数行高的实际行高值(减去空白高度),示例:行高为1.5倍实际高度
Declaration
Swift
public func fw_lineHeight(multiplier: CGFloat) -> CGFloat
-
计算指定期望高度下字体的实际行高值,取期望值和行高值的较大值
Declaration
Swift
public func fw_lineHeight(expected: CGFloat) -> CGFloat
-
计算当前字体与指定字体居中对齐的偏移值
Declaration
Swift
public func fw_baselineOffset(_ font: UIFont) -> CGFloat
-
计算当前字体与指定行高居中对齐的偏移值
Declaration
Swift
public func fw_baselineOffset(lineHeight: CGFloat) -> CGFloat