diff --git a/VDS/Typography/Typography.swift b/VDS/Typography/Typography.swift index 8d815ad3..3759cb26 100644 --- a/VDS/Typography/Typography.swift +++ b/VDS/Typography/Typography.swift @@ -23,13 +23,22 @@ public enum TextPosition: String, CaseIterable { } } -public struct TextStyle: Equatable { +public struct TextStyle: Equatable, RawRepresentable { public let rawValue: String public let pointSize: CGFloat public let lineHeight: CGFloat public let letterSpacing: CGFloat public let fontFace: Fonts + public init?(rawValue: String) { + guard let style = TextStyle.textStyle(for: rawValue) else { return nil } + self.rawValue = style.rawValue + self.pointSize = style.pointSize + self.lineHeight = style.lineHeight + self.letterSpacing = style.letterSpacing + self.fontFace = style.fontFace + } + public init(rawValue: String, fontFace: Fonts, pointSize: CGFloat, lineHeight: CGFloat, letterSpacing: CGFloat) { self.rawValue = rawValue self.fontFace = fontFace