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)
Section("settings.display.section.display") {
Section("settings.display.section.font") {
Picker("settings.display.font", selection: .init(get: { () -> FontState in
if userPreferences.chosenFont?.fontName == "OpenDyslexic-Regular" {
return FontState.openDyslexic
@ -67,6 +67,22 @@ struct DisplaySettingsView: View {
}
}
.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) {
ForEach(Theme.AvatarPosition.allCases, id: \.rawValue) { position in
Text(position.description).tag(position)
@ -88,14 +104,6 @@ struct DisplaySettingsView: View {
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)
}
.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.icon-style" = "Icon style";
"settings.display.section.font" = "Font";
"settings.display.font.rounded" = "Use SF Rounded";
// MARK: Tabs
"tab.explore" = "Exploreu";
"tab.federated" = "Federat";

View File

@ -182,6 +182,9 @@
"settings.swipeactions.status.use-theme-colors" = "Farbschema anstelle der Standardfarben verwenden";
"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.hide" = "Alle 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.icon-style" = "Icon style";
"settings.display.section.font" = "Font";
"settings.display.font.rounded" = "Use SF Rounded";
// MARK: Tabs
"tab.explore" = "Explore";
"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.icon-style" = "Icon style";
"settings.display.section.font" = "Font";
"settings.display.font.rounded" = "Use SF Rounded";
// MARK: Tabs
"tab.explore" = "Explore";
"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.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";
"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.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";
"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.icon-style" = "Icon style";
"settings.display.section.font" = "Font";
"settings.display.font.rounded" = "Use SF Rounded";
// MARK: Tabs
"tab.explore" = "Explorer";
"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.icon-style" = "Stile delle icone";
"settings.display.section.font" = "Font";
"settings.display.font.rounded" = "Use SF Rounded";
// MARK: Tabs
"tab.explore" = "Esplora";
"tab.federated" = "Federazione";

View File

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

View File

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

View File

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

View File

@ -182,6 +182,9 @@
"settings.swipeactions.status.use-theme-colors" = "Gebruik themakleuren in plaats van standaardkleuren";
"settings.swipeactions.status.icon-style" = "Symboolstijl";
"settings.display.section.font" = "Font";
"settings.display.font.rounded" = "Use SF Rounded";
// MARK: Tabs
"tab.explore" = "Ontdekken";
"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.icon-style" = "Styl ikony";
"settings.display.section.font" = "Font";
"settings.display.font.rounded" = "Use SF Rounded";
// MARK: Tabs
"tab.explore" = "Odkrywaj";
"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.icon-style" = "Icon style";
"settings.display.section.font" = "Font";
"settings.display.font.rounded" = "Use SF Rounded";
// MARK: Tabs
"tab.explore" = "Explorar";
"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.icon-style" = "Icon style";
"settings.display.section.font" = "Font";
"settings.display.font.rounded" = "Use SF Rounded";
// MARK: Tabs
"tab.explore" = "Keşfet";
"tab.federated" = "Birleştirilmiş";

View File

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

View File

@ -19,7 +19,7 @@ public extension Font {
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 {

View File

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