Comments
This commit is contained in:
parent
c2c6fdd524
commit
c284614c29
@ -256,6 +256,7 @@ open class Styler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@objc public extension MFStyler {
|
@objc public extension MFStyler {
|
||||||
|
/// Creates the appropriate VZW font for a given size and weight.
|
||||||
@objc static func getFontFor(size: CGFloat, isBold: Bool) -> UIFont {
|
@objc static func getFontFor(size: CGFloat, isBold: Bool) -> UIFont {
|
||||||
if isBold {
|
if isBold {
|
||||||
return size >= 13 ? MFFonts.mfFontDSBold(size) : MFFonts.mfFontTXBold(size)
|
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? {
|
@objc static func getFontFor(styleString: String, genericScaling: Bool = true) -> UIFont? {
|
||||||
return Styler.Font(rawValue: styleString)?.getFont(genericScaling)
|
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? {
|
@objc static func getFontFor(styleString: String, scaleValue: CGFloat) -> UIFont? {
|
||||||
guard let font = Styler.Font(rawValue: styleString),
|
guard let font = Styler.Font(rawValue: styleString),
|
||||||
let size = Styler.Font(rawValue: styleString)?.pointSize(),
|
let size = Styler.Font(rawValue: styleString)?.pointSize(),
|
||||||
@ -280,6 +283,7 @@ open class Styler {
|
|||||||
Styler.Font(rawValue: styleString)?.styleLabel(label, genericScaling: genericScaling)
|
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 {
|
@objc static func getAttributedString(for string: String, styleString: String, genericScaling: Bool = true) -> NSAttributedString {
|
||||||
let font = Styler.Font(rawValue: styleString)!
|
let font = Styler.Font(rawValue: styleString)!
|
||||||
return styleGetAttributedString(string, font: font.getFont(genericScaling), color: font.color())
|
return styleGetAttributedString(string, font: font.getFont(genericScaling), color: font.color())
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user