diff options
| author | Ruben Beltran del Rio <git@r.bdr.sh> | 2025-07-07 13:22:22 +0200 |
|---|---|---|
| committer | Ruben Beltran del Rio <git@r.bdr.sh> | 2025-07-07 13:22:22 +0200 |
| commit | 69f8f7e81ca73ffbf1a0d76ccbd6cf8545caff57 (patch) | |
| tree | 3797959be60d153be79a0abcf03f93e18e7eecc7 /Map/Presentation/Theme | |
| parent | 3fdaeab6a7fa19b0c5424de487efc37c0994c86e (diff) | |
Add font customization
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) + } } } } |