mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2024-11-14 05:21:12 +00:00
Enable font scaling on iOS
This commit is contained in:
parent
0a0e985e33
commit
22af2db36c
2 changed files with 6 additions and 12 deletions
|
@ -71,12 +71,10 @@ struct DisplaySettingsView: View {
|
||||||
Text(buttonStyle.description).tag(buttonStyle)
|
Text(buttonStyle.description).tag(buttonStyle)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ProcessInfo.processInfo.isiOSAppOnMac {
|
VStack {
|
||||||
VStack {
|
Slider(value: $userPreferences.fontSizeScale, in: 0.5 ... 1.5, step: 0.1)
|
||||||
Slider(value: $userPreferences.fontSizeScale, in: 0.5 ... 1.5, step: 0.1)
|
Text("Font scaling: \(String(format: "%.1f", userPreferences.fontSizeScale))")
|
||||||
Text("Font scaling: \(String(format: "%.1f", userPreferences.fontSizeScale))")
|
.font(.scaledBody)
|
||||||
.font(.scaledBody)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Toggle("settings.display.translate-button", isOn: $userPreferences.showTranslateButton)
|
Toggle("settings.display.translate-button", isOn: $userPreferences.showTranslateButton)
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ public extension Font {
|
||||||
return .custom(chosenFont.fontName, size: size, relativeTo: textStyle)
|
return .custom(chosenFont.fontName, size: size, relativeTo: textStyle)
|
||||||
}
|
}
|
||||||
|
|
||||||
return onMac ? .system(size: size) : .system(textStyle)
|
return .system(size: size)
|
||||||
}
|
}
|
||||||
|
|
||||||
private static func customUIFont(size: CGFloat) -> UIFont {
|
private static func customUIFont(size: CGFloat) -> UIFont {
|
||||||
|
@ -31,11 +31,7 @@ public extension Font {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static func userScaledFontSize(baseSize: CGFloat) -> CGFloat {
|
private static func userScaledFontSize(baseSize: CGFloat) -> CGFloat {
|
||||||
if onMac {
|
UIFontMetrics.default.scaledValue(for: baseSize * UserPreferences.shared.fontSizeScale)
|
||||||
return UIFontMetrics.default.scaledValue(for: baseSize * UserPreferences.shared.fontSizeScale)
|
|
||||||
}
|
|
||||||
|
|
||||||
return baseSize
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static var scaledTitle: Font {
|
static var scaledTitle: Font {
|
||||||
|
|
Loading…
Reference in a new issue