Skip to content

Split glyph API by identity layer and instance#111

Merged
kostyafarber merged 1 commit into
mainfrom
issue-109-glyph-api
Jun 28, 2026
Merged

Split glyph API by identity layer and instance#111
kostyafarber merged 1 commit into
mainfrom
issue-109-glyph-api

Conversation

@kostyafarber

Copy link
Copy Markdown
Collaborator

Summary

Fixes #109.

  • split the glyph API around explicit font-owned identity, authored layer, and resolved instance access
  • moved render/hit-test/read geometry through font.instance(...) and authored mutation through font.layer(...) / font.editableLayerAt(...)
  • added reactive *Cell wrappers plus track(cell) docs, and removed old dollar-prefixed signal names touched by this work

Notes

  • GlyphInstance is now read/render/hit-test only; mutation stays on GlyphLayer.
  • Font assembles the reactive layer/geometry/outline inputs directly, including source and snapshot invalidation.
  • scripts/context-drift-check.py now runs without markdown_it; the normal command still exits 1 on existing repo-wide documentation drift outside this PR's scope.

Validation

  • pnpm typecheck
  • pnpm lint:check
  • pnpm format:check
  • NODE_OPTIONS=--experimental-global-webcrypto pnpm --filter @shift/desktop exec vitest run src/renderer/src/lib/model/Font.test.ts src/renderer/src/lib/model/Glyph.test.ts src/renderer/src/lib/model/variation.test.ts src/renderer/src/lib/editor/Editor.test.ts
  • pre-commit hooks before the Python-only amend: oxfmt, oxlint, tsgo typecheck, deadcode strict, full vitest
  • python3 -m py_compile scripts/context-drift-check.py
  • python3 scripts/context-drift-check.py now executes, but reports existing docs debt: 34 errors and 27 warnings, including the stale apps/desktop/src/renderer/src/bridge/docs/DOCS.md route and old dead-symbol references

return new GlyphGeometry(glyph.interpolationStructureForFont, values);
}

#glyphInstanceInput(glyph: Glyph, location: Signal<AxisLocation>): GlyphInstanceInput {

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.

I don't like this returning an input to a glyph instance? do we just inline in the consturctor of a instance when passing in the font?

return `${glyphId}:${sourceId}` as InFlightKey;
}

function axisLocationSignal(location: AxisLocation | Signal<AxisLocation>): Signal<AxisLocation> {

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.

this is wrong lets examine how this is used and why we need this union type, this feels like it should be a regular getter and a Cell getter split up

return new GlyphGeometry(EMPTY_GLYPH_STRUCTURE, new Float64Array([0]));
}

function isSignal<T>(value: T | Signal<T>): value is Signal<T> {

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.

remove

if (values.length === 0) {
return this.#geometry.peek();
}
createInstanceForFont(input: GlyphInstanceInput): GlyphInstance {

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.

why ForFont

@kostyafarber kostyafarber marked this pull request as ready for review June 28, 2026 19:02
@kostyafarber kostyafarber merged commit 0bb6d7e into main Jun 28, 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.

Clarify glyph model API by splitting identity, authored layers, and resolved instances

1 participant