Commit Graph
6869 Commits
Author SHA1 Message Date
bflatastic 13bac047f3 EPS import: spend keeps its own doc comment 2026-10-31 19:43:17 +07:00
marshiyar bd0601c780 EPS import: big operators are charged for the bytes and objects they touch (#3584)
putinterval, copy of a string, roll, counttomark, clear to mark and cvn
worked on up to 4 MiB or 100,000 objects for the one operation each is charged,
so a small file looped over them could keep the importer busy for hours within
the operation budget. Each now spends one operation per 256 bytes or objects.

Fixes #3584
2026-10-31 19:43:17 +07:00
bflatastic 9efe6dc764 PDF import: a font name's family is looked for at no more than 16 of its hyphens
The name comes from the file, and each lookup walks it, so a name made of thousands of hyphens took quadratic time.
2026-10-31 19:43:17 +07:00
Don Omondi 1883e5342d PDF import: find installed fonts named with hyphens or a composite font's CMap
- A composite (Type 0) font is noted by its descendant CIDFont's BaseFont
  (ISO 32000-1 9.7.4.1), not its own BaseFont, which ends in "-" and the
  CMap name (9.7.6.1, e.g. Name-Identity-H); without one, the CMap name is
  taken off the end of the BaseFont.
- A font name's family is the longest part before a hyphen (or the comma of
  Arial,Bold) that names an available family, so Noto-Sans-Bold is Noto
  Sans, Bold and Noto-Sans-CJK-JP is Noto Sans CJK JP; a shorter family
  still matches when no longer one is available.
- A missing font is split only at a comma or before the first part that is a
  style word (Helvetica-BoldOblique); otherwise the whole name is its family
  (MS-PGothic is reported as MS PGothic, not MS).

Synthetic tests (no host fonts): Families::of builds the family list.

# Conflicts:
#	docs/file-format-parity.md
#	docs/gaps.md
#	docs/type-parity.md
2026-10-31 19:43:17 +07:00
SusieeTheFemboyandClaude Opus 5.5 2e7b2b7f96 SVG import: an embedded SVG image gets the feConvolveMatrix order check too
Files::svg parsed nested SVG images with usvg without the check the top-level
import makes, so an overflowing order inside an <image> still reached usvg's multiply.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 19:43:17 +07:00
SusieeTheFemboyandGLM-5.3-Flash c7dc443ee1 SVG import: a feConvolveMatrix order that overflows usvg's multiply is refused
usvg 0.48 casts the filter's order attribute through i32, so a value like
1066570220609 saturates and the u32 order_x * order_y multiply overflows.
Only debug and overflow-checks builds panic on that; release builds already
import the file — the multiply wraps, and VectorCraft drops the filter as
an unsupported primitive with a warning, so nothing reaches the document,
render or export (observed on main in a --release build: both repro files
import without error; with a one-entry kernelMatrix the wrapped product
2147483647² mod 2³² = 1 even passes usvg's length check and leaves a filter
claiming a 2147483647×2147483647 kernel, still dropped downstream).

The import now parses order the way usvg does (svgtypes numbers, the same
as-i32 cast with its saturation, the first side defaulting the second, both
positive or both back to the 3×3 default) and refuses exactly the one case:
when the product of the two sides overflows u32 (checked_mul). Any order
usvg can multiply keeps importing as before, however large on its own, and
a missing, unparseable or non-positive order still falls back to 3.

Regression tests cover the overflow repros, the release wrap case, large
but fitting orders (100, 80 80, 65535 65535, 2147483647 1), the
pass-through shapes, and sane kernels, in debug and in release.

Co-Authored-By: GLM-5.3-Flash <noreply@z.ai>
2026-10-31 19:43:17 +07:00
Don Omondi 1679318034 Type: lam-alef highlight follow-up: optional features, all marks, exact ligature test (#394)
Highlight Alternate Glyphs no longer drops a lam-alef cluster's glyphs
outright: the ligature is clear when required shaping, or shaping with
liga left on (older fonts), gives it, so an optional feature such as
salt that changes it is highlighted again. is_lam_alef takes any
combining mark by Unicode general category (Arabic Extended-A/B/C
included) instead of a partial list. The test font maps the fatha to a
mark and skips marks in its ligature, so the mark-spanning test checks
the exact ligature glyph and cluster; it gains a salt lookup and test.

Also a one-line equivalent nonminimal_bool repair in pathops'
pathtools that strict Clippy needs on main.
2026-10-31 19:43:17 +07:00
NetterSilverandClaude Haiku 5.5 7ae9f2c4e5 Keep an empty text value in dataset CSV export and import
Found while testing crates/engine/src/cmd/variablecmds/csv.rs:146 (csv_escape) and :158-163 (cell_to_value)

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-31 19:43:17 +07:00
Don Omondi 22b1c6bc2e Fix #3085: DXF LAYOUT objects write only the group codes the DXF Reference defines
The PLOTSETTINGS part of each LAYOUT wrote the paper image origin as a point
(148 and 158), but the origin is two values at 148 (x) and 149 (y), and 158 is
not a PLOTSETTINGS code. Strict readers such as Autodesk Fusion can reject the
file. The ezdxf re-save the reporter found Fusion accepts differs from our export in
these objects, not in the geometry.

- 148/149 for the paper image origin
- shade plot mode, resolution level and DPI (76/77/78) from DXF 2004
- plot flag 1024 (model type) on the Model layout
- the plot style ACDBPLACEHOLDER without a subclass marker

Test r2000_and_later_files_have_the_structure_cad_apps_require checks the
required sections and table entries, handles below $HANDSEED, references
that resolve, and LAYOUT group codes.

# Conflicts:
#	docs/file-format-parity.md
2026-10-31 19:43:17 +07:00
marshiyar 4861fb9d85 Engine guard: a recovered panic restores every document's undo history and the active document (#3599)
run_guarded put back only the active document's art, selection and interaction.
An undo step pushed before the panic stayed (Undo then stepped to a state equal
to the current one) and Redo was lost; other documents a command touched kept
their half-applied edits; the active document was restored by index.

It now snapshots every open document with its history and restores them, and
the active document by uid.

Fixes #3599
2026-10-31 19:43:17 +07:00
Don Omondi 7403003fb1 fix(eps): an envelope's contents being edited aren't read as art
An envelope whose contents are being edited is written the other way
round from one that isn't: its contents, a group on `%_` lines, then
its dictionary, which holds the mesh that shapes them. Only a group of
meshes was left out before an envelope's dictionary, so those contents
were read as art and their undistorted shapes drew over the distorted
art that follows on plain lines (and that the page draws).

The group on `%_` lines before an envelope's dictionary is now left
out whatever it holds; text in it stays as hidden text, as the
dictionary's own source text does.

# Conflicts:
#	docs/file-format-parity.md
2026-10-31 19:43:17 +07:00
Don Omondi 5b15b3f56b fix(eps): a transparency set in a dictionary's art stays after it
Art inside a dictionary in the editing data, such as an area text's
frame (`/ConfiningPath`) or a mask's art, can set a transparency
(`Xy`). The writer goes on from it: the objects after an area text
whose frame sets one have no `Xy` of their own. The reader dropped
that state when the dictionary closed, so those objects took the
transparency before the dictionary instead; in a user's file a Lighten
glow before an area text made everything after it fade into the light
background.

The last transparency the art inside a dictionary sets is now the
current one after it (and the enclosing dictionary's). Dictionaries
outside the layers (the setup's styles) are left as they were.

# Conflicts:
#	docs/file-format-parity.md
2026-10-31 19:43:17 +07:00
Don Omondi 75d2736a2a fix(eps): area type's first line goes where the file lays it out
Area type made from the editing data's text document was laid out with
its first baseline the font's ascent below the frame's top. The text
document keeps where each of its lines starts, and the file's page draws
them there: for some fonts the first line sits well above the font's
ascent (Oswald's at about its cap height), so headings came in lower
than on the page and the layers were taken to differ from it.

When the file's first line is more than half a point from where it is
laid out here, the first baseline is now fixed where the file has it
(First Baseline: Fixed), measured in the text document's own frame so a
copied object's type moves with its frame.

# Conflicts:
#	docs/file-format-parity.md
2026-10-31 19:43:17 +07:00
Don Omondi 3602bd6ea3 fix(ai-import): type from the text document takes its character style's attributes
Type made from an Illustrator file's text document took each character
attribute its run doesn't set from the document's base attributes, not
from the character style the run names ([Normal Character Style] or
another of the file's). Where the two differ the type came in wrong: a
file whose base fill is white and whose Normal Character Style is black
came in with its text white, invisible, so the layers differed from the
page wherever the page's own type didn't stand in for it.

A run now takes its own attributes, then its character style's (and the
styles that one is based on, up to 16), then the document's.
2026-10-31 19:43:17 +07:00
Don Omondi acb5a9721b pathops: simplify the add-anchors segment check for clippy's nonminimal_bool
Pre-existing lint on main that stops cargo xtask ci at clippy; the same
one-line change other open PRs carry.
2026-10-31 19:43:17 +07:00
NetterSilverandClaude Haiku 5.5 18709b0b63 Reject multiple leading '#' in the colour panel hex parser
Found while testing crates/ui-egui/src/panels/color.rs:199-205 (parse_hex)

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-31 19:43:17 +07:00
NetterSilverandClaude Haiku 5.5 d0e1a045c1 Show 0.00 instead of -0.00 in Unit::readout for tiny negatives
Found while testing crates/doc/src/units.rs:163-165 (readout)

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-31 19:43:17 +07:00
NetterSilverandClaude Haiku 5.5 a5a7c4638a Fix closing smart quote read as opening after same-glyph quote
Found while testing crates/doc/src/setup.rs:111-113 (Quotes::opens / is_open), used by Quotes::apply at :122-131

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-31 19:43:17 +07:00
Taha-Mahmoodi f9a523b55e Docs: Snapping is no longer a main gap in the parity table (#2530)
The tangent and perpendicular case is done for every tool the public pages name; its evidence stays in the revision row and in gaps.md and ui-parity.md.
2026-10-31 19:43:17 +07:00
Taha-Mahmoodi 63b685758f Snapping: a line end dragged with Direct Selection snaps square to straight paths and tangent to curves (#2530) 2026-10-31 19:43:17 +07:00
Taha-Mahmoodi 811ba8727b Fix #3604: automation file access refuses an NTFS alternate data stream name on Windows
With write root ...\out, a save to ...\out\x.svg:evil was accepted: it stays inside the root, but writes a hidden stream no folder listing shows. A ':' in any name after the drive is now refused with the device names. The check is a plain name test, so it is covered on every platform; the check-then-open race (item 1 of the report) is a documented limitation and is not touched.
2026-10-31 19:43:17 +07:00
marshiyar feb12cf312 Swatch libraries: a device name with an extension gets the - before its first dot (#3602)
CON.txt became CON.txt-.json, whose first part is still CON. It is now CON-.txt.json.
2026-10-31 19:43:17 +07:00
marshiyar 64ffab00a9 Swatch libraries: a library titled with a Windows device name is saved under another name (#3602)
library_file_name kept CON, NUL, COM1 and the like, which Windows treats as
devices, not files. It now adds a - after such a name (CON-.json).

Part of #3602
2026-10-31 19:43:16 +07:00
Taha-Mahmoodi f65d28378f Fix #995: a width-profile stroke keeps its shape when the view zooms out
The canvas keeps a hairline visible by raising a stroke's weight to half a device pixel. A width profile multiplies that weight, so a 1 pt stroke with a 6x width point swelled to twice its size at 25% zoom and shrank back on zooming in. The minimum now goes to the profile's widest point instead; plain strokes are unchanged.
2026-10-31 19:43:16 +07:00
Taha-Mahmoodi 59eb658fd7 Fix #2651: Grid Repeat Options has a Preview checkbox
The grid options' public page lists a Preview option: the repeat on the canvas follows the fields while the dialog is open. Object > Repeat > Options had none, so a change showed only after OK. Now a Grid Repeat's dialog has the checkbox: Cancel puts the original back without a history step, OK keeps the previewed values as one undo step. Radial and Mirror Repeat Options are left as they are, since their public pages list no Preview.
2026-10-31 19:43:16 +07:00
bflatastic 2c28ccf020 Gradient mesh: flat pieces follow the quad budget's subdivision
A mesh over the quad budget is cut coarser than asked (#3592); its flat pieces now use the same subdivision, so each patch takes its own quads.
2026-10-31 19:43:16 +07:00
Don Omondi 9259434a89 SVG export: a gradient mesh patch is cut no finer than its colour changes
Each patch of a gradient mesh was cut into 8 x 8 flat quads for SVG export,
Object > Expand and the other outputs that cannot shade a mesh, whatever its
colours, so a patch of one colour became 64 identical pieces. Neighbouring
quads are now joined into square blocks wherever the colour changes by no
more than about one 8-bit step across the block; the block's outline runs
through its quads' corners, and a patch that folds over itself is not joined.
2026-10-31 19:43:16 +07:00
Taha-Mahmoodi a1a3a99104 Fix #3592: a gradient mesh from a file is budgeted at about a million quads
A mesh read from a file can have any number of patches, and the view any zoom: a 150 x 150 mesh from a 3 MB file exported at 20x asked for about 23 million quads (2 GB), and the command's own cap of 50 rows and columns does not apply to a loaded one. One tessellation now makes at most 1,048,576 quads, the subdivision per patch giving way before that, and a mesh with more patches than that is malformed, like a point count that does not fit.
2026-10-31 19:43:16 +07:00
dotCooCoo b13b3260cd Keyboard Shortcuts: a shortcut on the Turkish Q quotation-mark key shows " and runs
Squashed from #4851 onto main.
2026-10-31 19:43:16 +07:00
dotCooCoo f28de75a22 Shortcuts: an exact Shift binding for the typed character wins over a plain binding at Shift+Comma or Shift+Period 2026-10-31 19:43:16 +07:00
dotCooCoo 26173437b9 i18n: Bosnian paint-chip tips name Shift+, and Shift+.
The Bosnian catalog still carried the Color (,) and Gradient (.) rows, which no longer match the toolbar's tips. It now translates Color (, or Shift+,) and Gradient (. or Shift+.) like the other catalogs.
2026-10-31 19:43:16 +07:00
dotCooCoo 64c776af4c Shortcuts: a bound layout candidate for Shift+Period or Shift+Comma wins over the key position 2026-10-31 19:43:16 +07:00
dotCooCoo 55108efef4 Toolbar: the paint-chip tips name Shift+, and Shift+. instead of < and >
The Color and Gradient tips now read "Color (, or Shift+,)" and
"Gradient (. or Shift+.)". The shortcuts follow the key positions, so on
layouts where Shift at those keys types another character the tips name
the keys to press. The 25 catalogs with these rows and the toolbar
accessibility test follow.
2026-10-31 19:43:16 +07:00
dotCooCoo 021fa4a846 Shortcuts: Shift+Comma and Shift+Period follow their key positions only with Shift alone
The key-position match for Shift+Comma and Shift+Period now applies only
when Shift is the only modifier. Cmd/Ctrl+Shift and Alt+Shift presses at
those keys keep their logical key, so the type-size shortcuts on German-like
layouts behave as before. The typing test also checks that no paint command
runs while text is edited.
2026-10-31 19:43:16 +07:00
dotCooCoo 8363c815ec Perspective: a transform's overflow fallback keeps each entry's powers of two apart
When the conjugate a ∘ self ∘ a⁻¹ overflows, conjugated now forms every
entry of the product as a sum of terms whose factors are split into a
mantissa and a power of two, and scales the whole product by one power of
two from its w row at the end. Scaling each partial product to a largest
entry of 1 could round an entry to 0 that the next factor would restore,
so a projection with entries far apart in size, such as a scale by
(1e160, 1e-160) seen through the same scale, was removed and the art drew
flat.
2026-10-31 19:43:16 +07:00
dotCooCoo c711ad42f0 Perspective: a transform's overflow fallback scales each partial product
When the conjugate of a projection overflows, it is now formed one factor
at a time, and each partial product is divided by its largest entry
magnitude. Scaling the affine factors up front let the w row underflow to
0, so a scale by 2 seen through a move by 1e308 returned None and the
projection was removed, though its conjugate is finite.
2026-10-31 19:43:16 +07:00
dotCooCoo 375b413ba6 Perspective: a projection that a transform overflows keeps a w row of 1
When conjugating a projection overflows, the scaled-down result is now divided by the largest entry in its w row. A valid conjugate is no longer dropped by the determinant cutoff at the arbitrary scale, and every point of a kept projection passes the horizon test in apply instead of none.
2026-10-31 19:43:16 +07:00
dotCooCoo db38e2e114 Perspective: a projection that a transform overflows is scaled down or removed
When moving type or a symbol instance in perspective makes the
conjugated projection overflow, Homography::conjugated now forms the
product from factors scaled to a largest entry of 1 and returns it at
that scale, which maps every point to the same place. When even the
scaled result is not invertible, the transform removes the projection
and the art is drawn flat, instead of keeping the old projection while
the flat art moves.
2026-10-31 19:43:16 +07:00
dotCooCoo 3d345ff95b Geometry: a perspective point that overflows maps to nothing instead of infinity
Homography::apply checked that w is in front of the horizon but not the quotients, so a point with w just above 1e-9 and a large x or y, or a NaN w, mapped to an infinite or NaN point. apply now returns None unless the mapped point is finite. inverse, conjugated and affine_at return None when their result has an entry that is not finite.
2026-10-31 19:43:16 +07:00
dotCooCoo ae76455723 Perspective Selection: a move of loose art keeps its plane when 4 clears the active plane
The move drag remembers the plane it places loose art on. Pressing 4
during the drag, or dragging on after it, previews and commits the move
on that plane instead of dropping it. A 1-3 key pressed before the drag
threshold also sets the plane the move uses.
2026-10-31 19:43:16 +07:00
dotCooCoo c15874ba6e Perspective Selection: Shift constrains each object in its own plane
perspective.move takes constrain: true instead of a plane-space
direction. For each object, the command snaps the move to the nearest
axis or 45-degree diagonal of that object's own plane, so a selection on
several planes keeps every object on a line of its plane. The tool sends
the raw pointer with the flag.

On a diagonal, Snap to Grid now moves along the diagonal by the nearer
per-axis correction, so that edge lands on its gridline.
2026-10-31 19:43:16 +07:00
dotCooCoo 9f64452303 Perspective Selection: Snap to Grid keeps a Shift-constrained move on its axis or diagonal
perspective.move takes an optional constrain: [dx, dy], a plane-space
direction. For an in-plane move, Snap to Grid's correction is projected
onto that direction, so a move the Shift key constrains to a plane axis
or a 45-degree diagonal stays on that line when an object edge lies near
a gridline. The Perspective Selection tool sends the direction for
Shift moves and copies. Moves without the param behave as before.
2026-10-31 19:43:16 +07:00
dotCooCoo f677c60aba Perspective Selection: Shift constrains a move to the plane's axes and diagonals
Holding Shift while dragging objects with the Perspective Selection tool
snaps the move, in the plane's own coordinates, to the nearest plane axis
or 45 degree diagonal. This applies to plain moves and to Alt and
Ctrl+Alt copies. The preview, the final move and the measurement label
use the snapped point. Pressing or releasing Shift, pressing 5 and
pressing 1 to 4 during the drag recompute the preview from the pointer;
a move perpendicular to the plane is not constrained.
2026-10-31 19:43:15 +07:00
dotCooCoo 45b266c805 Appearance: Reduce to Basic Appearance finds the active row in the first selected object
The targets are in paint order, so the first selected object is not always the first target. The active row is now matched against the first selected object wherever it is among them.
2026-10-31 19:43:15 +07:00
dotCooCoo d9fefde061 Appearance: Reduce to Basic Appearance keeps the selected fill or stroke row
Reduce to Basic Appearance kept the topmost visible fill and stroke even
when another fill or stroke row was selected in the Appearance panel.
It now keeps the selected row in place of the topmost one of its kind,
and in each other selected object the row equal to it. With ids, or
with no selected row, it keeps the topmost ones as before.
2026-10-31 19:43:15 +07:00
dotCooCoo 3a7e81e6c3 Appearance: Add New Fill copies the selected fill row right above it
With a fill row selected in the Appearance panel, Add New Fill now
inserts a copy of that row directly above it and selects the new fill.
Rows already above the selected one stay where they are. Before, the
new fill was always a copy of the topmost fill, added at the top.

The selected row belongs to the first selected object. In a mixed
selection, an object that shares that row gets the copy above its own
equal row; an object that does not share it gets a copy of its top
fill on top, as before. With a stroke row selected, or with `ids` or
`target: "contents"`, Add New Fill works as before.

The panel drops rows that were Cmd- or Shift-clicked together when the
active row changes outside the panel, so after Add New Fill (button,
menu or shortcut) only the new fill is selected.
2026-10-31 19:43:15 +07:00
dotCooCoo 65b6606d90 Part of #3229: setting type in a font or style that isn't available warns
Squashed from #4866 onto main.
2026-10-31 19:43:15 +07:00
dotCooCoo 1f31b6ed4a Find Font: Change and Change All leave hidden and locked text alone
Squashed from #4852 onto main.
2026-10-31 19:43:15 +07:00
dotCooCoo 875d3301f5 Transparency: Make Opacity Mask over several layers masks their art
transparency.makeOpacityMask with two or more layers below the mask
object (or a layer and objects of other layers) wrapped the layers
themselves in a new top-level group, so a layer ended up inside a
group. A layer among several masked items now stands for its art: the
masked group takes the layer's visible, unlocked objects, a hidden,
locked or template layer gives none, and the layers stay where they
are. One layer under a mask object, or one layer alone, is masked as
before.
2026-10-31 19:43:15 +07:00
dotCooCoo dd83e063a4 Render: pattern tiles draw undecoded-image marks when the view does
Pattern tiles were drawn with the default render options, so an image
whose pixels cannot be decoded drew nothing inside a pattern fill even
when the render marks undecoded images, as the canvas does. Tiles now
follow the caller's mark_undecoded_images setting, and the tile cache
keys on it.

An opacity mask with such a pattern now treats the mark as part of the
mask, as it does for an undecodable image outside a pattern.
2026-10-31 19:43:15 +07:00