MirrorBar Plus 11: fix clock font zone width so other fonts are centered
The measured clock width was a fixed pixel count, so the supersampled drawing pass used a zone half as wide as it needed. It is now stored at 96 dpi and scaled with the bar. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JW57Zw8fvgzpeDkbUYT7sG
This commit is contained in:
@@ -53,7 +53,7 @@ var (
|
|||||||
clockFontIx = 0
|
clockFontIx = 0
|
||||||
chargeIx = 0
|
chargeIx = 0
|
||||||
|
|
||||||
clockMeasured int32 // the width the time and date need in a font other than Segoe UI
|
clockMeasured float64 // the width the time and date need in a font other than Segoe UI, at 96 dpi so it scales with the bar
|
||||||
)
|
)
|
||||||
|
|
||||||
var logoStyleNames = []string{
|
var logoStyleNames = []string{
|
||||||
@@ -176,7 +176,7 @@ func clockPx() int {
|
|||||||
// clockWidth is the room the time and date need, which grows with the text.
|
// clockWidth is the room the time and date need, which grows with the text.
|
||||||
func clockWidth() int32 {
|
func clockWidth() int32 {
|
||||||
if clockFontIx > 0 && clockMeasured > 0 {
|
if clockFontIx > 0 && clockMeasured > 0 {
|
||||||
return clockMeasured + px(24)
|
return px(clockMeasured + 24)
|
||||||
}
|
}
|
||||||
w := 140.0 * float64(clockPx()) / 13.0
|
w := 140.0 * float64(clockPx()) / 13.0
|
||||||
if clockBold {
|
if clockBold {
|
||||||
@@ -201,7 +201,7 @@ func rebuildClockFonts() {
|
|||||||
scale *= superSample
|
scale *= superSample
|
||||||
fontTime2 = makeFontFace(face, px(float64(clockPx())), weight)
|
fontTime2 = makeFontFace(face, px(float64(clockPx())), weight)
|
||||||
scale /= superSample
|
scale /= superSample
|
||||||
clockMeasured = measureClockText()
|
clockMeasured = float64(measureClockText()) / scale
|
||||||
if oldA != 0 {
|
if oldA != 0 {
|
||||||
pDeleteObject.Call(oldA)
|
pDeleteObject.Call(oldA)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user