diff options
Diffstat (limited to 'Map/Presentation/Theme')
| -rw-r--r-- | Map/Presentation/Theme/Font+theme.swift | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/Map/Presentation/Theme/Font+theme.swift b/Map/Presentation/Theme/Font+theme.swift index cc80fc4..079c0de 100644 --- a/Map/Presentation/Theme/Font+theme.swift +++ b/Map/Presentation/Theme/Font+theme.swift @@ -46,11 +46,32 @@ extension Font { } struct Map { - static let note = Font.libertinus(size: Dimensions.FontSize.Map.note).weight(.regular) - static let axisLabel = Font.libertinus(size: Dimensions.FontSize.Map.axisLabel).weight( - .regular) - static let vertexLabel = Font.libertinus(size: Dimensions.FontSize.Map.vertexLabel).weight( - .regular) + static var note: Font { + if UserDefaults.standard.bool(forKey: "useCustomFont"), + let customFontName = UserDefaults.standard.string(forKey: "customFontName"), + !customFontName.isEmpty { + return Font.custom(customFontName, size: Dimensions.FontSize.Map.note).weight(.regular) + } + return Font.libertinus(size: Dimensions.FontSize.Map.note).weight(.regular) + } + + static var axisLabel: Font { + if UserDefaults.standard.bool(forKey: "useCustomFont"), + let customFontName = UserDefaults.standard.string(forKey: "customFontName"), + !customFontName.isEmpty { + return Font.custom(customFontName, size: Dimensions.FontSize.Map.axisLabel).weight(.regular) + } + return Font.libertinus(size: Dimensions.FontSize.Map.axisLabel).weight(.regular) + } + + static var vertexLabel: Font { + if UserDefaults.standard.bool(forKey: "useCustomFont"), + let customFontName = UserDefaults.standard.string(forKey: "customFontName"), + !customFontName.isEmpty { + return Font.custom(customFontName, size: Dimensions.FontSize.Map.vertexLabel).weight(.regular) + } + return Font.libertinus(size: Dimensions.FontSize.Map.vertexLabel).weight(.regular) + } } } } |