Skip to content

Register a watchface's bundled fonts at runtime - #288

Open
moWerk wants to merge 1 commit into
AsteroidOS:masterfrom
moWerk:watchface-cache-reload
Open

moWerk wants to merge 1 commit into
AsteroidOS:masterfrom
moWerk:watchface-cache-reload

Conversation

@moWerk

@moWerk moWerk commented Jul 31, 2026

Copy link
Copy Markdown
Member

Registers a watchface's bundled fonts into the running launcher at runtime, so a face installed by the store renders with its bundled family immediately — no fc-cache run, no session restart.

Fonts already in the user font folder are registered at startup too: they exist only there, and fontconfig knows them only after an fc-cache run that nothing guarantees has happened (a freshly flashed device never ran one), so store faces would otherwise render with fallback fonts after any session restart. Folder changes are routed: a watchface change drops the QML component cache and reloads, as before, while font-folder churn no longer tears down the active face and a watchface install no longer pays a font scan. The registry tracks path, font id, size and mtime, so a font replaced in place re-registers, a removed face's font releases its database entry, and a file that repeatedly fails to load stops being retried once its attempt budget is spent. A short settle re-scan covers external writers (adb, scp) whose in-place writes can be caught mid-file; store installs write atomically and never need it.

Part of the watchface store set (AsteroidOS/unofficial-watchfaces#44); asteroid-settings#145 builds on this.

This was executed by an LLM under my direction. I have fully understood and take authorship of the changes.

Extend WatchfaceReloader to also watch the user font folder and load
each font it finds with QFontDatabase::addApplicationFont(), so a face
installed by the store renders with its bundled family immediately, with
no fc-cache run and no session restart.

Fonts already on disk are registered at startup too: they exist only in
the user folder, and fontconfig knows them only after an fc-cache run
nothing guarantees has happened (a freshly flashed device never ran
one), so recording them without registering would leave every store
face on fallback fonts after a session restart.

Changes are routed by folder. A watchface change drops the component
cache and reloads, as before; font-folder churn no longer triggers that
teardown, and a watchface install no longer pays a font scan. The
registry keys path to font id with size and mtime, so a file replaced
in place re-registers, a vanished file releases its database entry, and
a file that repeatedly fails to load stops being retried once its
attempt budget is spent. A short settle re-scan remains for external
writers (adb, scp) whose in-place writes can be caught mid-file; store
installs write atomically and never need it.
@moWerk
moWerk force-pushed the watchface-cache-reload branch from 6c3ad83 to 8144d9d Compare August 6, 2026 23:01
@moWerk
moWerk marked this pull request as ready for review August 8, 2026 20:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant