Add first-class component glyph views - #158
Merged
Merged
Conversation
kostyafarber
commented
Jul 20, 2026
| const sourcePosition = Mat.applyToPoint(explicit, source); | ||
| const targetPosition = Mat.applyToPoint(targetComponent.#localTransformCell.value, target); | ||
| const attachmentOffset = Mat.Translate( | ||
| targetPosition.x - sourcePosition.x, |
kostyafarber
commented
Jul 20, 2026
kostyafarber
commented
Jul 20, 2026
| ) -> CoreResult<Transform> { | ||
| let parent_layer = layers | ||
| .get(&component_glyph.parent_glyph_id()) | ||
| .ok_or_else(|| CoreError::GlyphNotFound(component_glyph.parent_glyph_id()))?; |
Collaborator
Author
There was a problem hiding this comment.
we are doing this ok_or_else a lot
kostyafarber
commented
Jul 20, 2026
| } | ||
| } | ||
|
|
||
| fn interpolation_template<'a>(font: &Font, glyph: &'a crate::Glyph) -> Option<&'a GlyphLayer> { |
Collaborator
Author
There was a problem hiding this comment.
template is a bad name
kostyafarber
commented
Jul 20, 2026
| locationCell: Signal<AxisLocation>, | ||
| view: GlyphView, | ||
| ) { | ||
| this.#definitionCell = definitionCell; |
Collaborator
Author
There was a problem hiding this comment.
perhaps some inline comments might help to understand whats going on here
kostyafarber
marked this pull request as ready for review
July 20, 2026 07:22
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.
What changed
GlyphOutline/ render-model path with a first-classGlyphViewcontainingComponentGlyphandGlyphContouroccurrences.GlyphComponentsrelationships with stable component paths, parent/child ancestry, anchor attachments, authored order, and cycle pruning.Why
Sidebearings were derived from the root glyph's direct geometry. A pure component glyph has no direct contours, so its root bounds were
nulleven though a separate recursive outline path rendered it correctly. This split also required TypeScript to repeat component traversal semantics owned by Rust.The new model keeps composition, interpolation, and editability orthogonal. Source contour coordinates are shared once per base glyph at the view location; each placement adds only a transform/provenance occurrence wrapper.
ComponentGlyph.contoursand the flattenedGlyphView.contoursreference the same occurrence objects.Impact
Pure and mixed component glyphs now provide composed bounds and sidebearings in the editor sidebar, previews, and text layout. Rust and the renderer share one component occurrence model, including repeated/nested placements and anchor attachment identity.
Validation
cargo test -p shift-font -p shift-wire— 171 font tests and 6 wire tests passedcargo clippy -p shift-font -p shift-wire -p shift-bridge --all-targetspnpm lint:checkpnpm typecheckAacutecomposed bounds and 20/20 sidebearings