* Hatch dialog: author custom PAT families and capture a repeating tile
* Handle Escape through CADCraft's window cancel intent in the hatch dialog
* Keep custom hatches in the pattern gallery and fix repeating tile capture
* Exercise keyboard input in the hatch gallery filter
* Use the active drawing’s hatch geometry and finish tile picks only after two corners
Resolve embedded pattern lines for the gallery, HATCH, HATCHEDIT and Properties. Retry an empty compact swatch at full-period scale. Add coverage for two reopened drawings with the same pattern name, incomplete picks and aligned sparse marks.
The earlier shallow-slope fix skips empty scanlines before clipping. Its regression counts 10,000 full-length marks in a 100 by 100 tile area.
* Expose hatch tile capture as a headless engine command and reuse it in the dialog
* Respect drawing visibility and localize hatch capture errors in the dialog
* Use the public UI state constructor in workspace tests and route hatch capture through CadApp::run
* Classify in-memory hatch tile capture as requiring no files
* Check the saved hatch by handle independently of entity iteration order
* Reserve the native user-defined hatch name across custom pattern entry points
* Add the Chinese command label for Capture hatch tile
chinese_menus_and_commands_are_fully_translated requires every command
label in the Simplified Chinese catalog. The Ubuntu gate failed with this
one key still in English.
---------
Co-authored-by: FredApps <[email protected]>
A leader's overrides of its dimension style (the DSTYLE list in its ACAD
xdata) were kept as raw xdata and not used, so an overridden arrow size,
scale, arrowhead or line colour did not show. They are now read into the
leader, used when it is drawn, and written back as one DSTYLE list; the
rest of the leader's ACAD xdata is kept as before.
An object with a true colour was printed in the colour of the plot style
of its nearest index colour, so a true white solid hatch came out black
through a table whose colour 7 pen is black. The colour of such a style
no longer replaces a true colour, the object's own or its layer's: it is
an answer for index colours. The other fields of the nearest index
colour's style, grey scale and screening too, apply as before.
Each point of the text grew the column nearest to it, so a stroke that
starts in one column and ends in the next (text too wide for its column)
was masked at its two ends and bare in between, where the single quad had
covered it. The column a stroke comes from now grows to the stroke's far
end as well.
Co-Authored-By: Claude Fable 5.2 <[email protected]>
The fonts draw an underline a fifth of the drawn height below the baseline
and an overline a fifth of it above the top of the line. The box of a TEXT,
ATTRIB or ATTDEF ran from the baseline to the height, so both lines were
outside the extents and outside what a click on the text hits. The box now
reaches them when the value turns them on for a character it draws, at
every justification and for the range of heights Aligned text can be drawn
at. Text without them keeps its box.
Follow-up to #3695.
Co-Authored-By: Claude Fable 5.2 <[email protected]>
The mask of #3240 was one quad over the layout's combined box, so a
multi-column MTEXT got its gutters painted over. Draw one quad per
column from the layout's column_bounds, each grown by the text drawn
past its column and by the border offset factor as the single quad was,
and turned by the rotation about the insertion point. All quads go into
one primitive, so the mask kind and draw order are as before. Each
stroke point grows its nearest column by binary search over the column
starts, so hostile column counts stay O(points log columns).
With one column the box is the combined box and every stroke grows it,
so the output is the same six vertices as before.
Follow-up to #3240.
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
* Viewports keep their own UCS and their other settings through save and copy (part of #1316)
A layout viewport's own UCS and every setting CADCraft doesn't model
were dropped on read, so saving a sheet set lost them for good.
- Viewport::ucs (origin, X/Y axes, elevation, orthographic type, named
and base UCS by name) and ucs_per_viewport (UCSVP), read from and
written as VIEWPORT groups 110-112, 146, 79, 345/346 and 71.
- Viewport::extra: the viewport's other groups as read (snap, grid,
lens and clipping, render mode, plot style sheet, shade plot, visual
style, background, lighting). They belong to the entity, so COPY and
MIRROR carry them; dxf_raw::finish writes them before the xdata and
points their references at what they named (ForeignExtra::tail).
- Not carried raw: the view twist, direction and target (51, 16, 17),
which say where the view centre is measured from; writing them back
while the centre is in drawing coordinates would move the view.
- DWG: the bridge drops 345/346, the plot style sheet, shade plot and
lighting groups, so CADCraft xdata keeps a copy (VPUCS, VPEXTRA) that
the reader falls back on. The visual style, background and shade plot
references are still lost through DWG (file-format-parity.md).
- A UCS with unreadable or zero-length axes is no UCS; a named UCS
that's no longer in the table isn't pointed at.
Tests: another program's viewport read; DXF save and reread; two DWG
round trips; a copied viewport; a deleted named UCS; a viewport without
a UCS written as before; hostile groups (5000 extras, NaN axes, bad
handles); COPY and MIRROR through the engine.
* Viewports: VPEXTRA keeps only a viewport's own groups; a base UCS handle alone is kept
- CADCraft's VPEXTRA xdata copy of a viewport's unmodelled groups is
merged only for groups that can stand inside the AcDbViewport subclass:
a record start (0), handles (5, 105), a subclass (100), a group brace
(102) or xdata (1000 on) from a crafted file are dropped, so a save
can't write records or handles the user didn't draw.
- A VIEWPORT whose only UCS group is its base UCS handle (346) now reads a
UCS, so the base UCS is resolved and written back.
* Viewports: drop structural groups from a record's own extras; index UCS names for the xdata fallback
- A VIEWPORT's own AcDbViewport groups are kept raw only when they can
stand in the subclass, as CADCraft's VPEXTRA copy already was: a second
handle (5, 105) or a group brace (102) written back would give the
record two handles. The record's own pointer groups stay, to be
remapped with it.
- The named and base UCS that CADCraft's xdata names are looked up in a
case-insensitive index built once with the UCS table, not by scanning
every UCS for each viewport.
* Parity checklist: regenerated after merging main
* Parity checklist: regenerated after merging main
* Parity checklist: regenerated after merging main
* xtask: take main's stats.rs (the merge kept a test import Linux clippy rejects)
* Viewport tests built on main set the UCS fields
* WIP row 74: Codex's test edits kept; production normalisation (identity UCS -> None, default-valued extras dropped in dxf_read viewport_ucs/viewport_extra) still to do
* Viewports: a default viewport reads back with no UCS or extra groups (#1484)
A DWG save writes an identity UCS and the default snap, grid, lens, clip,
render and shade groups for every viewport, so a viewport nobody gave a UCS
came back with one and a dozen extras. The DXF reader now reads an unnamed
identity UCS (UCSVP 0) as none, and keeps a group in extra only when it
differs from the defaults, listed in one table. Tests: a_default_viewport_reads_back_without_ucs_or_extras,
a_viewport_with_non_default_snap_keeps_it; layouts_and_paperspace passes.
* Viewports: clippy range patterns; raster_image test builds with the viewport's UCS fields
* Tests: move the viewport UCS suites into the it entry points (#1316)
viewport_ucs_roundtrip.rs and viewport_ucs_copy.rs were separate test
binaries; AGENTS section 30 wants the existing entry points. All 12 DXF/DWG
persistence tests and the COPY/MIRROR tests are kept.
* Tests: move the viewport UCS suites into the it entry points (#1316)
viewport_ucs_roundtrip.rs and viewport_ucs_copy.rs were separate test
binaries; AGENTS section 30 wants the existing entry points. All 12 DXF/DWG
persistence tests and the COPY/MIRROR tests are kept.
---------
Signed-off-by: FredApps <[email protected]>
Co-authored-by: Claude <[email protected]>
Co-authored-by: SBaksa <[email protected]>
Co-authored-by: FredApps <[email protected]>
A value of nothing but underline and overline toggles (%%u%%u) has no drawn
character, and the box floored the count at one: Aligned over a span of 20
that was a box of 20 by 120 for text that draws nothing. The box is empty
when no character is drawn, for an empty value too.
Co-Authored-By: Claude Fable 5.2 <[email protected]>
main now carries #3594 and #3622 (landed through #3692), which rewrote
clip_prim around Limits and the pieces/fill closures. The only conflict is
that block in crates/render/src/viewports.rs: main's clip_prim is kept and
its Clip::Poly fill arm gets this branch's one line, so both truncation
signals stay:
- #3594's whole() in the fill closure marks the list when the clip stops
at the room left or at its own 6,000,000-point stop;
- may_leave_out marks it when the clip region's own triangles stopped at
the fill cap (#3636).
truncated is only ever OR-ed, so neither signal clears or doubles the
other.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Main (PR 3679) mirrors the box of Backwards and Upside-down text about the
point the text is placed by. This branch builds the box from a bottom and a
top instead of an offset and a height, so the mirror is applied to those
corner points.
Tests: the two helpers (ours with a vertical justification, main's with the
mirror flags) are one that takes both, and the test of the vertical
justifications also runs with each mirror.
Co-Authored-By: Claude Fable 5.2 <[email protected]>
The box took the length of the stored value, control codes included: the
%%u and %%o toggles draw nothing, %%d, %%c, %%p, %%% and %%nnn draw one
character, \U+XXXX draws one, and invisible formatting characters take no
room. So the width was over-estimated again for such text: Aligned
"%%uAB%%u" at height 1 over a span of 20 is drawn 12.5 high in a box of
6.25. The callers now pass the number of drawn characters.
Co-Authored-By: Claude Fable 5.2 <[email protected]>
Bottom justification lifts a line by a third of the height it is drawn at.
The box used a third of its own height, which is the most the line can be
drawn at, so the box began above the bottom of the text: "I" over a span of
20 is drawn from 20 to 80 and its box began at 40. The box now runs from
where the shortest possible line would start (from the widest width the
stroke font gives the line) to where the tallest would end.
Co-Authored-By: Claude Fable 5.2 <[email protected]>
Two findings from the landing review of #3506.
Text of next to no width is left as it is by the fonts. The box applied
that cutoff with a margin, so for a height of 1e-7 and a width factor of
1e-5 it still scaled the text over its span: a box about a million units
high. It now uses the fonts' cutoff as it is.
Aligned text is scaled by span / shaped width, and the box divided by the
widest width a line can have, so narrow letters were drawn taller than
their box: "I" over a span of 20 is drawn 60 high in a box of 22. The
height now comes from the least width the stroke font gives a line.
Co-Authored-By: Claude Fable 5.2 <[email protected]>
A test that the extents of backwards and upside-down text over two
points are the plain text's extents reflected about the first point,
as the drawn text is.
Co-Authored-By: Claude Fable 5.2 <[email protected]>
Keeps both sides in text_box (main's fitted height and rotation, this
branch's mirroring) and sets the two flags on the Text literals main
has added since.
Co-Authored-By: Claude Fable 5.2 <[email protected]>
TEXT, ATTDEF and ATTRIB have their own Backwards and Upside down, as AutoCAD's do (DXF group
71: 2 backwards, 4 upside down). New TEXT and attribute definitions take them from their style;
changing the style afterwards leaves existing text as it is. They were the style's only, so
text read from a file with its own flags was drawn as its style said.
- Model: `Text::backwards` and `Text::upside_down` (serde default false).
- DXF: read from 71 (the object's own groups, before an embedded MTEXT) and written when set.
- Render: drawn from the text's flags; the extents box mirrors with them, so zooming to
extents frames mirrored text. Linetype text keeps its style's.
- Properties: a Misc group with Upside down and Backwards (`properties.describe`, and
`properties.set` takes `backwards` and `upsideDown`), for several texts at once with *VARIES*.
- ATTDEF builds its text as TEXT does, so it also takes the style's width factor and obliquing.
- Round trip: #2237's matrices compare both flags, with DXF and DWG cases for them. Its
mirrored-style cases mirror the text by the text's own flags, and each mirrored style
also has text whose flags differ, so a style's flags can't leak into its text's.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Plot style tables can be kept in <settings>/plotstyles (one
<name>.ctb.json / <name>.stb.json file per table), which every drawing
lists. Lookup is drawing, then folder, then built-in. A layout or Model
that chooses a folder table takes a copy into the drawing, and saving to
DWG/DXF copies in any folder table a page setup names, so a drawing plots
the same without the folder. Model remembers its plot style table in its
page setup. STYLESMANAGER gains `where`, `rename` and `reload`; the Plot
Style Manager gains New, Rename, Delete, Open folder and Use for Model.
Fixes#1901. Same idea as #1912 by Nicholas Gower, who handed the issue
over; the code is written independently.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The extents estimate a line's shaped width; the fonts measure it. Where the
fonts decide by a cutoff the two could differ, so the extents now assume
the real width is within a factor of 4 of the estimate and take the larger
box unless the estimate is clear of the cutoff:
- Fit text counts as stretched only when its fitted factor clears the
fonts' cutoff by that factor; otherwise it is boxed unstretched.
- A line of next to no width is left as it is by the fonts, so its box no
longer reaches for the second point.
- Aligned text shrunk into a short span is boxed at least as tall as its
own height, which narrow characters reach.
Co-Authored-By: Claude Fable 5.2 <[email protected]>
Fit text is stretched by scaling its width factor by span / shaped width
and shaping again. With a span that is a tiny part of the text's width the
scaled factor is too small for the fonts, which then draw at a factor of 1:
the text is far wider than its span, and the extents reported only the
span. The extents now take the unstretched width in that case, as they do
for an unusable stored factor.
Test (render, which sees both): the drawn text lies inside the drawing's
extents for a span too short to fit and for one that fits.
Co-Authored-By: Claude Fable 5.2 <[email protected]>
Require user-defined spacing to exceed the renderer limit in HATCH and SETVAR. Show the exact default spacing, and use a shared scale rule for rendering and DXF definitions.
Measure the rendered spacing before and after a DXF save at the first supported value.
* Dimension text below the line (\X) and leader text at DIMSCALE (#1055, #1056)
- #1055: in dimension text, `\X` starts the text below the dimension
line (DXF Reference). CADCraft drew only the part before it, and its
*D block held only that part. The part after `\X` is now drawn below
the line, on the other side of it at the same distance (text centred
on the line moves above it), on screen, in plots and in the *D block
as a second MTEXT; text width for the fit is the wider part's.
- #1056: LEADER's annotation was DIMTXT high whatever DIMSCALE said
(0.25 instead of 6.25 beside dimensions at DIMSCALE 25). It is now
DIMTXT × DIMSCALE (the style's, else the drawing's; 1 for annotative
styles), in the style's text style, as AutoCAD's LEADER makes it.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
* Dimension `\X`: measure from the dimension line, not DIMTMOVE 1's leader
The part after `\X` is placed from the dimension line's longest segment, and DIMTMOVE 1's leader
(added by #2015) is drawn as a dimension line too: with the text moved far away, the leader won
and the part below went next to the text. The leader's ends are now kept (`text_leader`) and its
segments skipped. Text moved off its place also leaves the part below at the usual clearance
under the line, instead of as far below as the text is above.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
* LEADER text of an annotative dimension style: DIMSCALE, and annotative
With an annotative dimension style the leader's text left DIMSCALE out and was not annotative,
so at an annotation scale it stayed small beside the dimensions. It now takes DIMTXT × DIMSCALE
as a dimension of the style does, and is annotative at the current annotation scale.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
* LEADER text of an annotative style: the annotation scale replaces DIMSCALE
An annotative dimension takes the annotation scale in DIMSCALE's place (anno_scaled sets its
scale override), so its text is DIMTXT × the annotation scale. The annotative leader text took
DIMTXT × DIMSCALE and then the annotation scale again: twice the dimension text with DIMSCALE 2.
It is now DIMTXT high and annotative; a non-annotative style still takes DIMTXT × DIMSCALE.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
* DIMTMOVE 1 leader is kept as the text leader again
The merge of main moved the leader into dim/linear.rs without the text_leader record, so the
text below the line was placed over the leader.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
* Keep `\X` text below a suppressed or extension-line dimension line
With DIMSD1 and DIMSD2 both on, no dimension line segment is drawn, so
the part after `\X` was dropped. The linear dimension now records its
whole dimension line (`dim_axis`) and the `\X` layout falls back to it.
With DIMJUST 3 or 4 the text runs along an extension line, so its normal
is across the dimension line's: the text no longer moves onto the
dimension line at the arrow, and the part below stacks under it in the
text's own frame.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
---------
Co-authored-by: Claude Opus 5.5 <[email protected]>
* Plot: JIS B4/B5/B6 and Japanese paper sizes
Japanese drafting uses the JIS B series: B4 257×364 mm, B5 182×257 mm and
B6 128×182 mm. The paper table only had the ISO sizes, so a JIS B5 drawing
plotted about 7 mm short in each direction. B4/B5/B6 are now the JIS sizes (the
names Japanese Excel and drawings use) and the ISO ones stay reachable as
`B4 (ISO)`/`B5 (ISO)`; a drawing that stored the ISO sheet keeps its stored
size, and a caller that means ISO B5 says so.
Adds the Japanese papers the table lacked: Japanese Postcard (はがき,
100×148 mm), Japanese Double Postcard (往復はがき, 148×200 mm), Japanese
Envelope #3 (長形3号, 120×235 mm), Japanese Envelope Kaku #2 (角形2号,
240×332 mm) and 四六判 (127×188 mm). A6 was already an ISO sheet.
Paper names resolve case-insensitively and ignore spaces, hyphens, underscores
and parentheses (`B5 (JIS)`, `b5-jis`, `b5jis`), with the Japanese spellings as
aliases too (`はがき`, `往復はがき`, `長形3号`, `角形2号`, `四六判`). The
built-in plotters and the Page Setup/Plot paper combo pick the new sizes up
from PAPER_SIZES, and the PDF plot's MediaBox and the plot preview use them.
Tests: the render paper test pins every new size and alias, the ISO sizes keep
their values and the unknown-name fallback is unchanged; a new io test pins the
PDF MediaBox for each new paper (JIS B5 515.91×728.50 pt, はがき 283.46×419.53 pt,
ISO B4/B5 and the rest), and the plot-preview test checks that `B5` resolves to
JIS B5 and `B5 (ISO)` to ISO B5.
Docs: docs/plotters.md standard sizes and the `pagesetup`/PDFBOOK parameter
notes, and ROADMAP.md progress log + revision history, dated 2026-10-21.
* Plot: B4/B5/B6 stay ISO; JIS sizes by explicit name
Review follow-up: making the bare names mean JIS changed the ISO sizes for
every user. `B4`/`B5` are the ISO sizes again, an ISO B6 row (125×176 mm)
completes the bare series, and the JIS sheets (JIS P 0138, 257×364,
182×257 and 128×182 mm) are reachable only as `B4 (JIS)`/`JIS B4`,
`B5 (JIS)`/`JIS B5` and `B6 (JIS)`/`JIS B6`.
Drop the ambiguous bare `Postcard` and `Double Postcard` aliases; the name
and はがき/往復はがき say which postcard is meant. Drop the ROADMAP.md edit
(ROADMAP.md stays at origin/main's content).
The render and io paper tests, the plot-preview test and docs/plotters.md
follow the new mapping; the Japanese stationery sizes and their はがき/
往復はがき/長形3号/角形2号/四六判 spellings are unchanged.
Still safe for stored papers: a page setup keeps the canonical paper name
with its width/height, DXF groups 44/45 round-trip those sizes, and the ISO
canonical names (and the JIS rows by name) did not change.
* Plot: full-width paper names resolve like their ASCII forms
A Japanese keyboard or IME gives B5 (JIS); fold U+FF01..U+FF5E to ASCII (and the
ideographic space to a space) before the existing normalisation, with a test.
---------
Co-authored-by: midasdf <[email protected]>
triangulate_evenodd stops once its triangles pass 6,000,000 points (or
returns none past 200,000 edges) without telling the caller, so a fill
drawn in part left DisplayList::truncated false.
- fill: triangulate_evenodd_whole also says whether the triangles cover
the whole region. The cap check moves to before the next slab that adds
triangles, so the triangles are unchanged and a region whose last slab
passes the cap counts as whole. triangulate_evenodd keeps its signature.
- Builder::region_tris marks the list truncated when a region is not
whole; hatch fills and backgrounds, MLINE fills, Prim::Fill and WIPEOUT
go through it.
- PolyClip keeps whether its region triangles are whole. A fill crossing
the outline of a capped region is cut against the triangles there are,
so it is drawn too little and never past the outline; may_leave_out
says when that can happen and clip_prim marks the list.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Conflicts in crates/doc/src/extents.rs and crates/engine/src/select.rs.
extents.rs: main's `Contents` (a block's geometry, its constant attribute
values by tag and its definitions) is what the block caches hold, and it is
measured with the viewport's frozen layers: `contents` takes `frozen` and the
separate `in_drawing` cache, a constant value on a layer frozen in the
viewport is left out as the renderer leaves it out, and a clipped reference
takes the drawing's contents from `in_drawing` (`drawing_contents`).
select.rs: main's file with the viewport laid over it. A block reference is
hit on what is drawn (#3445), so through a viewport on what that viewport
draws (`insert_geometry` and `insert_fill_hits_box` take the frozen layers).
The frame of blank text (#2810) stays in the box a viewport gives. `pick_scanning`
tests its candidates through one `ViewportBounds`.
One test follows #3445: a clipped reference whose frame is hidden
(XCLIPFRAME 0) is no longer hit on its boundary, in any viewport, since the
boundary is not drawn; the window around it still takes it.
Two review findings on the plot style point limit:
- pattern_within kept going after a triangle set `full`; a later
triangle over the pattern cell allowance then returned None, so the
list was not marked truncated and later outlines were still styled.
It now returns as soon as `full` is set; the cells running out first
still keeps the fill solid, as before.
- Viewport contents were styled within the build's whole point limit,
then clipped into the layout's list, which already holds the objects
drawn before the viewport. Outlines that fit the contents' list but
not the layout's stopped the append part-way and spent the build,
dropping the last contents and the layout objects after them. They
are now styled within the room the layout's list has left.
Part of #1603.
Co-Authored-By: Claude Opus 5.5 <[email protected]>