iris: resolve fontique's Android monospace generic family ourselves
fontique 0.11.1's Android backend never resolves GenericFamily::Monospace
(mono=None in the startup diagnostic, RUST.md's 2026-09-07 "Platform
fonts" gap): DEFAULT_GENERIC_FAMILIES looks up "monospace" against
name_map before fonts.xml is parsed into it, and even after parsing,
AOSP's fonts.xml names it with a <family name="monospace"> element whose
<font> children the backend's own parser never reads (a TODO left in
place) -- so the name gets a FamilyId with no font data behind it, and
family_by_name("monospace") comes back empty too. Confirmed still present
on linebender/parley's main branch, so there is no newer release to bump
to.
TextData::patch_android_monospace (Android-only, called from
TextData::default) reads fonts.xml's own "monospace" declaration for the
font filename it names, then finds which of fontique's actually-scanned
families owns a font file with that name and registers it as the
Monospace generic directly -- the same authority Compose's
Typeface.MONOSPACE resolves through, without pinning an OEM-specific
family name. Verified on this checkout's emulator:
mono=Some("Droid Sans Mono") in the startup log, and a screenshot showing
the bench-fixture's code block and tool-card values in a visibly
monospaced face beside sans body/heading text. Desktop's fontconfig
backend is unaffected.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
1 parent
84a13e806b
commit
7e4e26a335
2 files changed
+122
-16
No files matched your search
+22
-15
@@ -23,21 +23,28 @@ marked **DEFERRED** are ones the agent chose not to decide alone.
|
||||
tofu for a codepoint no resolved face has (checked with CJK + emoji on
|
||||
desktop) rather than blank space, so the UI_RULES unknown-glyph rule
|
||||
still holds.
|
||||
- **Flagging for Iris, not blocking on it**: this fontique version's
|
||||
Android backend never resolves the `Monospace` generic family at all
|
||||
(confirmed on this checkout's emulator, `mono=None` in the startup
|
||||
diagnostic) -- a pre-existing ordering bug in fontique's own
|
||||
`fonts.xml` parsing, not something this change introduced, but this
|
||||
change is what stopped masking it (the bundled mono font used to be
|
||||
registered ahead of the broken platform lookup, so it always won).
|
||||
Effect: code blocks and the tool-card chevron marks fall through to
|
||||
the same face as body text on Android instead of a genuinely
|
||||
monospaced one -- still visible, not blank, just not monospaced.
|
||||
Compose does not share this gap; it resolves `FontFamily.Monospace`
|
||||
through Android's own `Typeface.MONOSPACE`, not through fontique.
|
||||
docs/RUST.md's "Platform fonts (2026-09-07)" has the full account and
|
||||
why a fix (an OEM-specific named-family pin, or patching around
|
||||
fontique) is left as a follow-up rather than done in this pass.
|
||||
- **Gap found, then closed same day**: this fontique version's Android
|
||||
backend never resolved the `Monospace` generic family at all (confirmed
|
||||
on this checkout's emulator, `mono=None` in the startup diagnostic) --
|
||||
two pre-existing bugs in fontique's own `fonts.xml` parsing stacked (an
|
||||
ordering bug, and a `<family name="monospace">` declaration whose
|
||||
`<font>` children the backend's parser never reads), not something this
|
||||
change introduced, but this change is what stopped masking it (the
|
||||
bundled mono font used to be registered ahead of the broken platform
|
||||
lookup, so it always won). Checked `linebender/parley`'s `main` branch
|
||||
on GitHub: neither bug is fixed there, so there was no newer release to
|
||||
bump to. Fixed instead in `iris-core` itself
|
||||
(`TextData::patch_android_monospace`, Android-only): reads
|
||||
`/system/etc/fonts.xml`'s own `"monospace"` declaration for the font
|
||||
filename it names, then registers whichever of fontique's actually-
|
||||
scanned families owns that file as the `Monospace` generic -- the same
|
||||
authority Compose's `Typeface.MONOSPACE` resolves through, without
|
||||
pinning an OEM-specific family name. Verified on this checkout's
|
||||
emulator: `mono=Some("Droid Sans Mono")`, and a screenshot showing the
|
||||
bench-fixture's code block and tool-card values in a visibly monospaced
|
||||
face beside sans body text; the desktop `fontconfig` backend is
|
||||
unaffected (still resolves monospace correctly, confirmed unchanged).
|
||||
docs/RUST.md's "Platform fonts (2026-09-07)" has the full account.
|
||||
|
||||
## 2026-09-07 (how a phone log reaches Iris)
|
||||
|
||||
|
||||
Reference in new issue
Block a user