Add a setting to use SF Rounded font close #890

This commit is contained in:
Thomas Ricouard 2023-02-15 20:03:31 +01:00
parent ba7b76f5a1
commit 6c6d25fc63
19 changed files with 68 additions and 10 deletions

View file

@ -42,7 +42,7 @@ struct DisplaySettingsView: View {
} }
.listRowBackground(theme.primaryBackgroundColor) .listRowBackground(theme.primaryBackgroundColor)
Section("settings.display.section.display") { Section("settings.display.section.font") {
Picker("settings.display.font", selection: .init(get: { () -> FontState in Picker("settings.display.font", selection: .init(get: { () -> FontState in
if userPreferences.chosenFont?.fontName == "OpenDyslexic-Regular" { if userPreferences.chosenFont?.fontName == "OpenDyslexic-Regular" {
return FontState.openDyslexic return FontState.openDyslexic
@ -67,6 +67,22 @@ struct DisplaySettingsView: View {
} }
} }
.navigationDestination(isPresented: $isFontSelectorPresented, destination: { FontPicker() }) .navigationDestination(isPresented: $isFontSelectorPresented, destination: { FontPicker() })
Toggle("settings.display.font.rounded", isOn: $userPreferences.useSFRoundedFont)
.disabled(userPreferences.chosenFont != nil)
VStack {
Slider(value: $userPreferences.fontSizeScale, in: 0.5 ... 1.5, step: 0.1)
Text("settings.display.font.scaling-\(String(format: "%.1f", userPreferences.fontSizeScale))")
.font(.scaledBody)
}
.alignmentGuide(.listRowSeparatorLeading) { d in
d[.leading]
}
}
.listRowBackground(theme.primaryBackgroundColor)
Section("settings.display.section.display") {
Picker("settings.display.avatar.position", selection: $theme.avatarPosition) { Picker("settings.display.avatar.position", selection: $theme.avatarPosition) {
ForEach(Theme.AvatarPosition.allCases, id: \.rawValue) { position in ForEach(Theme.AvatarPosition.allCases, id: \.rawValue) { position in
Text(position.description).tag(position) Text(position.description).tag(position)
@ -88,14 +104,6 @@ struct DisplaySettingsView: View {
Text(buttonStyle.description).tag(buttonStyle) Text(buttonStyle.description).tag(buttonStyle)
} }
} }
VStack {
Slider(value: $userPreferences.fontSizeScale, in: 0.5 ... 1.5, step: 0.1)
Text("settings.display.font.scaling-\(String(format: "%.1f", userPreferences.fontSizeScale))")
.font(.scaledBody)
}
.alignmentGuide(.listRowSeparatorLeading) { d in
d[.leading]
}
Toggle("settings.display.translate-button", isOn: $userPreferences.showTranslateButton) Toggle("settings.display.translate-button", isOn: $userPreferences.showTranslateButton)
} }
.listRowBackground(theme.primaryBackgroundColor) .listRowBackground(theme.primaryBackgroundColor)

View file

@ -184,6 +184,9 @@
"settings.swipeactions.status.use-theme-colors" = "Use theme colors instead of default colors"; "settings.swipeactions.status.use-theme-colors" = "Use theme colors instead of default colors";
"settings.swipeactions.status.icon-style" = "Icon style"; "settings.swipeactions.status.icon-style" = "Icon style";
"settings.display.section.font" = "Font";
"settings.display.font.rounded" = "Use SF Rounded";
// MARK: Tabs // MARK: Tabs
"tab.explore" = "Exploreu"; "tab.explore" = "Exploreu";
"tab.federated" = "Federat"; "tab.federated" = "Federat";

View file

@ -182,6 +182,9 @@
"settings.swipeactions.status.use-theme-colors" = "Farbschema anstelle der Standardfarben verwenden"; "settings.swipeactions.status.use-theme-colors" = "Farbschema anstelle der Standardfarben verwenden";
"settings.swipeactions.status.icon-style" = "Symbolstil"; "settings.swipeactions.status.icon-style" = "Symbolstil";
"settings.display.section.font" = "Font";
"settings.display.font.rounded" = "Use SF Rounded";
"enum.expand-media.show" = "Alle zeigen"; "enum.expand-media.show" = "Alle zeigen";
"enum.expand-media.hide" = "Alle ausblenden"; "enum.expand-media.hide" = "Alle ausblenden";
"enum.expand-media.hide-sensitive" = "Sensible ausblenden"; "enum.expand-media.hide-sensitive" = "Sensible ausblenden";

View file

@ -188,6 +188,9 @@
"settings.swipeactions.status.use-theme-colors" = "Use theme colors instead of default colors"; "settings.swipeactions.status.use-theme-colors" = "Use theme colors instead of default colors";
"settings.swipeactions.status.icon-style" = "Icon style"; "settings.swipeactions.status.icon-style" = "Icon style";
"settings.display.section.font" = "Font";
"settings.display.font.rounded" = "Use SF Rounded";
// MARK: Tabs // MARK: Tabs
"tab.explore" = "Explore"; "tab.explore" = "Explore";
"tab.federated" = "Federated"; "tab.federated" = "Federated";

View file

@ -186,6 +186,9 @@
"settings.swipeactions.status.use-theme-colors" = "Use theme colors instead of default colors"; "settings.swipeactions.status.use-theme-colors" = "Use theme colors instead of default colors";
"settings.swipeactions.status.icon-style" = "Icon style"; "settings.swipeactions.status.icon-style" = "Icon style";
"settings.display.section.font" = "Font";
"settings.display.font.rounded" = "Use SF Rounded";
// MARK: Tabs // MARK: Tabs
"tab.explore" = "Explore"; "tab.explore" = "Explore";
"tab.federated" = "Federated"; "tab.federated" = "Federated";

View file

@ -182,6 +182,9 @@
"settings.swipeactions.status.use-theme-colors" = "Usar colores del tema en lugar de los colores por defecto"; "settings.swipeactions.status.use-theme-colors" = "Usar colores del tema en lugar de los colores por defecto";
"settings.swipeactions.status.icon-style" = "Estilo de icono"; "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.show" = "Siempre";
"enum.expand-media.hide" = "Nunca"; "enum.expand-media.hide" = "Nunca";
"enum.expand-media.hide-sensitive" = "Ocultar contenido sensible"; "enum.expand-media.hide-sensitive" = "Ocultar contenido sensible";

View file

@ -182,6 +182,9 @@
"settings.swipeactions.status.use-theme-colors" = "Erabili hautatutako kolorea defektuzko koloreen ordez"; "settings.swipeactions.status.use-theme-colors" = "Erabili hautatutako kolorea defektuzko koloreen ordez";
"settings.swipeactions.status.icon-style" = "Ikonoen itxura"; "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.show" = "Erakutsi guztia";
"enum.expand-media.hide" = "Ezkutatu guztia"; "enum.expand-media.hide" = "Ezkutatu guztia";
"enum.expand-media.hide-sensitive" = "Ezkutatu hunkigarria"; "enum.expand-media.hide-sensitive" = "Ezkutatu hunkigarria";

View file

@ -185,6 +185,9 @@
"settings.swipeactions.status.use-theme-colors" = "Use theme colors instead of default colors"; "settings.swipeactions.status.use-theme-colors" = "Use theme colors instead of default colors";
"settings.swipeactions.status.icon-style" = "Icon style"; "settings.swipeactions.status.icon-style" = "Icon style";
"settings.display.section.font" = "Font";
"settings.display.font.rounded" = "Use SF Rounded";
// MARK: Tabs // MARK: Tabs
"tab.explore" = "Explorer"; "tab.explore" = "Explorer";
"tab.federated" = "Fédéré"; "tab.federated" = "Fédéré";

View file

@ -185,6 +185,9 @@
"settings.swipeactions.status.use-theme-colors" = "Usa i colori del tema al posto dei colori di default"; "settings.swipeactions.status.use-theme-colors" = "Usa i colori del tema al posto dei colori di default";
"settings.swipeactions.status.icon-style" = "Stile delle icone"; "settings.swipeactions.status.icon-style" = "Stile delle icone";
"settings.display.section.font" = "Font";
"settings.display.font.rounded" = "Use SF Rounded";
// MARK: Tabs // MARK: Tabs
"tab.explore" = "Esplora"; "tab.explore" = "Esplora";
"tab.federated" = "Federazione"; "tab.federated" = "Federazione";

View file

@ -185,6 +185,9 @@
"settings.swipeactions.status.use-theme-colors" = "デフォルトの色の代わりにテーマの色を使用する"; "settings.swipeactions.status.use-theme-colors" = "デフォルトの色の代わりにテーマの色を使用する";
"settings.swipeactions.status.icon-style" = "アイコンスタイル"; "settings.swipeactions.status.icon-style" = "アイコンスタイル";
"settings.display.section.font" = "Font";
"settings.display.font.rounded" = "Use SF Rounded";
// MARK: Tabs // MARK: Tabs
"tab.explore" = "エクスプローラー"; "tab.explore" = "エクスプローラー";
"tab.federated" = "連合"; "tab.federated" = "連合";

View file

@ -185,6 +185,9 @@
"settings.swipeactions.status.use-theme-colors" = "기본 색상 대신 테마 색상 사용"; "settings.swipeactions.status.use-theme-colors" = "기본 색상 대신 테마 색상 사용";
"settings.swipeactions.status.icon-style" = "아이콘 모양"; "settings.swipeactions.status.icon-style" = "아이콘 모양";
"settings.display.section.font" = "Font";
"settings.display.font.rounded" = "Use SF Rounded";
// MARK: Tabs // MARK: Tabs
"tab.explore" = "둘러보기"; "tab.explore" = "둘러보기";
"tab.federated" = "연합"; "tab.federated" = "연합";

View file

@ -185,6 +185,9 @@
"settings.swipeactions.status.use-theme-colors" = "Use theme colors instead of default colors"; "settings.swipeactions.status.use-theme-colors" = "Use theme colors instead of default colors";
"settings.swipeactions.status.icon-style" = "Icon style"; "settings.swipeactions.status.icon-style" = "Icon style";
"settings.display.section.font" = "Font";
"settings.display.font.rounded" = "Use SF Rounded";
// MARK: Tabs // MARK: Tabs
"tab.explore" = "Utforsk"; "tab.explore" = "Utforsk";
"tab.federated" = "Federert"; "tab.federated" = "Federert";

View file

@ -182,6 +182,9 @@
"settings.swipeactions.status.use-theme-colors" = "Gebruik themakleuren in plaats van standaardkleuren"; "settings.swipeactions.status.use-theme-colors" = "Gebruik themakleuren in plaats van standaardkleuren";
"settings.swipeactions.status.icon-style" = "Symboolstijl"; "settings.swipeactions.status.icon-style" = "Symboolstijl";
"settings.display.section.font" = "Font";
"settings.display.font.rounded" = "Use SF Rounded";
// MARK: Tabs // MARK: Tabs
"tab.explore" = "Ontdekken"; "tab.explore" = "Ontdekken";
"tab.federated" = "Gefedereerd"; "tab.federated" = "Gefedereerd";

View file

@ -185,6 +185,9 @@
"settings.swipeactions.status.use-theme-colors" = "Używaj kolorów motywu zamiast kolorów domyślnych"; "settings.swipeactions.status.use-theme-colors" = "Używaj kolorów motywu zamiast kolorów domyślnych";
"settings.swipeactions.status.icon-style" = "Styl ikony"; "settings.swipeactions.status.icon-style" = "Styl ikony";
"settings.display.section.font" = "Font";
"settings.display.font.rounded" = "Use SF Rounded";
// MARK: Tabs // MARK: Tabs
"tab.explore" = "Odkrywaj"; "tab.explore" = "Odkrywaj";
"tab.federated" = "Globalny"; "tab.federated" = "Globalny";

View file

@ -185,6 +185,9 @@
"settings.swipeactions.status.use-theme-colors" = "Use theme colors instead of default colors"; "settings.swipeactions.status.use-theme-colors" = "Use theme colors instead of default colors";
"settings.swipeactions.status.icon-style" = "Icon style"; "settings.swipeactions.status.icon-style" = "Icon style";
"settings.display.section.font" = "Font";
"settings.display.font.rounded" = "Use SF Rounded";
// MARK: Tabs // MARK: Tabs
"tab.explore" = "Explorar"; "tab.explore" = "Explorar";
"tab.federated" = "Linha global"; "tab.federated" = "Linha global";

View file

@ -185,6 +185,9 @@
"settings.swipeactions.status.use-theme-colors" = "Use theme colors instead of default colors"; "settings.swipeactions.status.use-theme-colors" = "Use theme colors instead of default colors";
"settings.swipeactions.status.icon-style" = "Icon style"; "settings.swipeactions.status.icon-style" = "Icon style";
"settings.display.section.font" = "Font";
"settings.display.font.rounded" = "Use SF Rounded";
// MARK: Tabs // MARK: Tabs
"tab.explore" = "Keşfet"; "tab.explore" = "Keşfet";
"tab.federated" = "Birleştirilmiş"; "tab.federated" = "Birleştirilmiş";

View file

@ -185,6 +185,9 @@
"settings.swipeactions.status.use-theme-colors" = "使用主题色而不是默认色"; "settings.swipeactions.status.use-theme-colors" = "使用主题色而不是默认色";
"settings.swipeactions.status.icon-style" = "图标样式"; "settings.swipeactions.status.icon-style" = "图标样式";
"settings.display.section.font" = "Font";
"settings.display.font.rounded" = "Use SF Rounded";
// MARK: Tabs // MARK: Tabs
"tab.explore" = "探索"; "tab.explore" = "探索";
"tab.federated" = "跨站"; "tab.federated" = "跨站";

View file

@ -19,7 +19,7 @@ public extension Font {
return .custom(chosenFont.fontName, size: size, relativeTo: textStyle) return .custom(chosenFont.fontName, size: size, relativeTo: textStyle)
} }
return .system(size: size) return .system(size: size, design: UserPreferences.shared.useSFRoundedFont ? .rounded : .default)
} }
private static func customUIFont(size: CGFloat) -> UIFont { private static func customUIFont(size: CGFloat) -> UIFont {

View file

@ -47,6 +47,8 @@ public class UserPreferences: ObservableObject {
@AppStorage("swipeactions-status-leading-right") public var swipeActionsStatusLeadingRight = StatusAction.none @AppStorage("swipeactions-status-leading-right") public var swipeActionsStatusLeadingRight = StatusAction.none
@AppStorage("swipeactions-use-theme-color") public var swipeActionsUseThemeColor = false @AppStorage("swipeactions-use-theme-color") public var swipeActionsUseThemeColor = false
@AppStorage("swipeactions-icon-style") public var swipeActionsIconStyle: SwipeActionsIconStyle = .iconWithText @AppStorage("swipeactions-icon-style") public var swipeActionsIconStyle: SwipeActionsIconStyle = .iconWithText
@AppStorage("font_use_sf_rounded") public var useSFRoundedFont = false
public enum SwipeActionsIconStyle: String, CaseIterable { public enum SwipeActionsIconStyle: String, CaseIterable {
case iconWithText, iconOnly case iconWithText, iconOnly