mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2024-11-26 18:21:00 +00:00
Font picker consistency (#960)
* Put SF Rounded into the popup menu with Hyperlegible & Dislexia * Remove SF Rounded Toggle
This commit is contained in:
parent
5057659cfc
commit
53f364b232
20 changed files with 30 additions and 24 deletions
|
@ -48,6 +48,8 @@ struct DisplaySettingsView: View {
|
|||
return FontState.openDyslexic
|
||||
} else if theme.chosenFont?.fontName == "AtkinsonHyperlegible-Regular" {
|
||||
return FontState.hyperLegible
|
||||
} else if theme.chosenFont?.fontName == ".AppleSystemUIFontRounded-Regular" {
|
||||
return FontState.SFRounded
|
||||
}
|
||||
return theme.chosenFontData != nil ? FontState.custom : FontState.system
|
||||
}, set: { newValue in
|
||||
|
@ -58,6 +60,8 @@ struct DisplaySettingsView: View {
|
|||
theme.chosenFont = UIFont(name: "OpenDyslexic", size: 1)
|
||||
case .hyperLegible:
|
||||
theme.chosenFont = UIFont(name: "Atkinson Hyperlegible", size: 1)
|
||||
case.SFRounded:
|
||||
theme.chosenFont = UIFont.systemFont(ofSize: 1).rounded()
|
||||
case .custom:
|
||||
isFontSelectorPresented = true
|
||||
}
|
||||
|
@ -68,9 +72,6 @@ struct DisplaySettingsView: View {
|
|||
}
|
||||
.navigationDestination(isPresented: $isFontSelectorPresented, destination: { FontPicker() })
|
||||
|
||||
Toggle("settings.display.font.rounded", isOn: $theme.useSFRoundedFont)
|
||||
.disabled(theme.chosenFont != nil)
|
||||
|
||||
VStack {
|
||||
Slider(value: $theme.fontSizeScale, in: 0.5 ... 1.5, step: 0.1)
|
||||
Text("settings.display.font.scaling-\(String(format: "%.1f", theme.fontSizeScale))")
|
||||
|
|
|
@ -186,7 +186,6 @@
|
|||
"settings.swipeactions.status.icon-style" = "Icon style";
|
||||
|
||||
"settings.display.section.font" = "Font";
|
||||
"settings.display.font.rounded" = "Use SF Rounded";
|
||||
|
||||
// MARK: Tabs
|
||||
"tab.explore" = "Exploreu";
|
||||
|
|
|
@ -184,7 +184,6 @@
|
|||
"settings.swipeactions.status.icon-style" = "Symbolstil";
|
||||
|
||||
"settings.display.section.font" = "Schriftart";
|
||||
"settings.display.font.rounded" = "SF Rounded verwenden";
|
||||
|
||||
"enum.expand-media.show" = "Alle zeigen";
|
||||
"enum.expand-media.hide" = "Alle ausblenden";
|
||||
|
|
|
@ -190,7 +190,6 @@
|
|||
"settings.swipeactions.status.icon-style" = "Icon style";
|
||||
|
||||
"settings.display.section.font" = "Font";
|
||||
"settings.display.font.rounded" = "Use SF Rounded";
|
||||
|
||||
// MARK: Tabs
|
||||
"tab.explore" = "Explore";
|
||||
|
|
|
@ -188,7 +188,6 @@
|
|||
"settings.swipeactions.status.icon-style" = "Icon style";
|
||||
|
||||
"settings.display.section.font" = "Font";
|
||||
"settings.display.font.rounded" = "Use SF Rounded";
|
||||
|
||||
// MARK: Tabs
|
||||
"tab.explore" = "Explore";
|
||||
|
|
|
@ -184,7 +184,6 @@
|
|||
"settings.swipeactions.status.icon-style" = "Estilo de icono";
|
||||
|
||||
"settings.display.section.font" = "Font";
|
||||
"settings.display.font.rounded" = "Use SF Rounded";
|
||||
|
||||
"enum.expand-media.show" = "Siempre";
|
||||
"enum.expand-media.hide" = "Nunca";
|
||||
|
|
|
@ -184,7 +184,6 @@
|
|||
"settings.swipeactions.status.icon-style" = "Ikonoen itxura";
|
||||
|
||||
"settings.display.section.font" = "Font";
|
||||
"settings.display.font.rounded" = "Use SF Rounded";
|
||||
|
||||
"enum.expand-media.show" = "Erakutsi guztia";
|
||||
"enum.expand-media.hide" = "Ezkutatu guztia";
|
||||
|
|
|
@ -187,7 +187,6 @@
|
|||
"settings.swipeactions.status.icon-style" = "Style de l'icône";
|
||||
|
||||
"settings.display.section.font" = "Police";
|
||||
"settings.display.font.rounded" = "Utiliser SF Rounded";
|
||||
|
||||
// MARK: Tabs
|
||||
"tab.explore" = "Explorer";
|
||||
|
|
|
@ -187,7 +187,6 @@
|
|||
"settings.swipeactions.status.icon-style" = "Stile delle icone";
|
||||
|
||||
"settings.display.section.font" = "Font";
|
||||
"settings.display.font.rounded" = "Use SF Rounded";
|
||||
|
||||
// MARK: Tabs
|
||||
"tab.explore" = "Esplora";
|
||||
|
|
|
@ -187,7 +187,6 @@
|
|||
"settings.swipeactions.status.icon-style" = "アイコンスタイル";
|
||||
|
||||
"settings.display.section.font" = "フォント";
|
||||
"settings.display.font.rounded" = "角丸SFを使用する";
|
||||
|
||||
// MARK: Tabs
|
||||
"tab.explore" = "探索";
|
||||
|
|
|
@ -187,7 +187,6 @@
|
|||
"settings.swipeactions.status.icon-style" = "아이콘 모양";
|
||||
|
||||
"settings.display.section.font" = "글꼴";
|
||||
"settings.display.font.rounded" = "SF Rounded 글꼴 사용";
|
||||
|
||||
// MARK: Tabs
|
||||
"tab.explore" = "둘러보기";
|
||||
|
|
|
@ -187,7 +187,6 @@
|
|||
"settings.swipeactions.status.icon-style" = "Icon style";
|
||||
|
||||
"settings.display.section.font" = "Font";
|
||||
"settings.display.font.rounded" = "Use SF Rounded";
|
||||
|
||||
// MARK: Tabs
|
||||
"tab.explore" = "Utforsk";
|
||||
|
|
|
@ -184,7 +184,6 @@
|
|||
"settings.swipeactions.status.icon-style" = "Symboolstijl";
|
||||
|
||||
"settings.display.section.font" = "Lettertype";
|
||||
"settings.display.font.rounded" = "Gebruik SF Rounded";
|
||||
|
||||
// MARK: Tabs
|
||||
"tab.explore" = "Ontdekken";
|
||||
|
|
|
@ -187,7 +187,6 @@
|
|||
"settings.swipeactions.status.icon-style" = "Styl ikony";
|
||||
|
||||
"settings.display.section.font" = "Czcionka";
|
||||
"settings.display.font.rounded" = "Użyj czcionkę SF Rounded";
|
||||
|
||||
// MARK: Tabs
|
||||
"tab.explore" = "Odkrywaj";
|
||||
|
|
|
@ -187,7 +187,6 @@
|
|||
"settings.swipeactions.status.icon-style" = "Icon style";
|
||||
|
||||
"settings.display.section.font" = "Font";
|
||||
"settings.display.font.rounded" = "Use SF Rounded";
|
||||
|
||||
// MARK: Tabs
|
||||
"tab.explore" = "Explorar";
|
||||
|
|
|
@ -187,7 +187,6 @@
|
|||
"settings.swipeactions.status.icon-style" = "Icon style";
|
||||
|
||||
"settings.display.section.font" = "Font";
|
||||
"settings.display.font.rounded" = "Use SF Rounded";
|
||||
|
||||
// MARK: Tabs
|
||||
"tab.explore" = "Keşfet";
|
||||
|
|
|
@ -185,7 +185,6 @@
|
|||
"settings.swipeactions.status.icon-style" = "图标样式";
|
||||
|
||||
"settings.display.section.font" = "字体";
|
||||
"settings.display.font.rounded" = "使用 SF Rounded 字体";
|
||||
|
||||
// MARK: Tabs
|
||||
"tab.explore" = "探索";
|
||||
|
|
|
@ -15,18 +15,23 @@ public extension Font {
|
|||
private static let onMac = ProcessInfo.processInfo.isiOSAppOnMac
|
||||
|
||||
private static func customFont(size: CGFloat, relativeTo textStyle: TextStyle) -> Font {
|
||||
|
||||
if let chosenFont = Theme.shared.chosenFont {
|
||||
if chosenFont.fontName == ".AppleSystemUIFontRounded-Regular" {
|
||||
return .system(size: size, design: .rounded)
|
||||
}
|
||||
else {
|
||||
return .custom(chosenFont.fontName, size: size, relativeTo: textStyle)
|
||||
}
|
||||
}
|
||||
|
||||
return .system(size: size, design: Theme.shared.useSFRoundedFont ? .rounded : .default)
|
||||
return .system(size: size, design: .default)
|
||||
}
|
||||
|
||||
private static func customUIFont(size: CGFloat) -> UIFont {
|
||||
if let chosenFont = Theme.shared.chosenFont {
|
||||
return chosenFont.withSize(size)
|
||||
}
|
||||
|
||||
return .systemFont(ofSize: size)
|
||||
}
|
||||
|
||||
|
@ -66,3 +71,14 @@ public extension Font {
|
|||
customFont(size: userScaledFontSize(baseSize: caption), relativeTo: .caption)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
extension UIFont {
|
||||
public func rounded() -> UIFont {
|
||||
guard let descriptor = fontDescriptor.withDesign(.rounded) else {
|
||||
return self
|
||||
}
|
||||
return UIFont(descriptor: descriptor, size: pointSize)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@ public class Theme: ObservableObject {
|
|||
case system
|
||||
case openDyslexic
|
||||
case hyperLegible
|
||||
case SFRounded
|
||||
case custom
|
||||
|
||||
@MainActor
|
||||
|
@ -25,6 +26,8 @@ public class Theme: ObservableObject {
|
|||
return "Open Dyslexic"
|
||||
case .hyperLegible:
|
||||
return "Hyper Legible"
|
||||
case .SFRounded:
|
||||
return "SF Rounded"
|
||||
case .custom:
|
||||
return "settings.display.font.custom"
|
||||
}
|
||||
|
@ -118,7 +121,6 @@ public class Theme: ObservableObject {
|
|||
@AppStorage(ThemeKey.displayFullUsernameTimeline.rawValue) public var displayFullUsername: Bool = true
|
||||
@AppStorage("font_size_scale") public var fontSizeScale: Double = 1
|
||||
@AppStorage("chosen_font") public private(set) var chosenFontData: Data?
|
||||
@AppStorage("font_use_sf_rounded") public var useSFRoundedFont = false
|
||||
|
||||
@Published public var avatarPosition: AvatarPosition = .top
|
||||
@Published public var avatarShape: AvatarShape = .rounded
|
||||
|
|
|
@ -134,3 +134,6 @@ public class UserPreferences: ObservableObject {
|
|||
recentlyUsedLanguages = Array(copy.prefix(3))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue