Repository navigation
Conversation
Contributor
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
This was referenced Nov 5, 2026
CamWight
force-pushed
the
drawing-font-table-4890
branch
from
November 5, 2026 18:37
fdb1613 to
f4b9c95
Compare
This was referenced Nov 5, 2026
CamWight
force-pushed
the
drawing-font-table-4890
branch
3 times, most recently
from
November 6, 2026 04:55
2a7928d to
cc029b9
Compare
CamWight
force-pushed
the
drawing-font-table-4890
branch
from
November 6, 2026 07:29
cc029b9 to
046a6da
Compare
…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>
CamWight
force-pushed
the
drawing-font-table-4890
branch
from
November 6, 2026 08:12
046a6da to
7e56a4a
Compare
CamWight
marked this pull request as ready for review
November 6, 2026 08:13
theironchef
reviewed
Nov 6, 2026
theironchef
left a comment
Contributor
There was a problem hiding this comment.
Read at 7e56a4a5 (source only; not built locally).
I found no defects. What I checked:
records_beyond(None)gives the oldrecords()count exactly (1 for the font, plus every glyph), so the existing record budget is unchanged.reach():PlacedGlyph::xandadvanceare already in millimetres, and an RTL run keeps its glyphs in visual order along the baseline, so taking the maximum ofx + advanceis the right extent in both directions. Starting the fold at0.0gives an empty run a reach of 0, which seems right.font_inkeeps the binary search thatPrepared::fonthad, and the second commit's test with a font 9 next to a font 7 would catch a lookup that took the first font.
Small, optional points:
font_records_beyondcounts a font twice ifmoreholds the same id twice (or two partial copies with glyphs in common). It over-counts, so it errs toward refusing, and the doc says "each font once". A debug assertion or a line in the doc about what callers must pass might save the next caller a surprise.- In the schema, a glyph
idisminimum: 0with nomaximum: 65535, though it's au16. The keys of a font'sglyphsmap aren't constrained either (propertyNameswith a digits pattern).face,num_glyphsandunits_per_emcould takeminimum: 0as well. None of this affects the reply's validity, only how tight the schema is.
7 of 14 tasks
This was referenced Nov 6, 2026
Contributor
Author
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.
The next drawing pieces that put text on a sheet (a dimension's number first) need three small things from the paper scene:
drawing.scenereply schema that allows text.This adds those three and nothing that draws. It is drawing data only, with no kernel geometry.
For #4890, into
drawings. Two commits: the change, then one more check on the font lookup.Merge order: this PR first, then #12356 and #12357, which hold its commits below their own.
Changes a default: no
What it does
Scene::font_records_beyond(fonts): the recordsfontswould add to the scene's font table. A new font counts in full; a font the table already holds counts only the glyphs it doesn't have yet. One rule for every piece that puts text on a sheet, so each one counts against the scene's record limit the same way, before it joins.TextRun::reach(): how far a run's glyphs go along its baseline, in millimetres. A dimension needs it to know whether its text fits between the arrows.text::font_infinds a font by id in a table in id order.Prepared::fontuses it, and so will the pieces that follow.drawing.scene's output schema lists text items (a run's font, glyphs, clusters, origin, angle, slant, direction) and the scene's fonts (metrics, flags, glyph outlines). A font's bytes never appear. Until now, a reply with text in it wouldn't have matched its own schema.Options considered: (1) each text piece counts its own font records; (2) one count on the scene, as here. (1) would write the "only the glyphs it doesn't hold" rule once per caller. (2) was chosen.
Tests
New, in the area's existing test files:
a_tables_new_records_and_a_runs_reach(geom/src/paper/text_tests.rs): a font new to the table counts all 12 of its records; held in full, 0; with glyph 2 missing, 5 (the glyph, its loop and its 3 pieces). A run's reach is where its last glyph ends (5.5).a_replys_text_and_fonts_keep_to_its_schema(engine/src/drawing_scene_tests.rs): a sheet reply holding text set by the drawing font matchesdrawing.scene's schema. Its item istext, its font's id matches the run's, and no font hasbytes.Planted faults, 8, each caught by the tests above, then a clean run: held glyphs counted again; a held font counted as new; the table ignored; a run's reach taken to its last glyph's start; the font lookup taking the first font (caught once the test had a second font, which is the second commit); the font schema refusing a subset font; the schema without the text item; the schema without the fonts.
Overlaps
@0xlillith's #7608 (sheet sketch scenes, draft) and @armin0411's #9421 and #9463 (centre marks) also change
schema/drawing_view.rsandgeom/src/paper.rs. None of them touches text or fonts. This PR adds the text item to the whole sheet's item list beside pictures, and leaves the rest of those files as they are.Validation
Local, Windows,
--profile ci: the paper tests insolidcraft-geom(68) anddrawing_sceneinsolidcraft-enginepass;cargo fmt --check;cargo check --workspace --all-targetsondrawingsca6a09579(after #12087), no warnings.Replayed on 6 Nov onto
drawingsf50edc1, after #12423 (a view draws again only when what it shows changes), #12449 (a deferred drawing keeps its lines until it is updated), #12516 (a view's lines come in line groups) and #11126 (a view's dimensions are worked out beside the window) merged. They change the same scene files, and each merge keeps both sides. The sheet scene's step keeps #12423's check for views that still show the same thing and #12449's hold for a deferred drawing, then sets the dimensions in the drawing's lettering. #11126's job carries that lettering in its ticket in place of the units alone, so a dimension worked out beside the window is set in the same font and language as one set in the step. Dimensions keep #12516's line groups and add their text. The scene and inspect command descriptions keep #12449's and #12516's words beside this stack's. #12449 addedout_of_dateto the scene reply, so the schema test that builds one sets it (out_of_date: Vec::new()). The replay of 5 Nov onto 41dcdd1 needed one change too: #12396 gave a view's drawn state anownersfield, set toNonein the dimension text test. Checks (Windows,--profile ci):cargo check --all-targetsandcargo fmt --checkof geom, sketch, doc, io and engine at each commit. At the head of the title block text PR (#12357), which holds all three, ondrawingsf50edc1: clippy with warnings denied; enginedrawing365,title_block_text6 andschema191 passed, with #11126's two job tests (a_job_beside_the_window_draws_as_a_step_does,seeded_edits_steps_and_jobs_always_end_at_the_built_scene). Ondrawings1b069e1, the same code before these merges also passed sketchpaper_text47, iopaper45, geompaper72, docdrawing90 and enginehostile72, and the wasm check of the engine.Earlier, replayed on 5 Nov onto
drawings69709bd (the line groups of #12232 touched the scene's files; both commits applied cleanly):cargo check --all-targetsof geom, sketch, doc, io and engine at each commit, then the paper and drawing tests again with the dimension text PR on top (geompaper72, enginedrawing337,schema191). Nothing is drawn yet, so there is no picture.