Repository navigation
Drawings: title block and dimension text share one rule for waiting on fonts - #12846
Merged
bherbruck merged 1 commit intoNov 7, 2026
Merged
Conversation
…ng or refused (tangency-labs#4890) The title block's text and a dimension's text each chose for themselves between waiting for the search for fonts to fall back to (an export, drawing.inspect) and asking it (the window's sheet), then each mapped the answer to set, pending or refused. That rule is now in one place, in sketch beside the fonts: PaperFonts holds the drawing's family and language with the font folders listed once, and sets lines or text the waiting or the asking way; Outcome is the one mapping of its answer. The title block's lay and the dimensions' paper_group take a PaperFonts, made once for each block and each read of dimensions. Nothing else changes: the same text in the same fonts, pending and refused in the same cases. A parts list's words on paper will use it too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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 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.
Change
A drawing sheet sets its text, such as a title block's labels and values or a dimension's number, in the drawing's font. When a character needs another font, an export waits for the font search, and the window asks the search and shows the text once it answers. Before this PR, the title block and the dimensions each made that choice themselves, and each turned the answer into set, pending or refused. Now one small piece in
crates/sketch/src/paper_text.rsdoes both, and the title block and the dimensions use it. Parts lists and revision tables on the sheet will use it too, in a later PR.Part of #4890, into
drawings. One commit ondrawings, not stacked.Changes a default: no
The same text is set in the same fonts, and pending or refused in the same cases. Nothing on screen changes.
What it does
PaperFontsholds the drawing's font family and language, and the font folders, listed once.PaperFonts::new(family, language, wait)chooses the way in: waiting for the font search (export,drawing.inspect) or asking it (the window's sheet).linesmeasures andtextsets, by that choice.Outcomeis the one mapping of an answer: set; pending (only the window asks, so only it sees this); or refused, with why.title_block_text::layanddrawing_dimension_paper::paper_grouptake a&PaperFontsinstead of the family, the language and awaitflag. The title block's own measuring closure and the dimension text's choice of function are gone.PaperFontsfor each title block and each read of dimensions, anddrawing.inspectmakes one.Cost: the list of font folders is made once for each block and each read of dimensions. Before, the window's sheet made it once per dimension, and an export once per text. Making it reads no disk (it comes from a few environment variables), so the gain is small: the reason for the change is one rule in one place.
Validation
Local, Windows,
--profile ci. The run was ondrawingsf1153f4. The commit was then replayed onto d506dd6 (the same patch; #12839, merged since, touches none of these files) and checked again there:cargo fmt: no diffs;cargo checkandcargo clippy -- -D warningsover geom, sketch, doc, io and engine, all targets: clean; sketch builds forwasm32-unknown-unknown. On d506dd6:cargo check --all-targetsof sketch, doc and engine clean, and the sketchpaper_texttests pass.paper_text50 of 50; enginetitle_block,drawing_scene,drawing_dimension,drawing_exportandcmd::drawing191 of 191.crates/sketch/src/paper_text_tests.rs,a_sheets_text_is_set_pending_or_refused. Asking is pending until the search answers, then sets what waiting sets; waiting is never pending; a character no font has is refused with why, either way.drawingshad 5 before this PR.What the tests don't reach:
Screenshots of the behavior
None. Nothing on screen changes: the same text is drawn the same way.
Integration status
On
drawingsd506dd6, checked 2026-11-07 02:58 UTC. @0xlillith's #12039 changespaper_text.rsand sketch'slib.rstoo. It already needs a small join withdrawingsthere. This PR adds no conflict to it: the same two places inpaper_text.rsand one inlib.rs, with or without this PR. #12039 adds another pair of waiting and asking functions (paper_text_with_flowandpaper_text_with_flow_now), which could later become onePaperFontsmethod. Four open PRs (#9421, #9463, #7608, #10761) changedrawing_scene.rsorcmd/drawing.rs. This PR changes a few lines in those two files (two imports, a new line that makes the dimensions'PaperFonts, and three calls) and adds no conflict to any of the four.