This commit is contained in:
Scott Pfeil 2022-06-20 12:55:55 -04:00
parent c2c6fdd524
commit c284614c29

View File

@ -256,6 +256,7 @@ open class Styler {
}
@objc public extension MFStyler {
/// Creates the appropriate VZW font for a given size and weight.
@objc static func getFontFor(size: CGFloat, isBold: Bool) -> UIFont {
if isBold {
return size >= 13 ? MFFonts.mfFontDSBold(size) : MFFonts.mfFontTXBold(size)
@ -264,10 +265,12 @@ open class Styler {
}
}
/// Creates the appropriate VZW font for a VDS style.
@objc static func getFontFor(styleString: String, genericScaling: Bool = true) -> UIFont? {
return Styler.Font(rawValue: styleString)?.getFont(genericScaling)
}
/// Creates the appropriate VZW font for a VDS style, scaling based on the scaleValue threshold passed in.
@objc static func getFontFor(styleString: String, scaleValue: CGFloat) -> UIFont? {
guard let font = Styler.Font(rawValue: styleString),
let size = Styler.Font(rawValue: styleString)?.pointSize(),
@ -280,6 +283,7 @@ open class Styler {
Styler.Font(rawValue: styleString)?.styleLabel(label, genericScaling: genericScaling)
}
/// Returns an attributed string with the passed in VDS Style.
@objc static func getAttributedString(for string: String, styleString: String, genericScaling: Bool = true) -> NSAttributedString {
let font = Styler.Font(rawValue: styleString)!
return styleGetAttributedString(string, font: font.getFont(genericScaling), color: font.color())