fix: switch to XML font resources so Nunito/Lora render on first frame - #59
Merged
Merged
Conversation
The programmatic GoogleFont.Provider approach (ui-text-google-fonts) loads fonts asynchronously inside the Compose runtime and can silently fall back to the system font when GMS doesn't serve the font in time. Switching to per-weight XML font descriptors (res/font/*.xml) routes loading through ResourcesCompat, which the launcher pre-warms via the preloaded_fonts manifest declaration. Fonts are in the process cache before any Compose composition runs, so Nunito and Lora appear on the very first frame. Removes the ui-text-google-fonts dependency entirely; font_certs.xml is kept because the XML descriptors still reference com_google_android_gms_fonts_certs.
mapgie
marked this pull request as ready for review
June 21, 2026 15:39
This was referenced Sep 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Root cause
The programmatic
GoogleFont.Provider+Font(googleFont = ..., fontProvider = ...)approach fromui-text-google-fontsloads fonts asynchronously inside the Compose runtime. If GMS doesn't serve the font before the first composition completes (which is common — there is no guaranteed delivery window), the system fallback (Roboto) is used permanently with no visible error. This is exactly what v0.15 showed: everyheadlineLargetitle that should have been Lora 32sp SemiBold was rendering as Roboto.Fix
Replace the programmatic approach with per-weight XML font descriptors in
res/font/:Type.ktnow references these asFont(R.font.nunito_regular, FontWeight.Normal)etc., which routes font loading throughResourcesCompatinstead of the Compose runtime.ResourcesCompatis pre-warmed by the system launcher via the newpreloaded_fontsmanifest declaration, so by the time any Compose text renders the fonts are already in the process cache.Changes
app/src/main/res/font/— 6 new XML font descriptors (Nunito 400/500/600/700, Lora 500/600)app/src/main/res/values/preloaded_fonts.xml— array listing all 6 fonts for launcher pre-warmingapp/src/main/AndroidManifest.xml—<meta-data android:name="preloaded_fonts">inside<application>app/src/main/java/com/mapgie/dash/ui/theme/Type.kt— removedGoogleFont.Providersetup;NunitoandLoraFontFamilynow useFont(R.font.xxx)referencesapp/build.gradle.kts— removedimplementation(libs.androidx.ui.text.google.fonts)gradle/libs.versions.toml— removedandroidx-ui-text-google-fontsentryapp/.../licenses/LicensesScreen.kt— removed "AndroidX Compose UI Text (Google Fonts)" license entrychangelog/unreleased/font-consistency.json— patch fragmentTest plan
🤖 Generated with Claude Code
Generated by Claude Code