Commit 2c86dce
authored
fix: reject fonts with reserved bit 7 in glyf simple glyph flags (#13144)
## Description
Reject fonts with reserved bit 7 set on simple glyph coordinate flags in
the `glyf` table. Some Linux fonts (notably DroidSansFallback.ttf from
`ttf-droid`) have this corruption — `skrifa`/`swash` correctly enforces
the spec and rejects all outlines, causing CJK glyphs to render as
`.notdef` squares.
Detection runs at font-load time using `fontdb::with_face_data` (reuses
fontdb's existing mmap; zero extra I/O for healthy fonts). Corrupted
faces are removed from the database so they can never be matched by
future fallback queries.
## Linked Issue
- [x] The linked issue is labeled `ready-to-spec` or
`ready-to-implement`.
- [x] Where appropriate, screenshots or a short video of the
implementation are included below (especially for user-visible or UI
changes).
Closes #9372.
## Testing
- [x] I have manually tested my changes locally with `./script/run`
Manual verification:
1. Confirmed `has_reserved_bit7_in_glyph_flags` returns `true` for
`DroidSansFallback.ttf` and `DroidSansFallbackFull.ttf`, `false` for
`DroidSansFallbackLegacy.ttf`.
2. Before fix: CJK characters routed to `DroidSansFallback.ttf` render
as empty.
3. After fix: same characters render correctly — the corrupted font is
skipped and fontconfig's next fallback is used.
Comparison: <img alt="Image" width="1475" height="839"
src="https://private-user-images.githubusercontent.com/55276797/615236233-ab006319-d211-4e00-bf5b-dece1b809504.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3ODI4NjA1NDIsIm5iZiI6MTc4Mjg2MDI0MiwicGF0aCI6Ii81NTI3Njc5Ny82MTUyMzYyMzMtYWIwMDYzMTktZDIxMS00ZTAwLWJmNWItZGVjZTFiODA5NTA0LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNjA2MzAlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjYwNjMwVDIyNTcyMlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWI2YWUzN2QzMThmZTQ1ZDg0MjUzMjQwMjRjOTJjZDZmYTExMTc5MmUzNjE1OGFhZjdkYzM4ZjJjNjMxNDczNTMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JnJlc3BvbnNlLWNvbnRlbnQtdHlwZT1pbWFnZSUyRnBuZyJ9.MHTiaqPevSXwACnHt4S8MghnRS2DteYjx4JH856aax0">
### **We can actually use DroidSansFallback.ttf but it requires some
hacky patching. If that is allowed then I will refactor this fix.**
## Agent Mode
- [ ] Warp Agent Mode - This PR was created via Warp's AI Agent Mode
## Changelog Entries for Stable
CHANGELOG-BUG-FIX: Reject fonts with corrupted glyf table (reserved bit
7 on simple glyph flags) that caused CJK glyphs to render as .notdef
squares on Linux
---------
Signed-off-by: FurryR <awathefox@gmail.com>1 parent 4bff3ba commit 2c86dce
1 file changed
Lines changed: 377 additions & 13 deletions
0 commit comments