Skip to content

subset capi: expose plans, glyph mappings, and object metadata - #513

Closed
behdad wants to merge 26 commits into
mainfrom
capi/subset-plans
Closed

behdad wants to merge 26 commits into
mainfrom
capi/subset-plans

Conversation

@behdad

@behdad behdad commented Oct 7, 2026 •

Copy link
Copy Markdown
Member

Superseded by #547 in the reordered stack #544 → #545 → #546 → #547. The first three PRs use published dependencies; only #547 waits for a Skera release.

The plans, mappings, metadata, and subset C++ ownership helpers are in #547.


Add HarfBuzz-compatible subset plan creation/reference/destruction/execution, original-to-subset and reverse glyph maps, Unicode-to-original maps, and user data on inputs and plans. Plans snapshot the source tables and input settings, support repeated/concurrent execution, and return borrowed core hr_map_t handles that may be retained independently. Metadata replacement/destruction calls release functions outside the lock for reentrancy.

These APIs are part of the optional subset feature of harfrust_capi; enable it with cargo build -p harfrust_capi --features subset and link the single harfrust_c library. Headers, examples, and tests live under harfrust_capi.

Also enable customization of the no-subset-table set, with explicit drops and hint removal taking precedence. This requires the public Skera Plan API proposed in googlefonts/fontations#2234 . The draft temporarily pins Skera and write-fonts to that commit; restore released dependencies once the API is available in a release.

Validation: 135 C API tests, Rust 1.85 subset checking, rustfmt, and Clippy pass. The 48 original and 15 input-control differential cases remain passing, plus 16 plan/map comparisons with HarfBuzz. Tests cover closure mappings, retained/renumbered IDs, input mutation/destruction after planning, concurrent execution, map lifetime past plan destruction, table passthrough/drop precedence, and metadata rejection, replacement, reentry, and final destruction. C99 shared and static linking both pass, and CI's C example now exercises plan execution and mapping queries.

Stacked on #512; extends #507. Axis instancing and user-specified glyph mapping still need support in Skera; CFF/CFF2/VARC work remains separate.

behdad added 14 commits October 7, 2026 15:57
Support Skia face setup and callback-backed table enumeration. Keep collection selection separate from mutable face index metadata.

Assisted-by: OpenAI Codex
Map strided batches in public queries and shaping, with scalar/batch fallback and callback precedence through subfonts.

Assisted-by: OpenAI Codex
Keep the package version unchanged while making hb_version and HB_VERSION aliases report the matched shaping release. Add hr-hb-ot.h and generate portable include guards.

Assisted-by: OpenAI Codex
Provide Skia glyph/Unicode selection, retained IDs, notdef outlines, and hint removal through hr_subset APIs and hr-hb-subset.h. Import the core C ABI instead of embedding a second shaping library.

Assisted-by: OpenAI Codex
Add configurable name/layout/drop sets, keep-everything, and supported Skera flags. Preserve inverted tag sets and return an owned immutable preprocessing face.

Assisted-by: OpenAI Codex
Snapshot font bytes and selections, support repeatable plan execution, expose shared core map handles, and allow custom table passthrough. Pin the pending Skera Plan API for review.

Assisted-by: OpenAI Codex
@behdad
behdad added this pull request to stack #518 October 8, 2026 06:10
@behdad
behdad marked this pull request as ready for review October 8, 2026 17:27
@behdad
behdad requested a review from dfrg October 8, 2026 17:27
Base automatically changed from capi/subset-input-controls to main October 16, 2026 20:19
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