mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2025-02-02 07:36:45 +01:00
Properly support OpenDyslexic and HyperLegible Fix #677
This commit is contained in:
parent
3c9b0af3dd
commit
ff570e214c
@ -35,12 +35,21 @@ struct DisplaySettingsView: View {
|
|||||||
.listRowBackground(theme.primaryBackgroundColor)
|
.listRowBackground(theme.primaryBackgroundColor)
|
||||||
|
|
||||||
Section("settings.display.section.display") {
|
Section("settings.display.section.display") {
|
||||||
Picker("settings.display.font", selection: .init(get: {
|
Picker("settings.display.font", selection: .init(get: { () -> FontState in
|
||||||
userPreferences.chosenFontData != nil ? FontState.custom : FontState.system
|
if userPreferences.chosenFont?.fontName == "OpenDyslexic-Regular" {
|
||||||
|
return FontState.openDyslexic
|
||||||
|
} else if userPreferences.chosenFont?.fontName == "AtkinsonHyperlegible-Regular" {
|
||||||
|
return FontState.hyperLegible
|
||||||
|
}
|
||||||
|
return userPreferences.chosenFontData != nil ? FontState.custom : FontState.system
|
||||||
}, set: { newValue in
|
}, set: { newValue in
|
||||||
switch newValue {
|
switch newValue {
|
||||||
case .system:
|
case .system:
|
||||||
userPreferences.chosenFont = nil
|
userPreferences.chosenFont = nil
|
||||||
|
case .openDyslexic:
|
||||||
|
userPreferences.chosenFont = UIFont(name: "OpenDyslexic", size: 1)
|
||||||
|
case .hyperLegible:
|
||||||
|
userPreferences.chosenFont = UIFont(name: "Atkinson Hyperlegible", size: 1)
|
||||||
case .custom:
|
case .custom:
|
||||||
isFontSelectorPresented = true
|
isFontSelectorPresented = true
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,8 @@ public class Theme: ObservableObject {
|
|||||||
|
|
||||||
public enum FontState: Int, CaseIterable {
|
public enum FontState: Int, CaseIterable {
|
||||||
case system
|
case system
|
||||||
|
case openDyslexic
|
||||||
|
case hyperLegible
|
||||||
case custom
|
case custom
|
||||||
|
|
||||||
@MainActor
|
@MainActor
|
||||||
@ -18,6 +20,10 @@ public class Theme: ObservableObject {
|
|||||||
switch self {
|
switch self {
|
||||||
case .system:
|
case .system:
|
||||||
return "settings.display.font.system"
|
return "settings.display.font.system"
|
||||||
|
case .openDyslexic:
|
||||||
|
return "Open Dyslexic"
|
||||||
|
case .hyperLegible:
|
||||||
|
return "Hyper Legible"
|
||||||
case .custom:
|
case .custom:
|
||||||
return "settings.display.font.custom"
|
return "settings.display.font.custom"
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user