Skip to content

Move glyph interpolation into shift-font - #152

Merged
kostyafarber merged 2 commits into
mainfrom
agent/font-projection
Jul 16, 2026
Merged

Move glyph interpolation into shift-font#152
kostyafarber merged 2 commits into
mainfrom
agent/font-projection

Conversation

@kostyafarber

Copy link
Copy Markdown
Collaborator

Summary

  • move canonical glyph interpolation values, source compatibility, variation-model construction, and evaluation into shift-font
  • add FontProjection and ResolvedGlyph as a location-bound read-only projection with exact-source, interpolation, sparse fallback, and recursive component semantics
  • reduce shift-wire to adapting native interpolation into renderer DTOs, and remove the leaked GlyphMaster NAPI/TypeScript contract
  • document the new ownership boundary in the canonical font and bridge docs

Why

Issue #150 needs a lightweight batch preview built on a canonical Rust projection. Previously, interpolation semantics and flattened glyph values were partly owned by shift-wire, which made a preview resolver either duplicate that logic or turn a transport crate into a domain service.

This PR gives shift-font one native projection API that the preview bridge can consume in a follow-up. It intentionally does not add preview DTOs, workspace transport, TanStack Query integration, or grid UI.

Resolution semantics

  • an exact authored master layer wins
  • otherwise compatible source layers interpolate at the internal authoring location
  • unavailable interpolation falls back to the default/preferred authored layer
  • components resolve recursively at the same location and cyclic branches are skipped locally
  • existing blank glyphs remain present with empty contours and their advance; missing IDs are omitted
  • external axis mappings must be applied before constructing a projection

Validation

  • pre-commit suite: Cargo check/fmt/Clippy/tests, Oxfmt, Oxlint, tsgo, dead-code checks, and Vitest
  • pnpm test: all Turbo test tasks passed, including 503 desktop tests
  • pnpm typecheck
  • cargo clippy --workspace --all-targets -- -D warnings
  • Rustdoc broken-link validation across the workspace
  • documentation drift check reports only the repository's 15 pre-existing errors; the changed docs introduce none

Foundation for #150; does not close it.

Comment thread crates/shift-font/src/projection.rs Outdated
preferred_layer_for_glyph(glyph)
}

fn locations_equal(left: &Location, right: &Location, font: &Font) -> bool {

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we make location impl equality? instead or use traits

@kostyafarber
kostyafarber marked this pull request as ready for review July 16, 2026 12:38
@kostyafarber
kostyafarber merged commit 65405a6 into main Jul 16, 2026
11 of 12 checks passed
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