Skip to content

Drawings: a title block's text is set once while its sheet fills in, not again for each view drawn - #12776

Closed
CamWight wants to merge 5 commits into
tangency-labs:drawingsfrom
CamWight:sheet-text-faces-4890
Closed

CamWight wants to merge 5 commits into
tangency-labs:drawingsfrom
CamWight:sheet-text-faces-4890

Conversation

@CamWight

@CamWight CamWight commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Change

A drawing sheet's scene is the picture of one sheet: its border, its views, its dimensions and its title block. The window gets it from the sheet scene, which keeps its last answer and builds a new one when something changes. While a sheet fills in, its views are drawn one each tick, and before this PR every new view also made the title block read its fields and set its text again. That meant weighing the documented component again for a mass or material cell. Now the title block's text is set once and kept with the last answer. It is set again only for another sheet, drawing, design, model state or drawing lettering (units, language, font).

A scene is also reused only for the same font faces. One font family name can mean another face once a font is installed or removed, and that face gives another scene. A font installed while the drawing is open shows the next time the text is set again (after an edit, a model change or a change of sheet), not at once: nothing watches for installed fonts. A family with no face on the computer is set in the built-in font, so its scene doesn't change until the family is found.

Part of #4890, into drawings. Stacked on the title block text PR #12357 (itself on #12356 and #12113): this PR holds their commits below its own, so review only its own top commit. Merge order: #12113, #12356, #12357, then this PR, then the sheet text PR that sits on it (#12778).

Changes a default: no
Nothing a user gets out of the box changes: the same text is set from the same fields, only less often, and nothing is saved.

What it does

In crates/engine/src/drawing_scene.rs:

  • Assembled::reads(sheet, drawing, design, state, lettering) is the one check for "the same sheet, drawing, design, model state and lettering". The fast path that returns the last answer uses it, and so does keeping the title block's text.
  • The last answer keeps the block's text as set on paper (text: Arc<Set>) beside its cells. When reads holds, the next answer takes both from it, so a view drawn sets no text.
  • block_text(record, lettering, cells) is the one way from a block's cells to its text on paper. Export (build) and the window's scene (extract) both call it. assemble takes that text instead of the lettering and cells, so it no longer measures anything.
  • The last scene is reused only when its inputs, its cells and its text's faces (Set::faces, in title_block_text.rs: the font ids, each once) are all the same.

Validation

Local, Windows, --profile ci, on drawings a7c0310 (merged with the latest, 67a3258, and checked again there):

  • cargo check --all-targets and cargo fmt --check of geom, sketch, doc, io and engine at each commit of the stack.
  • At the head of the sheet text PR, which holds this one (847a07c), the push gate: fmt, clippy -D warnings, assets, icons, licences, lists, layers, ui-containers, mesh-decisions, wasm and web offline pass. Tests of the 17 crates the stack can reach: the sketch library 390 passed; drawing_scene 73, drawing_dimension_paper 17, drawing_export 11, title_block_text 7 and the sketch fonts 29 all pass. 37 tests fail elsewhere: 31 are in tests/KNOWN_FAILING_TESTS, and 6 are in the kernel's boolean property tests, an xtask path test and the agent chat, which use none of the changed code.

Tests, in drawing_scene_tests.rs:

  • a_scene_is_for_the_faces_its_title_blocks_text_is_set_in: the views drawn set no text (the same Set, before and after the sheet fills in); the scene's fonts are the text's faces; the same face keeps the scene and its generation; another face under the same family name gives a new scene equal to the exported one; a family with no face is the same scene.
  • a_title_blocks_text_follows_its_sheet_and_the_model: back and forth between two sheets, each shows its own block; after a checkpoint is restored, the mass is read from the model as it now is.
  • a_title_blocks_text_follows_the_model_state_alone: only the model state changes (the design is the same) and the mass follows.
  • The assemble tests take the block's labels set by block_text.

Planted faults, each caught by a failing test, then a clean run:

  • text set again for each view drawn;
  • the faces left out of the reuse check;
  • export setting the text without the cells;
  • the text kept when only the model state changed.
    On 5 Nov, the first run caught 3 of these 4. The model-state fault was missed: no test changed only the state. a_title_blocks_text_follows_the_model_state_alone was added, and the next run caught all 4. On this push, 4 of 4 caught.

What the tests don't reach: a font installed on the computer while the drawing is open (the tests plant another face instead).

Screenshots of the behavior

None. No window code draws sheet scenes yet, so nothing changes on screen, and exported sheets are the same as before.

Integration status

On drawings a7c0310 (merged with the latest, 67a3258, and checked again there), on 2026-11-06: #12113's two commits, #12356's, #12357's, then this one. When the PRs under it squash-merge, it is replayed onto them.

Open PRs on the same files (drawing_scene.rs, drawing_scene_tests.rs, title_block_text.rs), by git merge-tree. This commit adds no conflict to any of them beyond what #12357 already has:

CamWight and others added 5 commits November 6, 2026 16:17
…the sheet reply's schema (tangency-labs#4890)

One rule for everything that puts text on a sheet: `Scene::font_records_beyond`
counts only what a scene's font table doesn't hold yet, `TextRun::reach` says
how far a run's glyphs go along its baseline, and `drawing.scene`'s schema has
text runs and fonts, never a font's bytes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…n the table

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…tangency-labs#4896 W19h)

A dimension on a sheet now carries its text: each value is set in the
drawing's font and language, measured, and placed along the dimension's
text direction, reading from the bottom or the right. Arrows flip by the
measured text width. A text the font can't set leaves the lines and says
why. The scene adds each dimension's fonts to its table once, counting their
records against the scene's limit, and measures text by its outlines for an
object's bounds. A dimension is read again when the drawing's units,
language or font change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ncy-labs#4890 B3, tangency-labs#3875)

Each label is set as one line at its place, and each text cell's value in its
value box by the cell text rule, broken between words to the box's width when
its fit wraps, in the drawing's font and language. What doesn't fit is shown
whole and noted; a text no font can set is left off the sheet and noted with
why, so the sheet and its export never fail over one cell. drawing.inspect
lists each cell's notes; the sheet scene sets what was measured.

What a cell shows is worked out in one place for drawing.inspect and the scene.
The block's fonts count toward the scene's records with the border, so no view
takes them, and the scene is drawn again when the design or a cell's text
changes.

Ported from the personal PC's 1951bc6 onto today's drawings.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…and its faces in the key (tangency-labs#4890 F5)

The sheet scene read its title block's fields and set their text again on
every extract that missed its last answer, and views are drawn one a tick,
so a sheet filling in weighed the documented component and laid out the
block once for each view drawn. The text is now kept with the last scene
and set again only for another sheet, drawing, design, model or lettering.

A scene is reused only for the same faces too: one family name can mean
another face once a font is installed or removed, and that face is another
scene. A family with no face is set in the built-in font, so it stays the
same scene until it's found.

Ported from the personal PC's d82fd03 onto today's title block text.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@CamWight

CamWight commented Nov 6, 2026

Copy link
Copy Markdown
Contributor Author

Landed in drawings with #12778 (2a25449), which carried this commit

@CamWight CamWight closed this Nov 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:doc timeline, components, parameters, naming area:kernel B-rep kernel, booleans, blends, STEP/IGES

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant