System default plus Inter, IBM Plex Sans, Source Sans 3 and Atkinson Hyperlegible Next (OFL 1.1, bundled as on-demand assets and loaded with FontLoader, so the web fetches only the previewed/chosen files). Stored in shared_preferences, applied live to Material and Cupertino text themes; RobotoMono styles unchanged. Licences registered with LicenseRegistry.
2.4 KiB
Interface font choice (per device)
Settings > Font offers System default (the default everywhere: Roboto on Android and the web, SF in the iOS app), Inter, IBM Plex Sans, Source Sans 3 and Atkinson Hyperlegible Next. Each option is named in its own face.
lib/ui/theme/app_font.dart: the options, stable stored ids and assets.lib/ui/theme/app_font_store.dart:shared_preferenceskeypipelines.next.font.v1, so the choice belongs to this device or browser and is never sent to the server.lib/ui/theme/app_font_controller.dart:AppFontController.instanceloads the chosen family with aFontLoaderand only then switches the theme (one switch, no reflow loop). Startup waits up to 1.5 s for a stored font beside the session load, then draws in the system font and applies the font when it lands. A failed load keeps the current face and says so.lib/ui/theme/app_theme.dart:appLightTheme/appDarkTheme({fontFamily})andappCupertinoThemeWith({fontFamily})replace only the family in every text role; sizes, weights and text scaling are unchanged. ExplicitappMonospaceFamily(RobotoMono) styles are untouched.MyAppand the onboarding host rebuild from the controller, so a choice applies immediately on Material and Cupertino hosts.lib/ui/theme/app_font_licenses.dart: eachfonts/<family>/OFL.txtis registered withLicenseRegistry. The app has no licence page of its own yet, so nothing shows them in the UI.
Web download cost
The families are plain assets:, not pubspec fonts: (the web engine fetches
every fonts: family at boot). Browser resource log on the fixture build:
startup fetches no optional font; opening Settings fetches each family's
Regular weight for the previews (65–431 KB each); choosing one fetches its
other three weights. A stored choice fetches only its four files at startup.
Build size (release web): main.dart.js 4,214,247 -> 4,232,251 bytes (+18 KB,
+5 KB gzip); build/web 43.6 -> 48.0 MB because the four families' 16 TTFs
(4.45 MB, 2.09 MB gzip) ship as on-demand assets. The APK grows by about the
same compressed amount (not measured).
Known gaps
- Chat markdown code blocks were already in the proportional UI face, not RobotoMono; they now follow the chosen font too.
- On the web Cupertino fixture, "System default" names an unregistered
CupertinoSystemTextfamily, which the browser engine substitutes.