Skip to content

Fix font fallback by computing map_len in fill_cluster_in_place#566

Open
devunt wants to merge 1 commit intolinebender:mainfrom
devunt:fix/font-fallback-map-len
Open

Fix font fallback by computing map_len in fill_cluster_in_place#566
devunt wants to merge 1 commit intolinebender:mainfrom
devunt:fix/font-fallback-map-len

Conversation

@devunt
Copy link
Contributor

@devunt devunt commented Feb 27, 2026

char_cluster.map_len is hardcoded to 0, which causes Mapper::map() to short-circuit and return 1.0 (complete match) for every font candidate. This effectively disables all font fallback, as the first candidate always wins regardless of actual glyph coverage. For example, emoji sequences are shaped with the primary text font, producing .notdef glyphs instead of falling back to an emoji font.

This fix computes map_len as the count of characters where contributes_to_shaping is true, matching the semantics expected by Mapper::map().

map_len was hardcoded to 0, which caused Mapper::map() to
short-circuit and return 1.0 (complete match) for every font
candidate. This effectively disabled all font fallback — the first
candidate always won regardless of actual glyph coverage. Emoji
sequences, for example, would be shaped with the primary text font
(.notdef glyphs) instead of falling back to an emoji font.

Compute map_len as the count of characters where
contributes_to_shaping is true, matching the semantics expected by
Mapper::map().
@nicoburns nicoburns requested review from conor-93 and taj-p February 27, 2026 11:24
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