added helper for TextStyle extension
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
e3b335e6a6
commit
29f43b7861
@ -29,3 +29,17 @@ extension Styler.Font {
|
||||
}
|
||||
}
|
||||
|
||||
extension VDS.Font {
|
||||
internal static func from(fontName: String) -> Self? {
|
||||
Self.allCases.filter({$0.fontName == fontName }).first
|
||||
}
|
||||
}
|
||||
|
||||
extension VDS.TextStyle {
|
||||
internal static func style(from font: VDS.Font, pointSize: CGFloat) -> TextStyle? {
|
||||
guard let first = allCases.filter({$0.fontFace == font && $0.pointSize == pointSize}).first else {
|
||||
return TextStyle(rawValue: "Custom-TextStyle", fontFace: font, pointSize: pointSize)
|
||||
}
|
||||
return first
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user