diff --git a/MisticaCatalog/Source/FontsView.swift b/MisticaCatalog/Source/FontsView.swift index a83774e8a..1d692abf9 100644 --- a/MisticaCatalog/Source/FontsView.swift +++ b/MisticaCatalog/Source/FontsView.swift @@ -12,12 +12,12 @@ import SwiftUI struct FontView: View { let fonts: [(name: String, font: Font)] = [ - ("text-preset10 bold", .textPreset10()), - ("text-preset9 bold", .textPreset9()), - ("text-preset8 bold", .textPreset8()), - ("text-preset7 bold", .textPreset7()), - ("text-preset6 bold", .textPreset6()), - ("text-preset5 bold", .textPreset5()), + ("text-preset10", .textPreset10()), + ("text-preset9", .textPreset9()), + ("text-preset8", .textPreset8()), + ("text-preset7", .textPreset7()), + ("text-preset6", .textPreset6()), + ("text-preset5", .textPreset5()), ("text-preset4 medium", .textPreset4(weight: .medium)), ("text-preset4 regular", .textPreset4(weight: .regular)), ("text-preset4 light", .textPreset4(weight: .light)), diff --git a/Sources/Mistica/Components/Cards/DataCard.swift b/Sources/Mistica/Components/Cards/DataCard.swift index 99b30915e..d3feb428c 100644 --- a/Sources/Mistica/Components/Cards/DataCard.swift +++ b/Sources/Mistica/Components/Cards/DataCard.swift @@ -183,7 +183,7 @@ private extension DataCard { cardBaseView.contentView.headlineTopSpacing = 8 - cardBaseView.contentView.titleLabel.font = .cardTitlePreset() + cardBaseView.contentView.titleLabel.font = .textPreset4(weight: .cardTitle) cardBaseView.contentView.titleLabel.textColor = .textPrimary cardBaseView.contentView.titleLabel.minHeight = 24 cardBaseView.contentView.titleLabel.numberOfLines = 2 diff --git a/Sources/MisticaCommon/Fonts/FontStyle+Weights.swift b/Sources/MisticaCommon/Fonts/FontStyle+Weights.swift new file mode 100644 index 000000000..bf557a6e3 --- /dev/null +++ b/Sources/MisticaCommon/Fonts/FontStyle+Weights.swift @@ -0,0 +1,99 @@ +// +// FontStyle+Weights.swift +// +// Made with ❤️ by Novum +// +// Copyright © Telefonica. All rights reserved. +// + +import SwiftUI +import UIKit + +public extension FontStyle { + enum TextPreset1Weight: CaseIterable { + case regular, medium + + var value: MisticaFontWeightType { + switch self { + case .regular: return .regular + case .medium: return .medium + } + } + } + + enum TextPreset2Weight: CaseIterable { + case regular, medium + + var value: MisticaFontWeightType { + switch self { + case .regular: return .regular + case .medium: return .medium + } + } + } + + enum TextPreset3Weight: CaseIterable { + case light, regular, medium + + var value: MisticaFontWeightType { + switch self { + case .light: return .light + case .regular: return .regular + case .medium: return .medium + } + } + } + + enum TextPreset4Weight: CaseIterable { + case light, regular, medium, cardTitle + + var value: MisticaFontWeightType { + switch self { + case .light: return .light + case .regular: return .regular + case .medium: return .medium + case .cardTitle: return MisticaConfig.currentFontWeights.cardTitlePreset + } + } + } +} + +struct MovistarFontWeights: MisticaFontWeights { + public var cardTitlePreset: MisticaFontWeightType = .bold + public var textPreset5: MisticaFontWeightType = .bold + public var textPreset6: MisticaFontWeightType = .bold + public var textPreset7: MisticaFontWeightType = .bold + public var textPreset8: MisticaFontWeightType = .bold + public var textPreset9: MisticaFontWeightType = .bold + public var textPreset10: MisticaFontWeightType = .bold +} + +struct O2FontWeights: MisticaFontWeights { + public var cardTitlePreset: MisticaFontWeightType = .regular + public var textPreset5: MisticaFontWeightType = .light + public var textPreset6: MisticaFontWeightType = .light + public var textPreset7: MisticaFontWeightType = .light + public var textPreset8: MisticaFontWeightType = .light + public var textPreset9: MisticaFontWeightType = .light + public var textPreset10: MisticaFontWeightType = .light +} + +struct BlauFontWeights: MisticaFontWeights { + public var cardTitlePreset: MisticaFontWeightType = .regular + public var textPreset5: MisticaFontWeightType = .light + public var textPreset6: MisticaFontWeightType = .light + public var textPreset7: MisticaFontWeightType = .light + public var textPreset8: MisticaFontWeightType = .light + public var textPreset9: MisticaFontWeightType = .light + public var textPreset10: MisticaFontWeightType = .light +} + +struct VivoFontWeights: MisticaFontWeights { + public var cardTitlePreset: MisticaFontWeightType = .regular + public var textPreset5: MisticaFontWeightType = .light + public var textPreset6: MisticaFontWeightType = .light + public var textPreset7: MisticaFontWeightType = .light + public var textPreset8: MisticaFontWeightType = .light + public var textPreset9: MisticaFontWeightType = .light + public var textPreset10: MisticaFontWeightType = .light +} diff --git a/Sources/MisticaCommon/Fonts/FontStyle.swift b/Sources/MisticaCommon/Fonts/FontStyle.swift index 4e1eecaf0..7f58dcb74 100644 --- a/Sources/MisticaCommon/Fonts/FontStyle.swift +++ b/Sources/MisticaCommon/Fonts/FontStyle.swift @@ -21,7 +21,6 @@ import UIKit case textPreset8 case textPreset9 case textPreset10 - case cardTitlePreset func preferredFont( weight: Font.Weight, @@ -76,8 +75,6 @@ import UIKit return "TextPreset9" case .textPreset10: return "TextPreset10" - case .cardTitlePreset: - return "CardTitlePreset" } } } @@ -128,8 +125,6 @@ private extension FontStyle { return 32 case .textPreset10: return 32 - case .cardTitlePreset: - return 18 } } @@ -141,8 +136,7 @@ private extension FontStyle { return .subheadline case .textPreset3: return .body - case .textPreset4, - .cardTitlePreset: + case .textPreset4: return .headline case .textPreset5: return .title3 @@ -165,8 +159,7 @@ private extension FontStyle { return .subheadline case .textPreset3: return .body - case .textPreset4, - .cardTitlePreset: + case .textPreset4: return .headline case .textPreset5: if #available(iOS 14.0, *) { diff --git a/Sources/MisticaCommon/Fonts/FontToolkit+Font.swift b/Sources/MisticaCommon/Fonts/FontToolkit+Font.swift index d740a8473..2139dfe01 100644 --- a/Sources/MisticaCommon/Fonts/FontToolkit+Font.swift +++ b/Sources/MisticaCommon/Fonts/FontToolkit+Font.swift @@ -13,47 +13,43 @@ import SwiftUI public extension Font { static func textPreset1(weight: FontStyle.TextPreset1Weight, constrainedToPreferredSize: UIContentSizeCategory? = nil) -> Font { - FontStyle.textPreset1.preferredFont(weight: weight.systemWeight, constrainedToPreferredSize: constrainedToPreferredSize) + FontStyle.textPreset1.preferredFont(weight: weight.value.systemWeight, constrainedToPreferredSize: constrainedToPreferredSize) } static func textPreset2(weight: FontStyle.TextPreset2Weight, constrainedToPreferredSize: UIContentSizeCategory? = nil) -> Font { - FontStyle.textPreset2.preferredFont(weight: weight.systemWeight, constrainedToPreferredSize: constrainedToPreferredSize) + FontStyle.textPreset2.preferredFont(weight: weight.value.systemWeight, constrainedToPreferredSize: constrainedToPreferredSize) } static func textPreset3(weight: FontStyle.TextPreset3Weight, constrainedToPreferredSize: UIContentSizeCategory? = nil) -> Font { - FontStyle.textPreset3.preferredFont(weight: weight.systemWeight, constrainedToPreferredSize: constrainedToPreferredSize) + FontStyle.textPreset3.preferredFont(weight: weight.value.systemWeight, constrainedToPreferredSize: constrainedToPreferredSize) } static func textPreset4(weight: FontStyle.TextPreset4Weight, constrainedToPreferredSize: UIContentSizeCategory? = nil) -> Font { - FontStyle.textPreset4.preferredFont(weight: weight.systemWeight, constrainedToPreferredSize: constrainedToPreferredSize) + FontStyle.textPreset4.preferredFont(weight: weight.value.systemWeight, constrainedToPreferredSize: constrainedToPreferredSize) } static func textPreset5(constrainedToPreferredSize: UIContentSizeCategory? = nil) -> Font { - FontStyle.textPreset5.preferredFont(weight: FontStyle.TextPreset5Weight.default.systemWeight, constrainedToPreferredSize: constrainedToPreferredSize) + FontStyle.textPreset5.preferredFont(weight: MisticaConfig.currentFontWeights.textPreset5.systemWeight, constrainedToPreferredSize: constrainedToPreferredSize) } static func textPreset6(constrainedToPreferredSize: UIContentSizeCategory? = nil) -> Font { - FontStyle.textPreset6.preferredFont(weight: FontStyle.TextPreset6Weight.default.systemWeight, constrainedToPreferredSize: constrainedToPreferredSize) + FontStyle.textPreset6.preferredFont(weight: MisticaConfig.currentFontWeights.textPreset6.systemWeight, constrainedToPreferredSize: constrainedToPreferredSize) } static func textPreset7(constrainedToPreferredSize: UIContentSizeCategory? = nil) -> Font { - FontStyle.textPreset7.preferredFont(weight: FontStyle.TextPreset7Weight.default.systemWeight, constrainedToPreferredSize: constrainedToPreferredSize) + FontStyle.textPreset7.preferredFont(weight: MisticaConfig.currentFontWeights.textPreset7.systemWeight, constrainedToPreferredSize: constrainedToPreferredSize) } static func textPreset8(constrainedToPreferredSize: UIContentSizeCategory? = nil) -> Font { - FontStyle.textPreset8.preferredFont(weight: FontStyle.TextPreset8Weight.default.systemWeight, constrainedToPreferredSize: constrainedToPreferredSize) + FontStyle.textPreset8.preferredFont(weight: MisticaConfig.currentFontWeights.textPreset8.systemWeight, constrainedToPreferredSize: constrainedToPreferredSize) } static func textPreset9(constrainedToPreferredSize: UIContentSizeCategory? = nil) -> Font { - FontStyle.textPreset9.preferredFont(weight: FontStyle.TextPreset9Weight.default.systemWeight, constrainedToPreferredSize: constrainedToPreferredSize) + FontStyle.textPreset9.preferredFont(weight: MisticaConfig.currentFontWeights.textPreset9.systemWeight, constrainedToPreferredSize: constrainedToPreferredSize) } static func textPreset10(constrainedToPreferredSize: UIContentSizeCategory? = nil) -> Font { - FontStyle.textPreset10.preferredFont(weight: FontStyle.TextPreset10Weight.default.systemWeight, constrainedToPreferredSize: constrainedToPreferredSize) - } - - static func cardTitlePreset(constrainedToPreferredSize: UIContentSizeCategory? = nil) -> Font { - FontStyle.cardTitlePreset.preferredFont(weight: FontStyle.CardTitlePresetWeight.default.systemWeight, constrainedToPreferredSize: constrainedToPreferredSize) + FontStyle.textPreset10.preferredFont(weight: MisticaConfig.currentFontWeights.textPreset10.systemWeight, constrainedToPreferredSize: constrainedToPreferredSize) } static func preferredFont(for fontStyle: FontStyle, weight: Font.Weight, constrainedToPreferredSize constrainedPreferredSize: UIContentSizeCategory) -> Font { diff --git a/Sources/MisticaCommon/Fonts/FontToolkit+UIFont.swift b/Sources/MisticaCommon/Fonts/FontToolkit+UIFont.swift index 3e4be4289..dc6f010b7 100644 --- a/Sources/MisticaCommon/Fonts/FontToolkit+UIFont.swift +++ b/Sources/MisticaCommon/Fonts/FontToolkit+UIFont.swift @@ -12,47 +12,43 @@ var _isDynamicTypeEnabled = true public extension UIFont { static func textPreset1(weight: FontStyle.TextPreset1Weight, constrainedToPreferredSize: UIContentSizeCategory? = nil) -> UIFont { - FontStyle.textPreset1.preferredFont(weight: weight.systemUIFontWeight, constrainedToPreferredSize: constrainedToPreferredSize) + FontStyle.textPreset1.preferredFont(weight: weight.value.systemUIFontWeight, constrainedToPreferredSize: constrainedToPreferredSize) } static func textPreset2(weight: FontStyle.TextPreset2Weight, constrainedToPreferredSize: UIContentSizeCategory? = nil) -> UIFont { - FontStyle.textPreset2.preferredFont(weight: weight.systemUIFontWeight, constrainedToPreferredSize: constrainedToPreferredSize) + FontStyle.textPreset2.preferredFont(weight: weight.value.systemUIFontWeight, constrainedToPreferredSize: constrainedToPreferredSize) } static func textPreset3(weight: FontStyle.TextPreset3Weight, constrainedToPreferredSize: UIContentSizeCategory? = nil) -> UIFont { - FontStyle.textPreset3.preferredFont(weight: weight.systemUIFontWeight, constrainedToPreferredSize: constrainedToPreferredSize) + FontStyle.textPreset3.preferredFont(weight: weight.value.systemUIFontWeight, constrainedToPreferredSize: constrainedToPreferredSize) } static func textPreset4(weight: FontStyle.TextPreset4Weight, constrainedToPreferredSize: UIContentSizeCategory? = nil) -> UIFont { - FontStyle.textPreset4.preferredFont(weight: weight.systemUIFontWeight, constrainedToPreferredSize: constrainedToPreferredSize) + FontStyle.textPreset4.preferredFont(weight: weight.value.systemUIFontWeight, constrainedToPreferredSize: constrainedToPreferredSize) } static func textPreset5(constrainedToPreferredSize: UIContentSizeCategory? = nil) -> UIFont { - FontStyle.textPreset5.preferredFont(weight: FontStyle.TextPreset5Weight.default.systemUIFontWeight, constrainedToPreferredSize: constrainedToPreferredSize) + FontStyle.textPreset5.preferredFont(weight: MisticaConfig.currentFontWeights.textPreset5.systemUIFontWeight, constrainedToPreferredSize: constrainedToPreferredSize) } static func textPreset6(constrainedToPreferredSize: UIContentSizeCategory? = nil) -> UIFont { - FontStyle.textPreset6.preferredFont(weight: FontStyle.TextPreset6Weight.default.systemUIFontWeight, constrainedToPreferredSize: constrainedToPreferredSize) + FontStyle.textPreset6.preferredFont(weight: MisticaConfig.currentFontWeights.textPreset6.systemUIFontWeight, constrainedToPreferredSize: constrainedToPreferredSize) } static func textPreset7(constrainedToPreferredSize: UIContentSizeCategory? = nil) -> UIFont { - FontStyle.textPreset7.preferredFont(weight: FontStyle.TextPreset7Weight.default.systemUIFontWeight, constrainedToPreferredSize: constrainedToPreferredSize) + FontStyle.textPreset7.preferredFont(weight: MisticaConfig.currentFontWeights.textPreset7.systemUIFontWeight, constrainedToPreferredSize: constrainedToPreferredSize) } static func textPreset8(constrainedToPreferredSize: UIContentSizeCategory? = nil) -> UIFont { - FontStyle.textPreset8.preferredFont(weight: FontStyle.TextPreset8Weight.default.systemUIFontWeight, constrainedToPreferredSize: constrainedToPreferredSize) + FontStyle.textPreset8.preferredFont(weight: MisticaConfig.currentFontWeights.textPreset8.systemUIFontWeight, constrainedToPreferredSize: constrainedToPreferredSize) } static func textPreset9(constrainedToPreferredSize: UIContentSizeCategory? = nil) -> UIFont { - FontStyle.textPreset9.preferredFont(weight: FontStyle.TextPreset9Weight.default.systemUIFontWeight, constrainedToPreferredSize: constrainedToPreferredSize) + FontStyle.textPreset9.preferredFont(weight: MisticaConfig.currentFontWeights.textPreset9.systemUIFontWeight, constrainedToPreferredSize: constrainedToPreferredSize) } static func textPreset10(constrainedToPreferredSize: UIContentSizeCategory? = nil) -> UIFont { - FontStyle.textPreset10.preferredFont(weight: FontStyle.TextPreset10Weight.default.systemUIFontWeight, constrainedToPreferredSize: constrainedToPreferredSize) - } - - static func cardTitlePreset(constrainedToPreferredSize: UIContentSizeCategory? = nil) -> UIFont { - FontStyle.cardTitlePreset.preferredFont(weight: FontStyle.CardTitlePresetWeight.default.systemUIFontWeight, constrainedToPreferredSize: constrainedToPreferredSize) + FontStyle.textPreset10.preferredFont(weight: MisticaConfig.currentFontWeights.textPreset10.systemUIFontWeight, constrainedToPreferredSize: constrainedToPreferredSize) } static func preferredFont(for fontStyle: FontStyle, weight: UIFont.Weight, constrainedToPreferredSize constrainedPreferredSize: UIContentSizeCategory) -> UIFont { diff --git a/Sources/MisticaCommon/Fonts/FontWeight.swift b/Sources/MisticaCommon/Fonts/FontWeight.swift deleted file mode 100644 index 54f931705..000000000 --- a/Sources/MisticaCommon/Fonts/FontWeight.swift +++ /dev/null @@ -1,125 +0,0 @@ -// -// FontWeight.swift -// -// Made with ❤️ by Novum -// -// Copyright © Telefonica. All rights reserved. -// - -import SwiftUI -import UIKit - -protocol FontWeightConvertible: CaseIterable { - var systemWeight: Font.Weight { get } - var systemUIFontWeight: UIFont.Weight { get } -} - -public protocol TextPresetFontWeightBrandable: CaseIterable { - static var light: Self { get } - static var bold: Self { get } -} - -public extension TextPresetFontWeightBrandable { - static var `default`: Self { - if MisticaConfig.brandStyle.isMovistarBrand { - return .bold - } else { - return .light - } - } -} - -public protocol CardFontWeightBrandable: CaseIterable { - static var bold: Self { get } - static var regular: Self { get } -} - -public extension CardFontWeightBrandable { - static var `default`: Self { - if MisticaConfig.brandStyle.isMovistarBrand { - return .bold - } else { - return .regular - } - } -} - -public extension FontStyle { - enum TextPreset1Weight: String, FontWeightConvertible { - case regular, medium - } - - enum TextPreset2Weight: String, FontWeightConvertible { - case regular, medium - } - - enum TextPreset3Weight: String, FontWeightConvertible { - case light, regular, medium - } - - enum TextPreset4Weight: String, FontWeightConvertible { - case light, regular, medium - } - - enum TextPreset5Weight: String, FontWeightConvertible, TextPresetFontWeightBrandable { - case light, bold - } - - enum TextPreset6Weight: String, FontWeightConvertible, TextPresetFontWeightBrandable { - case light, bold - } - - enum TextPreset7Weight: String, FontWeightConvertible, TextPresetFontWeightBrandable { - case light, bold - } - - enum TextPreset8Weight: String, FontWeightConvertible, TextPresetFontWeightBrandable { - case light, bold - } - - enum TextPreset9Weight: String, FontWeightConvertible, TextPresetFontWeightBrandable { - case light, bold - } - - enum TextPreset10Weight: String, FontWeightConvertible, TextPresetFontWeightBrandable { - case light, bold - } - - enum CardTitlePresetWeight: String, CardFontWeightBrandable { - case regular, bold - } -} - -extension RawRepresentable where RawValue == String { - var systemWeight: Font.Weight { - switch rawValue { - case "light": - return .light - case "regular": - return .regular - case "medium": - return .medium - case "bold": - return .bold - default: - assertionFailure("TextPreset should be an instance of light, regular or medium") - return .light - } - } - - var systemUIFontWeight: UIFont.Weight { - switch rawValue { - case "light": - return .light - case "regular": - return .regular - case "medium": - return .medium - case "bold": - return .bold - default: - assertionFailure("TextPreset should be an instance of light, regular or medium") - return .light - } - } -} diff --git a/Sources/MisticaCommon/Fonts/MisticaFontWeights.swift b/Sources/MisticaCommon/Fonts/MisticaFontWeights.swift new file mode 100644 index 000000000..3279f6470 --- /dev/null +++ b/Sources/MisticaCommon/Fonts/MisticaFontWeights.swift @@ -0,0 +1,54 @@ +// +// MisticaFontWeights.swift +// +// Made with ❤️ by Novum +// +// Copyright © Telefonica. All rights reserved. +// + +import SwiftUI +import UIKit + +public protocol MisticaFontWeights { + var cardTitlePreset: MisticaFontWeightType { get } + var textPreset5: MisticaFontWeightType { get } + var textPreset6: MisticaFontWeightType { get } + var textPreset7: MisticaFontWeightType { get } + var textPreset8: MisticaFontWeightType { get } + var textPreset9: MisticaFontWeightType { get } + var textPreset10: MisticaFontWeightType { get } +} + +/// Available font weights in Mistica +public enum MisticaFontWeightType { + case light + case regular + case medium + case bold + + var systemWeight: Font.Weight { + switch self { + case .light: + return .light + case .regular: + return .regular + case .medium: + return .medium + case .bold: + return .bold + } + } + + var systemUIFontWeight: UIFont.Weight { + switch self { + case .light: + return .light + case .regular: + return .regular + case .medium: + return .medium + case .bold: + return .bold + } + } +} diff --git a/Sources/MisticaCommon/MisticaConfig.swift b/Sources/MisticaCommon/MisticaConfig.swift index 349070329..256fe667c 100644 --- a/Sources/MisticaCommon/MisticaConfig.swift +++ b/Sources/MisticaCommon/MisticaConfig.swift @@ -12,12 +12,13 @@ public enum MisticaConfig { public private(set) static var currentColors: MisticaColors = MovistarColors() public private(set) static var currentBrandAssets: MisticaBrandAssets = DefaultMisticaBrandAssets() public private(set) static var currentStyledControls = [MisticaControlStyle]() + public private(set) static var currentFontWeights: MisticaFontWeights = MovistarFontWeights() // MARK: Public Setup public static var brandStyle: BrandStyle = .movistar { didSet { - configureColorPalette(for: brandStyle) + configure(for: brandStyle) MisticaAppearance.setUp(controls: currentStyledControls) } } @@ -29,20 +30,24 @@ public enum MisticaConfig { } private extension MisticaConfig { - static func configureColorPalette(for _: BrandStyle) { + static func configure(for _: BrandStyle) { switch brandStyle { case .movistar: currentColors = MovistarColors() currentBrandAssets = DefaultMisticaBrandAssets() + currentFontWeights = MovistarFontWeights() case .vivo: currentColors = VivoColors() currentBrandAssets = DefaultMisticaBrandAssets() + currentFontWeights = VivoFontWeights() case .o2: currentColors = O2Colors() currentBrandAssets = DefaultMisticaBrandAssets() + currentFontWeights = O2FontWeights() case .blau: currentColors = BlauColors() currentBrandAssets = DefaultMisticaBrandAssets() + currentFontWeights = BlauFontWeights() case .custom(let colors, let assets): currentColors = colors currentBrandAssets = assets diff --git a/Sources/MisticaCommon/Styles/BrandStyle.swift b/Sources/MisticaCommon/Styles/BrandStyle.swift index 5055d3efd..3b28d7acb 100644 --- a/Sources/MisticaCommon/Styles/BrandStyle.swift +++ b/Sources/MisticaCommon/Styles/BrandStyle.swift @@ -49,16 +49,4 @@ public enum BrandStyle { public static var allCases: [BrandStyle] { [.movistar, .vivo, .o2, .blau] } - - public var isMovistarBrand: Bool { - switch self { - case .movistar: - return true - case .vivo, - .o2, - .blau, - .custom: - return false - } - } } diff --git a/Tests/MisticaCommonTests/Fonts/FontStyleTests.swift b/Tests/MisticaCommonTests/Fonts/FontStyleTests.swift index f96c1ce68..0c2a36cf4 100644 --- a/Tests/MisticaCommonTests/Fonts/FontStyleTests.swift +++ b/Tests/MisticaCommonTests/Fonts/FontStyleTests.swift @@ -65,12 +65,6 @@ final class FontStyleTests: XCTestCase { XCTAssertEqual(UIFont.textPreset4(weight: .light).fontName, "Telefonica-Light") XCTAssertEqual(UIFont.textPreset4(weight: .regular).fontName, "Telefonica-Regular") XCTAssertEqual(UIFont.textPreset4(weight: .medium).fontName, "Telefonica-Bold") - XCTAssertEqual(UIFont.textPreset5().fontName, "Telefonica-Light") - XCTAssertEqual(UIFont.textPreset6().fontName, "Telefonica-Light") - XCTAssertEqual(UIFont.textPreset7().fontName, "Telefonica-Light") - XCTAssertEqual(UIFont.textPreset8().fontName, "Telefonica-Light") - XCTAssertEqual(UIFont.textPreset9().fontName, "Telefonica-Light") - XCTAssertEqual(UIFont.textPreset10().fontName, "Telefonica-Light") } } diff --git a/Tests/MisticaCommonTests/Fonts/FontToolkitTests.swift b/Tests/MisticaCommonTests/Fonts/FontToolkitTests.swift index 20bd1d024..7f8db502b 100644 --- a/Tests/MisticaCommonTests/Fonts/FontToolkitTests.swift +++ b/Tests/MisticaCommonTests/Fonts/FontToolkitTests.swift @@ -63,27 +63,27 @@ private extension FontToolkitTests { ) } let textPreset5 = makeLabel( - text: "textPreset5 \(FontStyle.TextPreset5Weight.default)", + text: "textPreset5 \(MisticaConfig.currentFontWeights.textPreset5)", font: .textPreset5() ) let textPreset6 = makeLabel( - text: "textPreset6 \(FontStyle.TextPreset6Weight.default)", + text: "textPreset6 \(MisticaConfig.currentFontWeights.textPreset6)", font: .textPreset6() ) let textPreset7 = makeLabel( - text: "textPreset7 \(FontStyle.TextPreset7Weight.default)", + text: "textPreset7 \(MisticaConfig.currentFontWeights.textPreset7)", font: .textPreset7() ) let textPreset8 = makeLabel( - text: "textPreset8 \(FontStyle.TextPreset8Weight.default)", + text: "textPreset8 \(MisticaConfig.currentFontWeights.textPreset8)", font: .textPreset8() ) let textPreset9 = makeLabel( - text: "textPreset9 \(FontStyle.TextPreset9Weight.default)", + text: "textPreset9 \(MisticaConfig.currentFontWeights.textPreset9)", font: .textPreset9() ) let textPreset10 = makeLabel( - text: "textPreset10 \(FontStyle.TextPreset10Weight.default)", + text: "textPreset10 \(MisticaConfig.currentFontWeights.textPreset10)", font: .textPreset10() ) diff --git a/Tests/MisticaCommonTests/Fonts/__Snapshots__/FontToolkitTests/testFonts.with-blau-dark-style.png b/Tests/MisticaCommonTests/Fonts/__Snapshots__/FontToolkitTests/testFonts.with-blau-dark-style.png index 738743afd..345e7759f 100644 Binary files a/Tests/MisticaCommonTests/Fonts/__Snapshots__/FontToolkitTests/testFonts.with-blau-dark-style.png and b/Tests/MisticaCommonTests/Fonts/__Snapshots__/FontToolkitTests/testFonts.with-blau-dark-style.png differ diff --git a/Tests/MisticaCommonTests/Fonts/__Snapshots__/FontToolkitTests/testFonts.with-blau-style.png b/Tests/MisticaCommonTests/Fonts/__Snapshots__/FontToolkitTests/testFonts.with-blau-style.png index 738743afd..345e7759f 100644 Binary files a/Tests/MisticaCommonTests/Fonts/__Snapshots__/FontToolkitTests/testFonts.with-blau-style.png and b/Tests/MisticaCommonTests/Fonts/__Snapshots__/FontToolkitTests/testFonts.with-blau-style.png differ diff --git a/Tests/MisticaCommonTests/Fonts/__Snapshots__/FontToolkitTests/testFonts.with-movistar-dark-style.png b/Tests/MisticaCommonTests/Fonts/__Snapshots__/FontToolkitTests/testFonts.with-movistar-dark-style.png index 4a6124095..477523d97 100644 Binary files a/Tests/MisticaCommonTests/Fonts/__Snapshots__/FontToolkitTests/testFonts.with-movistar-dark-style.png and b/Tests/MisticaCommonTests/Fonts/__Snapshots__/FontToolkitTests/testFonts.with-movistar-dark-style.png differ diff --git a/Tests/MisticaCommonTests/Fonts/__Snapshots__/FontToolkitTests/testFonts.with-movistar-style.png b/Tests/MisticaCommonTests/Fonts/__Snapshots__/FontToolkitTests/testFonts.with-movistar-style.png index 4a6124095..477523d97 100644 Binary files a/Tests/MisticaCommonTests/Fonts/__Snapshots__/FontToolkitTests/testFonts.with-movistar-style.png and b/Tests/MisticaCommonTests/Fonts/__Snapshots__/FontToolkitTests/testFonts.with-movistar-style.png differ diff --git a/Tests/MisticaCommonTests/Fonts/__Snapshots__/FontToolkitTests/testFonts.with-o2-dark-style.png b/Tests/MisticaCommonTests/Fonts/__Snapshots__/FontToolkitTests/testFonts.with-o2-dark-style.png index 738743afd..345e7759f 100644 Binary files a/Tests/MisticaCommonTests/Fonts/__Snapshots__/FontToolkitTests/testFonts.with-o2-dark-style.png and b/Tests/MisticaCommonTests/Fonts/__Snapshots__/FontToolkitTests/testFonts.with-o2-dark-style.png differ diff --git a/Tests/MisticaCommonTests/Fonts/__Snapshots__/FontToolkitTests/testFonts.with-o2-style.png b/Tests/MisticaCommonTests/Fonts/__Snapshots__/FontToolkitTests/testFonts.with-o2-style.png index 738743afd..345e7759f 100644 Binary files a/Tests/MisticaCommonTests/Fonts/__Snapshots__/FontToolkitTests/testFonts.with-o2-style.png and b/Tests/MisticaCommonTests/Fonts/__Snapshots__/FontToolkitTests/testFonts.with-o2-style.png differ diff --git a/Tests/MisticaCommonTests/Fonts/__Snapshots__/FontToolkitTests/testFonts.with-vivo-dark-style.png b/Tests/MisticaCommonTests/Fonts/__Snapshots__/FontToolkitTests/testFonts.with-vivo-dark-style.png index 738743afd..345e7759f 100644 Binary files a/Tests/MisticaCommonTests/Fonts/__Snapshots__/FontToolkitTests/testFonts.with-vivo-dark-style.png and b/Tests/MisticaCommonTests/Fonts/__Snapshots__/FontToolkitTests/testFonts.with-vivo-dark-style.png differ diff --git a/Tests/MisticaCommonTests/Fonts/__Snapshots__/FontToolkitTests/testFonts.with-vivo-style.png b/Tests/MisticaCommonTests/Fonts/__Snapshots__/FontToolkitTests/testFonts.with-vivo-style.png index 738743afd..345e7759f 100644 Binary files a/Tests/MisticaCommonTests/Fonts/__Snapshots__/FontToolkitTests/testFonts.with-vivo-style.png and b/Tests/MisticaCommonTests/Fonts/__Snapshots__/FontToolkitTests/testFonts.with-vivo-style.png differ