refactored Font and fixed Styles to match Figma

Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
Matt Bruce 2023-08-04 15:03:36 -05:00
parent ce9e64da0f
commit 3f2fb8897f
2 changed files with 94 additions and 110 deletions

View File

@ -9,23 +9,23 @@ import Foundation
/// Enum that is matched up for the Verizon fonts. /// Enum that is matched up for the Verizon fonts.
public enum Font: String, FontProtocol { public enum Font: String, FontProtocol {
case dsBold case edsBold
case dsRegular case edsRegular
case dsLight case dsLight
case txBold case etxBold
case txRegular case etxRegular
public var fontName: String { public var fontName: String {
switch self { switch self {
case .dsBold: case .edsBold:
return "VerizonNHGeDS-Bold" return "VerizonNHGeDS-Bold"
case .dsRegular: case .edsRegular:
return "VerizonNHGeDS-Regular" return "VerizonNHGeDS-Regular"
case .dsLight: case .dsLight:
return "VerizonNHGDS-Light" return "VerizonNHGDS-Light"
case .txBold: case .etxBold:
return "VerizonNHGeTX-Bold" return "VerizonNHGeTX-Bold"
case .txRegular: case .etxRegular:
return "VerizonNHGeTX-Regular" return "VerizonNHGeTX-Regular"
} }
} }

View File

@ -12,34 +12,38 @@ import VDSTypographyTokens
extension TextStyle { extension TextStyle {
// Static properties for different text styles // Static properties for different text styles
public static let boldFeatureXLarge = TextStyle(rawValue: "boldFeatureXLarge",
fontFace: .edsBold,
pointSize: UIDevice.isIPad ? VDSTypography.fontSizeFeature144 : VDSTypography.fontSizeFeature96,
lineHeight: UIDevice.isIPad ? VDSTypography.lineHeightFeature136 : VDSTypography.lineHeightFeature88,
edgeInsets: .init(bottom: UIDevice.isIPad ? -6: -4))
public static let featureXLarge = TextStyle(rawValue: "featureXLarge", public static let featureXLarge = TextStyle(rawValue: "featureXLarge",
fontFace: .dsLight, fontFace: .dsLight,
pointSize: UIDevice.isIPad ? VDSTypography.fontSizeFeature144 : VDSTypography.fontSizeFeature96, pointSize: UIDevice.isIPad ? VDSTypography.fontSizeFeature144 : VDSTypography.fontSizeFeature96,
lineHeight: UIDevice.isIPad ? VDSTypography.lineHeightFeature136 : VDSTypography.lineHeightFeature88, lineHeight: UIDevice.isIPad ? VDSTypography.lineHeightFeature136 : VDSTypography.lineHeightFeature88,
letterSpacing: VDSTypography.letterSpacingSemiWide, letterSpacing: VDSTypography.letterSpacingSemiWide,
edgeInsets: .init(bottom: UIDevice.isIPad ? -6: -4)) edgeInsets: .init(bottom: UIDevice.isIPad ? -6: -4))
public static let boldFeatureXLarge = TextStyle(rawValue: "boldFeatureXLarge",
fontFace: .dsBold,
pointSize: UIDevice.isIPad ? VDSTypography.fontSizeFeature144 : VDSTypography.fontSizeFeature96,
lineHeight: UIDevice.isIPad ? VDSTypography.lineHeightFeature136 : VDSTypography.lineHeightFeature88,
letterSpacing: 0,
edgeInsets: .init(bottom: UIDevice.isIPad ? -6: -4))
public static let boldFeatureLarge = TextStyle(rawValue: "boldFeatureLarge",
fontFace: .edsBold,
pointSize: UIDevice.isIPad ? VDSTypography.fontSizeFeature128 : VDSTypography.fontSizeFeature80,
lineHeight: UIDevice.isIPad ? VDSTypography.lineHeightFeature120 : VDSTypography.lineHeightFeature76,
edgeInsets: .init(bottom: UIDevice.isIPad ? -6: -2))
public static let featureLarge = TextStyle(rawValue: "featureLarge", public static let featureLarge = TextStyle(rawValue: "featureLarge",
fontFace: .dsLight, fontFace: .dsLight,
pointSize: UIDevice.isIPad ? VDSTypography.fontSizeFeature128 : VDSTypography.fontSizeFeature80, pointSize: UIDevice.isIPad ? VDSTypography.fontSizeFeature128 : VDSTypography.fontSizeFeature80,
lineHeight: UIDevice.isIPad ? VDSTypography.lineHeightFeature120 : VDSTypography.lineHeightFeature76, lineHeight: UIDevice.isIPad ? VDSTypography.lineHeightFeature120 : VDSTypography.lineHeightFeature76,
letterSpacing: VDSTypography.letterSpacingSemiWide, letterSpacing: VDSTypography.letterSpacingSemiWide,
edgeInsets: .init(bottom: UIDevice.isIPad ? -6: -2)) edgeInsets: .init(bottom: UIDevice.isIPad ? -6: -2))
public static let boldFeatureLarge = TextStyle(rawValue: "boldFeatureLarge", public static let boldFeatureMedium = TextStyle(rawValue: "boldFeatureMedium",
fontFace: .dsBold, fontFace: .edsBold,
pointSize: UIDevice.isIPad ? VDSTypography.fontSizeFeature128 : VDSTypography.fontSizeFeature80, pointSize: UIDevice.isIPad ? VDSTypography.fontSizeFeature96 : VDSTypography.fontSizeFeature64,
lineHeight: UIDevice.isIPad ? VDSTypography.lineHeightFeature120 : VDSTypography.lineHeightFeature76, lineHeight: UIDevice.isIPad ? VDSTypography.lineHeightFeature88 : VDSTypography.lineHeightFeature64,
letterSpacing: 0, edgeInsets: .init(bottom: UIDevice.isIPad ? -4: -2))
edgeInsets: .init(bottom: UIDevice.isIPad ? -6: -2))
public static let featureMedium = TextStyle(rawValue: "featureMedium", public static let featureMedium = TextStyle(rawValue: "featureMedium",
fontFace: .dsLight, fontFace: .dsLight,
@ -47,13 +51,12 @@ extension TextStyle {
lineHeight: UIDevice.isIPad ? VDSTypography.lineHeightFeature88 : VDSTypography.lineHeightFeature64, lineHeight: UIDevice.isIPad ? VDSTypography.lineHeightFeature88 : VDSTypography.lineHeightFeature64,
letterSpacing: VDSTypography.letterSpacingSemiWide, letterSpacing: VDSTypography.letterSpacingSemiWide,
edgeInsets: .init(bottom: UIDevice.isIPad ? -4: -2)) edgeInsets: .init(bottom: UIDevice.isIPad ? -4: -2))
public static let boldFeatureMedium = TextStyle(rawValue: "boldFeatureMedium", public static let boldFeatureSmall = TextStyle(rawValue: "boldFeatureSmall",
fontFace: .dsBold, fontFace: .edsBold,
pointSize: UIDevice.isIPad ? VDSTypography.fontSizeFeature96 : VDSTypography.fontSizeFeature64, pointSize: UIDevice.isIPad ? VDSTypography.fontSizeFeature80 : VDSTypography.fontSizeFeature48,
lineHeight: UIDevice.isIPad ? VDSTypography.lineHeightFeature88 : VDSTypography.lineHeightFeature64, lineHeight: UIDevice.isIPad ? VDSTypography.lineHeightFeature76 : VDSTypography.lineHeightFeature48,
letterSpacing: 0, edgeInsets: .init(bottom: UIDevice.isIPad ? -2: 0))
edgeInsets: .init(bottom: UIDevice.isIPad ? -4: -2))
public static let featureSmall = TextStyle(rawValue: "featureSmall", public static let featureSmall = TextStyle(rawValue: "featureSmall",
fontFace: .dsLight, fontFace: .dsLight,
@ -61,27 +64,25 @@ extension TextStyle {
lineHeight: UIDevice.isIPad ? VDSTypography.lineHeightFeature76 : VDSTypography.lineHeightFeature48, lineHeight: UIDevice.isIPad ? VDSTypography.lineHeightFeature76 : VDSTypography.lineHeightFeature48,
letterSpacing: VDSTypography.letterSpacingSemiWide, letterSpacing: VDSTypography.letterSpacingSemiWide,
edgeInsets: .init(bottom: UIDevice.isIPad ? -2: 0)) edgeInsets: .init(bottom: UIDevice.isIPad ? -2: 0))
public static let boldFeatureSmall = TextStyle(rawValue: "boldFeatureSmall", public static let boldFeatureXSmall = TextStyle(rawValue: "boldFeatureXSmall",
fontFace: .dsBold, fontFace: .edsBold,
pointSize: UIDevice.isIPad ? VDSTypography.fontSizeFeature80 : VDSTypography.fontSizeFeature48, pointSize: UIDevice.isIPad ? VDSTypography.fontSizeFeature64 : VDSTypography.fontSizeFeature40,
lineHeight: UIDevice.isIPad ? VDSTypography.lineHeightFeature76 : VDSTypography.lineHeightFeature48, lineHeight: UIDevice.isIPad ? VDSTypography.lineHeightFeature64 : VDSTypography.lineHeightFeature40,
letterSpacing: 0, edgeInsets: .init(bottom: UIDevice.isIPad ? -2: 0))
edgeInsets: .init(bottom: UIDevice.isIPad ? -2: 0))
public static let featureXSmall = TextStyle(rawValue: "featureXSmall", public static let featureXSmall = TextStyle(rawValue: "featureXSmall",
fontFace: .dsLight, fontFace: .dsLight,
pointSize: UIDevice.isIPad ? VDSTypography.fontSizeFeature64 : VDSTypography.fontSizeFeature40, pointSize: UIDevice.isIPad ? VDSTypography.fontSizeFeature64 : VDSTypography.fontSizeFeature40,
lineHeight: UIDevice.isIPad ? VDSTypography.lineHeightFeature64 : VDSTypography.lineHeightFeature40, lineHeight: UIDevice.isIPad ? VDSTypography.lineHeightFeature64 : VDSTypography.lineHeightFeature40,
letterSpacing: VDSTypography.letterSpacingSemiWide, letterSpacing: VDSTypography.letterSpacingSemiWide,
edgeInsets: .init(bottom: UIDevice.isIPad ? -2: 0)) edgeInsets: .init(bottom: UIDevice.isIPad ? -2: 0))
public static let boldFeatureXSmall = TextStyle(rawValue: "boldFeatureXSmall", public static let boldTitle2XLarge = TextStyle(rawValue: "boldTitle2XLarge",
fontFace: .dsBold, fontFace: .edsBold,
pointSize: UIDevice.isIPad ? VDSTypography.fontSizeFeature64 : VDSTypography.fontSizeFeature40, pointSize: UIDevice.isIPad ? VDSTypography.fontSizeTitle64 : VDSTypography.fontSizeTitle40,
lineHeight: UIDevice.isIPad ? VDSTypography.lineHeightFeature64 : VDSTypography.lineHeightFeature40, lineHeight: UIDevice.isIPad ? VDSTypography.lineHeightTitle64 : VDSTypography.lineHeightTitle40,
letterSpacing: 0, edgeInsets: .init(bottom: UIDevice.isIPad ? -2: 0))
edgeInsets: .init(bottom: UIDevice.isIPad ? -2: 0))
public static let title2XLarge = TextStyle(rawValue: "title2XLarge", public static let title2XLarge = TextStyle(rawValue: "title2XLarge",
fontFace: .dsLight, fontFace: .dsLight,
@ -90,24 +91,21 @@ extension TextStyle {
letterSpacing: VDSTypography.letterSpacingSemiWide, letterSpacing: VDSTypography.letterSpacingSemiWide,
edgeInsets: .init(bottom: UIDevice.isIPad ? -2: 0)) edgeInsets: .init(bottom: UIDevice.isIPad ? -2: 0))
public static let boldTitle2XLarge = TextStyle(rawValue: "boldTitle2XLarge", public static let boldTitleXLarge = TextStyle(rawValue: "boldTitleXLarge",
fontFace: .dsBold, fontFace: .edsBold,
pointSize: UIDevice.isIPad ? VDSTypography.fontSizeTitle64 : VDSTypography.fontSizeTitle40, pointSize: UIDevice.isIPad ? VDSTypography.fontSizeTitle48 : VDSTypography.fontSizeTitle32,
lineHeight: UIDevice.isIPad ? VDSTypography.lineHeightTitle64 : VDSTypography.lineHeightTitle40, lineHeight: UIDevice.isIPad ? VDSTypography.lineHeightTitle48 : VDSTypography.lineHeightTitle36)
letterSpacing: 0,
edgeInsets: .init(bottom: UIDevice.isIPad ? -2: 0))
public static let titleXLarge = TextStyle(rawValue: "titleXLarge", public static let titleXLarge = TextStyle(rawValue: "titleXLarge",
fontFace: .dsLight, fontFace: .dsLight,
pointSize: UIDevice.isIPad ? VDSTypography.fontSizeTitle48 : VDSTypography.fontSizeTitle32, pointSize: UIDevice.isIPad ? VDSTypography.fontSizeTitle48 : VDSTypography.fontSizeTitle32,
lineHeight: UIDevice.isIPad ? VDSTypography.lineHeightTitle48 : VDSTypography.lineHeightTitle36, lineHeight: UIDevice.isIPad ? VDSTypography.lineHeightTitle48 : VDSTypography.lineHeightTitle36,
letterSpacing: VDSTypography.letterSpacingSemiWide) letterSpacing: VDSTypography.letterSpacingSemiWide)
public static let boldTitleXLarge = TextStyle(rawValue: "boldTitleXLarge", public static let boldTitleLarge = TextStyle(rawValue: "boldTitleLarge",
fontFace: .dsBold, fontFace: .edsBold,
pointSize: UIDevice.isIPad ? VDSTypography.fontSizeTitle48 : VDSTypography.fontSizeTitle32, pointSize: UIDevice.isIPad ? VDSTypography.fontSizeTitle32 : VDSTypography.fontSizeTitle24,
lineHeight: UIDevice.isIPad ? VDSTypography.lineHeightTitle48 : VDSTypography.lineHeightTitle36, lineHeight: UIDevice.isIPad ? VDSTypography.lineHeightTitle36 : VDSTypography.lineHeightTitle28)
letterSpacing: 0)
public static let titleLarge = TextStyle(rawValue: "titleLarge", public static let titleLarge = TextStyle(rawValue: "titleLarge",
fontFace: .dsLight, fontFace: .dsLight,
@ -115,84 +113,70 @@ extension TextStyle {
lineHeight: UIDevice.isIPad ? VDSTypography.lineHeightTitle36 : VDSTypography.lineHeightTitle28, lineHeight: UIDevice.isIPad ? VDSTypography.lineHeightTitle36 : VDSTypography.lineHeightTitle28,
letterSpacing: VDSTypography.letterSpacingSemiWide) letterSpacing: VDSTypography.letterSpacingSemiWide)
public static let boldTitleLarge = TextStyle(rawValue: "boldTitleLarge", public static let boldTitleMedium = TextStyle(rawValue: "boldTitleMedium",
fontFace: .dsBold, fontFace: .edsBold,
pointSize: UIDevice.isIPad ? VDSTypography.fontSizeTitle32 : VDSTypography.fontSizeTitle24, pointSize: UIDevice.isIPad ? VDSTypography.fontSizeTitle24 : VDSTypography.fontSizeTitle20,
lineHeight: UIDevice.isIPad ? VDSTypography.lineHeightTitle36 : VDSTypography.lineHeightTitle28, lineHeight: UIDevice.isIPad ? VDSTypography.lineHeightTitle28 : VDSTypography.lineHeightTitle24)
letterSpacing: 0)
public static let titleMedium = TextStyle(rawValue: "titleMedium", public static let titleMedium = TextStyle(rawValue: "titleMedium",
fontFace: .dsLight, fontFace: .edsRegular,
pointSize: UIDevice.isIPad ? VDSTypography.fontSizeTitle24 : VDSTypography.fontSizeTitle20, pointSize: UIDevice.isIPad ? VDSTypography.fontSizeTitle24 : VDSTypography.fontSizeTitle20,
lineHeight: UIDevice.isIPad ? VDSTypography.lineHeightTitle28 : VDSTypography.lineHeightTitle24, lineHeight: UIDevice.isIPad ? VDSTypography.lineHeightTitle28 : VDSTypography.lineHeightTitle24)
letterSpacing: 0)
public static let boldTitleSmall = TextStyle(rawValue: "boldTitleSmall",
public static let boldTitleMedium = TextStyle(rawValue: "boldTitleMedium", fontFace: .edsBold,
fontFace: .dsBold, pointSize: UIDevice.isIPad ? VDSTypography.fontSizeTitle20 : VDSTypography.fontSizeTitle16,
pointSize: UIDevice.isIPad ? VDSTypography.fontSizeTitle24 : VDSTypography.fontSizeTitle20, lineHeight: UIDevice.isIPad ? VDSTypography.lineHeightTitle24 : VDSTypography.lineHeightTitle20)
lineHeight: UIDevice.isIPad ? VDSTypography.lineHeightTitle28 : VDSTypography.lineHeightTitle24,
letterSpacing: 0)
public static let titleSmall = TextStyle(rawValue: "titleSmall", public static let titleSmall = TextStyle(rawValue: "titleSmall",
fontFace: .dsLight, fontFace: .edsRegular,
pointSize: UIDevice.isIPad ? VDSTypography.fontSizeTitle20 : VDSTypography.fontSizeTitle16, pointSize: UIDevice.isIPad ? VDSTypography.fontSizeTitle20 : VDSTypography.fontSizeTitle16,
lineHeight: UIDevice.isIPad ? VDSTypography.lineHeightTitle24 : VDSTypography.lineHeightTitle20, lineHeight: UIDevice.isIPad ? VDSTypography.lineHeightTitle24 : VDSTypography.lineHeightTitle20)
letterSpacing: 0)
public static let boldTitleSmall = TextStyle(rawValue: "boldTitleSmall",
fontFace: .dsBold,
pointSize: UIDevice.isIPad ? VDSTypography.fontSizeTitle20 : VDSTypography.fontSizeTitle16,
lineHeight: UIDevice.isIPad ? VDSTypography.lineHeightTitle24 : VDSTypography.lineHeightTitle20,
letterSpacing: 0)
public static let boldBodyLarge = TextStyle(rawValue: "boldBodyLarge",
fontFace: .edsBold,
pointSize: VDSTypography.fontSizeBody16,
lineHeight: VDSTypography.lineHeightBody20,
letterSpacing: VDSTypography.letterSpacingWide)
public static let bodyLarge = TextStyle(rawValue: "bodyLarge", public static let bodyLarge = TextStyle(rawValue: "bodyLarge",
fontFace: .dsRegular, fontFace: .edsRegular,
pointSize: VDSTypography.fontSizeBody16, pointSize: VDSTypography.fontSizeBody16,
lineHeight: VDSTypography.lineHeightBody20, lineHeight: VDSTypography.lineHeightBody20,
letterSpacing:VDSTypography.letterSpacingWide) letterSpacing:VDSTypography.letterSpacingWide)
public static let boldBodyLarge = TextStyle(rawValue: "boldBodyLarge",
fontFace: .dsBold,
pointSize: VDSTypography.fontSizeBody16,
lineHeight: VDSTypography.lineHeightBody20,
letterSpacing: VDSTypography.letterSpacingWide)
public static let bodyMedium = TextStyle(rawValue: "bodyMedium",
fontFace: .dsRegular,
pointSize: VDSTypography.fontSizeBody14,
lineHeight: VDSTypography.lineHeightBody18,
letterSpacing: VDSTypography.letterSpacingWide)
public static let boldBodyMedium = TextStyle(rawValue: "boldBodyMedium", public static let boldBodyMedium = TextStyle(rawValue: "boldBodyMedium",
fontFace: .dsBold, fontFace: .edsBold,
pointSize: VDSTypography.fontSizeBody14, pointSize: VDSTypography.fontSizeBody14,
lineHeight: VDSTypography.lineHeightBody18, lineHeight: VDSTypography.lineHeightBody18,
letterSpacing: VDSTypography.letterSpacingWide) letterSpacing: VDSTypography.letterSpacingWide)
public static let bodySmall = TextStyle(rawValue: "bodySmall", public static let bodyMedium = TextStyle(rawValue: "bodyMedium",
fontFace: .dsRegular, fontFace: .edsRegular,
pointSize: VDSTypography.fontSizeBody12, pointSize: VDSTypography.fontSizeBody14,
lineHeight: VDSTypography.lineHeightBody16, lineHeight: VDSTypography.lineHeightBody18,
letterSpacing: 0) letterSpacing: VDSTypography.letterSpacingWide)
public static let boldBodySmall = TextStyle(rawValue: "boldBodySmall", public static let boldBodySmall = TextStyle(rawValue: "boldBodySmall",
fontFace: .dsBold, fontFace: .etxBold,
pointSize: VDSTypography.fontSizeBody12, pointSize: VDSTypography.fontSizeBody12,
lineHeight: VDSTypography.lineHeightBody16, lineHeight: VDSTypography.lineHeightBody16)
letterSpacing: 0)
public static let micro = TextStyle(rawValue: "micro", public static let bodySmall = TextStyle(rawValue: "bodySmall",
fontFace: .dsRegular, fontFace: .etxRegular,
pointSize: VDSTypography.fontSizeMicro11, pointSize: VDSTypography.fontSizeBody12,
lineHeight: VDSTypography.lineHeightMicro16, lineHeight: VDSTypography.lineHeightBody16)
letterSpacing: 0)
public static let boldMicro = TextStyle(rawValue: "boldMicro", public static let boldMicro = TextStyle(rawValue: "boldMicro",
fontFace: .dsBold, fontFace: .etxBold,
pointSize: VDSTypography.fontSizeMicro11, pointSize: VDSTypography.fontSizeMicro11,
lineHeight: VDSTypography.lineHeightMicro16, lineHeight: VDSTypography.lineHeightMicro16)
letterSpacing: 0)
public static let micro = TextStyle(rawValue: "micro",
fontFace: .etxRegular,
pointSize: VDSTypography.fontSizeMicro11,
lineHeight: VDSTypography.lineHeightMicro16)
public static var allCases: [TextStyle] { public static var allCases: [TextStyle] {
return [ return [
featureXLarge, featureXLarge,