Towards implementing beyond-64k glyphs in the font - #1901
Open
behdad wants to merge 6 commits into
Open
Conversation
behdad
force-pushed
the
beyond-64k
branch
3 times, most recently
from
June 9, 2026 12:52
2c26051 to
dfc7086
Compare
cmyr
reviewed
Jun 15, 2026
behdad
added a commit
that referenced
this pull request
Jun 16, 2026
Generated count expressions were casting field counts with `as usize` or emitting fallible conversions directly. Route those conversions through a shared `to_usize` helper in the generated-code preludes so the generated read and write tables avoid clippy noise while preserving the previous fallback behavior for failed conversions. This isolates the codegen-wide cleanup from the beyond-64k table schema changes in PR #1901. Tested with: - cargo fmt --all -- --check - cargo check -p read-fonts -p write-fonts - cargo +1.85 clippy -p read-fonts --all-features --all-targets -- -D warnings - cargo +1.85 clippy -p write-fonts --all-features --all-targets -- -D warnings Assisted-by: OpenAI Codex
Add CoverageFormat3 and CoverageFormat4 to the generated layout schema and generated read/write tables. Widen Coverage iteration and lookup results so high glyph IDs and 24-bit coverage indices are not truncated. Update write-fonts Coverage construction to choose between the dense format 3 and range-based format 4 encodings for high glyph IDs, while keeping the existing lower-format selection for 16-bit-only coverage. Teach codegen count expressions and generated array-length validation how to handle scalar count types such as Uint24. Update Coverage consumers for the widened index type, including VARC outline lookup, skera subset helpers, and otexplorer traversal display. Testing: - cargo check --workspace - cargo check --workspace --no-default-features - cargo test -p read-fonts --lib - cargo test -p write-fonts --lib - cargo test -p skera --lib - cargo test -p font-codegen Assisted-by: OpenAI Codex
Add ClassDef formats 3 and 4 from the beyond-64k layout data model. Format3 uses a 24-bit start glyph and count for dense class arrays, while Format4 uses 24-bit class range records. Wire the new formats through read helpers, lookup closure checks, write-side format selection, and skera subsetting of high input ClassDefs. Existing 16-bit builders continue to emit the lower formats when all glyphs fit. Tested with: - cargo check --workspace - cargo check --workspace --no-default-features - cargo test -p read-fonts --lib - cargo test -p write-fonts --lib - cargo test -p skera --lib - cargo test -p font-codegen Assisted-by: OpenAI Codex
Add private traits for the paired 16-bit and 24-bit Coverage and ClassDef formats, and route their shared lookup, intersection, cost, and population logic through common helper functions. The generated format types and public helper methods stay explicit; the concrete iterator methods remain local to preserve their lifetime shape. Tested with: - cargo test -p read-fonts --lib - cargo check --workspace - cargo check --workspace --no-default-features Assisted-by: OpenAI Codex
Keep helper traits for the larger ClassDef array and range algorithms, but restore explicit Coverage implementations where the trait indirection was more boilerplate than benefit. This keeps the beyond-64k format pairs consistent where the shared logic is substantial, while leaving simple Coverage code direct. Tested with: - cargo check -p read-fonts - cargo test -p read-fonts --lib - cargo check --workspace - cargo check --workspace --no-default-features Assisted-by: OpenAI Codex
Regenerate the generated read and write tables after the count conversion changes so CI's codegen check is clean. Route generated count conversions through generated-code prelude helpers instead of emitting usize::try_from directly. This preserves the checked conversion behavior for wide values while avoiding clippy's unnecessary_fallible_conversions lint for u8 and u16 count fields. Also remove redundant GlyphId::from calls in closure code now that Coverage iteration yields GlyphId directly. Tested with: - cargo fmt --all -- --check - cargo +1.85 clippy -p read-fonts --all-features --all-targets -- -D warnings - cargo +1.85 clippy -p write-fonts --all-features --all-targets -- -D warnings - cargo check --workspace - cargo check --workspace --no-default-features - cargo test -p read-fonts --lib Assisted-by: OpenAI Codex
Coverage and ClassDef iteration now yields GlyphId directly, so callers no longer need to convert iterated glyph ids before looking them up again. Remove the redundant conversions in skrifa and skera to satisfy the Rust 1.85 clippy legs. Tested with: - cargo fmt --all -- --check - cargo +1.85 clippy -p font-types --all-features --all-targets -- -D warnings - cargo +1.85 clippy -p read-fonts --all-features --all-targets -- -D warnings - cargo +1.85 clippy -p write-fonts --all-features --all-targets -- -D warnings - cargo +1.85 clippy -p skrifa --all-features --all-targets -- -D warnings - cargo +1.85 clippy -p skera --all-features --all-targets -- -D warnings - cargo +1.85 clippy -p fauntlet --all-features --all-targets -- -D warnings - cargo +1.85 clippy -p incremental-font-transfer --all-features --all-targets -- -D warnings - cargo check --workspace - cargo check --workspace --no-default-features - cargo test -p skera --all-targets --all-features Assisted-by: OpenAI Codex
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.
This just adds implementation of 24-bit GlyphIDs and Coverage/ClassDef's format 3 & 4.
First, new formats are done by duplication of the logic. Then a commit to use traits to merge the logic, but the trait commit adds more lines than it deletes. I'm concerned by the size of this change, which is a tiny fraction of what needs to be done for the whole beyond-64k to work, so sharing early to gather feedback.