FontSize helper follows desktop text scale

This commit is contained in:
ZacharyZhang-NY committed 2026-10-05 12:25:48 -04:00
1 parent 9c4d1f236f
commit 81bec044df
3 files changed
+22 -4

No files matched your search

+9 -4
View File
@@ -82,10 +82,7 @@ func Use(c *ui.Context, s Settings) {
if p.HighContrast {
k = k.HighContrast()
}
size := theme.BodySize
if p.TextScale > 0 {
size *= p.TextScale
}
size := FontSize(c, theme.BodySize)
c.SetTheme(&ui.Theme{
Dark: k.Dark,
Background: k.Background,
@@ -134,3 +131,11 @@ func Motion(c *ui.Context, d time.Duration) time.Duration {
}
return d
}
// FontSize scales a design size by the desktop's text scale.
func FontSize(c *ui.Context, size float32) float32 {
if s := c.Preferences().TextScale; s > 0 {
return size * s
}
return size
}