Signed-off-by: Matt Bruce <mbrucedogs@gmail.com>
This commit is contained in:
parent
3464cbeb17
commit
318701bb3d
@ -35,6 +35,15 @@ enum FontFamily: String, CaseIterable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var percentageDownsize: CGFloat {
|
||||||
|
switch self {
|
||||||
|
case .system:
|
||||||
|
return 0.99
|
||||||
|
case .georgia:
|
||||||
|
return 0.90
|
||||||
|
default: return 1
|
||||||
|
}
|
||||||
|
}
|
||||||
var fontWeights: [Font.Weight] {
|
var fontWeights: [Font.Weight] {
|
||||||
guard let weightDict = Self.fontMapWeights[self.rawValue] else {
|
guard let weightDict = Self.fontMapWeights[self.rawValue] else {
|
||||||
return []
|
return []
|
||||||
|
|||||||
@ -39,7 +39,7 @@ struct FontUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return low
|
return low * fontName.percentageDownsize
|
||||||
}
|
}
|
||||||
|
|
||||||
static func createFont(
|
static func createFont(
|
||||||
|
|||||||
@ -127,12 +127,9 @@ struct DigitView: View {
|
|||||||
for: size)
|
for: size)
|
||||||
|
|
||||||
// Only update if the size is significantly different to prevent micro-adjustments
|
// Only update if the size is significantly different to prevent micro-adjustments
|
||||||
if abs(optimalSize - fontSize) > 0.1 {
|
fontSize = optimalSize
|
||||||
fontSize = optimalSize
|
|
||||||
}
|
|
||||||
|
|
||||||
lastCalculatedSize = size
|
lastCalculatedSize = size
|
||||||
|
|
||||||
// Reset calculation flag after a brief delay to allow for frame completion
|
// Reset calculation flag after a brief delay to allow for frame completion
|
||||||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.016) { // ~60fps
|
DispatchQueue.main.asyncAfter(deadline: .now() + 0.016) { // ~60fps
|
||||||
isCalculating = false
|
isCalculating = false
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user