From 69f8f7e81ca73ffbf1a0d76ccbd6cf8545caff57 Mon Sep 17 00:00:00 2001 From: Ruben Beltran del Rio Date: Mon, 7 Jul 2025 13:22:22 +0200 Subject: Add font customization --- Map/Presentation/Theme/Font+theme.swift | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) (limited to 'Map/Presentation/Theme') 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) + } } } } -- cgit