mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-26 12:21:08 +01:00
Plug-ins: check every number in the type styles a filter writes
Type a filter returned went to layout with its character and paragraph styles only parsed, and a style equal to one of the type's runs was not checked at all, so a filter could set leading of 1e9, 100,000 tab stops, a scale of 0 or a Kinsoku set the document does not have. - The ranges the character and paragraph style commands keep each attribute to move to CharStyle::check_ranges and ParaStyle::check_ranges in vectorcraft-doc (text/attr_ranges.rs). charStyle.new, charStyle.edit, charStyle.setAttrs and the paragraph style commands call them, and so does the filter write path, for every run and paragraph style, including one the type already has. - A paragraph style's custom Kinsoku set must name one of the document's sets, and takes that set's characters. - The character style commands now also refuse tracking and kerning outside -1000 to 10000, rotation outside -360 to 360, a miter limit outside 1 to 500, Small Caps outside 1 to 200, negative dash lengths and a variable font axis setting that is not a number. Each refusal names the object and the field, and the document does not change. Docs: docs/plugins.md, docs/mcp.md, docs/target-app-parity.md.
This commit is contained in:
1 parent
ed50dd06f4
commit
945d0a42b0
12 files changed
+422
-158
No files matched your search
+4
-2
@@ -13126,8 +13126,10 @@ its features turned off, distinct from unset.
|
||||
not a global swatch of the document, a stroke weight outside 0 to 4000000, more than 256 feature tags and an
|
||||
OpenType feature tag the shaper does not know, unless the style or the text it is made from already has that value.
|
||||
They also reject a size outside 0.1 to 1296, explicit leading outside 0.1 to 5000, horizontal or vertical scale
|
||||
outside 1 to 10000, and baseline shift or Tate-chu-yoko offsets outside -1296 to 1296. `leading: null` keeps
|
||||
Auto leading. An invalid value leaves the style, its text, and Undo history unchanged.
|
||||
outside 1 to 10000, baseline shift or Tate-chu-yoko offsets outside -1296 to 1296, tracking or kerning
|
||||
outside -1000 to 10000, rotation outside -360 to 360, a stroke miter limit outside 1 to 500, a
|
||||
stroke dash length outside 0 to 4000000 or offset outside -4000000 to 4000000, Small Caps outside 1 to 200 and a
|
||||
variable font axis setting that is not a number. `leading: null` keeps Auto leading. An invalid value leaves the style, its text, and Undo history unchanged.
|
||||
The New Character Style dialog accepts the same character fields and starts with the selected text's
|
||||
captured attributes. Without selected text, it starts with the character defaults for the interface language
|
||||
(including `charAlign: "emBoxCenter"` in Japanese); changing a Basic field keeps other seeded attributes.
|
||||
|
||||
+15
-8
@@ -759,14 +759,21 @@ exactly as given, or with the fields it changes; a field it leaves out keeps its
|
||||
by the change from its given transform, so an image's distorted corners move with it.
|
||||
- `text.runs` replaces the type's runs: each is `{text, style, inline?}` with the character attributes as the native
|
||||
file stores them, and an attribute the host doesn't know is refused. There is at least one run, at most 4,096, and at
|
||||
most 256 KiB of UTF-8 text; the runs written in one output take at most 16 MiB. A style that none of the type's runs
|
||||
has needs a font family of 1 to 256 printable characters, a size from 0.1 to 1296 pt, and fills and strokes that a
|
||||
path's appearance would take. Inline graphics stay where they were: the runs keep each `inline` run as it was given,
|
||||
in the same order. The characters of threaded type, and of type with ruby, can't change, though their attributes can.
|
||||
The runs and paragraphs of type given with `truncated: true` can't change.
|
||||
- `text.paragraphs` holds one paragraph style per paragraph of the new text. With `text.runs` alone, each paragraph
|
||||
keeps its style when the number of paragraphs stays the same; runs that add or join paragraphs move the styles with
|
||||
the text, as typing the same change does.
|
||||
most 256 KiB of UTF-8 text; the runs written in one output take at most 16 MiB. Every number in every run's style is
|
||||
checked against the range `charStyle.new` keeps it to, including a style one of the type's runs already has: size
|
||||
0.1 to 1296 pt, leading 0.1 to 5000 pt, tracking and kerning -1000 to 10000, horizontal and vertical scale 1 to
|
||||
10000 %, baseline shift -1296 to 1296 pt, rotation -360 to 360°, and the ranges `docs/mcp.md` gives for
|
||||
`charStyle.new` for the East Asian, Warichu and stroke attributes. A style that none of the type's runs has also needs a font family of 1 to 256
|
||||
printable characters, and fills and strokes that a path's appearance would take. Inline graphics stay where they
|
||||
were: the runs keep each `inline` run as it was given, in the same order. The characters of threaded type, and of
|
||||
type with ruby, can't change, though their attributes can. The runs and paragraphs of type given with
|
||||
`truncated: true` can't change.
|
||||
- `text.paragraphs` holds one paragraph style per paragraph of the new text, each checked as `paraStyle.new` checks
|
||||
its attributes: indents and space before and after within ±1296 pt, the Hyphenation and Justification options in
|
||||
their ranges, at most 256 tab stops at 0 to 100,000 pt, and a custom Kinsoku set only by the name of one of the
|
||||
document's sets, whose characters the paragraph takes. With `text.runs` alone, each paragraph keeps its style when
|
||||
the number of paragraphs stays the same; runs that add or join paragraphs move the styles with the text, as typing
|
||||
the same change does.
|
||||
- `opacity` is a number from 0 to 1.
|
||||
- `symbolId` names a symbol in the document. An instance that shows another symbol loses its overrides, as Replace
|
||||
Symbol does.
|
||||
|
||||
@@ -828,7 +828,7 @@ since 2026-10-01.
|
||||
- **Composite fonts' custom character sets:** Type › Composite Fonts… › Custom adds named character sets to a composite font, each setting the characters it lists in its own font, style, size, baseline and scales ahead of their class; the later of two sets that list a character sets it ([the help page](https://web.archive.org/web/20220911143322/https://helpx.adobe.com/pdf/cs6/illustrator_reference.pdf#page=348)). Characters are added by Direct Entry or by Unicode code and deleted one at a time; the sets are saved with the document and in `.vccomposite` files (`custom` in `type.compositeFonts.set`). Evidence: `tests::composite::custom_character_sets_take_their_characters_first` (`crates/text`), `compositefonts::tests::custom_character_sets_set_their_characters` (`crates/engine`), `dialogs::composite_fonts::tests::custom_character_sets_are_edited_in_the_dialog` (`crates/ui-egui`). Scores unchanged (estimated).
|
||||
- **Composite fonts' Show Sample:** Type › Composite Fonts… › Show Sample draws the font picked in a line of sample text with lines for its ICF box, em box, baseline, cap height, highest ascent and lowest descent, highest ascender and x-height, each shown or hidden by its button, at the magnification Zoom picks ([Creating composite fonts](https://help.adobe.com/archive/en_US/illustrator/cs4/illustrator_cs4_help.pdf#page=352)). The sample text, the zoom steps and what each line measures are VectorCraft's own. Evidence: `dialogs::composite_fonts::tests::sample_lines_follow_the_parts`, `show_sample_shows_and_hides_the_sample` and `sample_fields_are_set_and_checked` (`crates/ui-egui`). Scores unchanged (estimated).
|
||||
- **Character-style Auto leading:** capture and explicit style attributes retain Auto as a reset, distinct from omitted leading. Redefine and later numeric updates preserve local leading overrides; the Character Styles marker recognizes Auto correctly. Regression assertions cover partial definitions, Undo/Redo and native save/load serialization. Public references: [Character and paragraph styles](https://helpx.adobe.com/illustrator/using/character-paragraph-styles.html) and [Leading](https://helpx.adobe.com/illustrator/using/line-character-spacing.html).
|
||||
- **Character-style numeric bounds:** `charStyle.new`, `charStyle.edit`, and `charStyle.setAttrs` accept size from 0.1 to 1296 pt, explicit leading from 0.1 to 5000 pt, horizontal and vertical scale from 1% to 10,000%, and baseline shift and Tate-chu-yoko offsets from -1296 to 1296 pt. Out-of-range input leaves the style and Undo history unchanged; Auto leading remains available. These limits match the Character panel controls.
|
||||
- **Character-style numeric bounds:** `charStyle.new`, `charStyle.edit`, and `charStyle.setAttrs` accept size from 0.1 to 1296 pt, explicit leading from 0.1 to 5000 pt, horizontal and vertical scale from 1% to 10,000%, baseline shift and Tate-chu-yoko offsets from -1296 to 1296 pt, tracking and kerning from -1000 to 10,000, rotation from -360° to 360°, a stroke miter limit from 1 to 500, Small Caps from 1% to 200%, finite stroke dashes and variable font axis settings. Out-of-range input leaves the style and Undo history unchanged; Auto leading remains available. These limits match the Character panel controls.
|
||||
- **Character Style Options, General and Basic Character Formats:** the dialog edits a style's name and stored character formats together. Empty fields remain unset, checkboxes show an indeterminate unset state, Basic's Reset Panel clears its explicit settings, and Preview can be canceled without changing history. OK saves one undo step; New Character Style offers the same fields from captured text or the interface language's defaults without a selection. Public reference: [Character and paragraph styles](https://helpx.adobe.com/illustrator/using/character-paragraph-styles.html).
|
||||
- **Character Style Options, Advanced Character Formats:** Character Style Options and New Character Style set a style's Horizontal Scale and Vertical Scale (1% to 10,000%), Baseline Shift (-1296 pt to 1296 pt), the Tate-chu-yoko Settings Up/Down and Left/Right (-1296 pt to 1296 pt), Character Rotation (stored from -180° to 180°) and Language; text that uses the style takes them and keeps its local overrides. Empty fields remain unset, an explicit 100%, 0 pt, 0° or English: USA stays distinct from unset, and the section's Reset Panel clears only these seven. Language sets the language the characters are shaped in, not hyphenation or spelling. Public references: [Character and paragraph styles](https://helpx.adobe.com/illustrator/using/character-paragraph-styles.html) and [Format East Asian characters](https://helpx.adobe.com/illustrator/using/formatting-asian-characters.html).
|
||||
- **Character Style Options, Character Color and OpenType Features:** Character Style Options and New Character Style set a style's fill and stroke (None or a document swatch; a global swatch stays linked, with a Tint from 0% to 100%), stroke Weight, Overprint Fill and Overprint Stroke, and its Figure, Position, Standard and Discretionary Ligatures, Contextual, Stylistic and Titling Alternates, Swash, Ordinals, Fractions and Stylistic Sets 1 to 20; text that uses the style takes them and keeps its local overrides, and editing a global swatch later updates the style and its text. Empty controls remain unset, an explicit None, off, Default Figure or Default Position stays distinct from unset, each stylistic set is on, off or unset, a gradient or pattern paint stays until another paint is chosen, a changed OpenType control keeps the style's other feature tags, and each section's Reset Panel clears only its own attributes. Public references: [Character and paragraph styles](https://helpx.adobe.com/illustrator/using/character-paragraph-styles.html) and [Format text with OpenType features](https://helpx.adobe.com/illustrator/desktop/design-with-text/special-characters-glyphs/format-text-with-opentype-features.html).
|
||||
@@ -2662,7 +2662,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur
|
||||
- **Bulk memory fuzz cases use the host's fuel constants:** `crates/engine/tests/plugin_fuzz.rs` samples runs around one slice of the instruction budget and lengths around the bytes one unit of fuel pays for with `vectorcraft_plugins`' own `FUEL_SLICE` and `BYTES_COPIED_PER_FUEL`, so the sampled cases move when either value changes. Regressions: `crates/engine/tests/plugin_fuzz.rs`. Scores and hours unchanged.
|
||||
- **Plug-in permissions (G17):** a manifest may list `permissions` (`doc.read`, `doc.write`, `state`, `effect.render`, `export.write`; the first three follow storytold/photocraft#662) and an `api` level; without the list a plug-in gets what its kind implies and installs as before. Install Plug-in… and File › Open show the name, id, version, file SHA-256 and each permission in plain words, with control and bidirectional characters escaped, and install nothing on Cancel; for a plug-in that lists permissions, `plugin.install` needs `grant` and folders install it only when it is granted. The grant is kept with the module's hash, a module asking for more asks again, and a filter run refuses output its permissions don't allow. Regressions: `crates/plugins/src/permissions.rs`, `crates/plugins/src/manifest.rs`, `crates/engine/src/tests/plugins.rs`, `crates/engine/tests/plugin_fuzz.rs`, `crates/ui-egui/src/tests/plugins.rs`. Scores and hours unchanged.
|
||||
- **Filter plug-ins read type, images and symbol instances (G17, #4333):** a filter at plug-in API level 2 lists `inputs` (`type`, `image`, `symbolInstance`) with `doc.read` in its `permissions`, so installing it asks for approval, and is also given the selected objects of those kinds, read only: type with its runs, character and paragraph attributes (no text past 256 KiB or 4,096 runs or paragraphs, or 16 MiB of runs over the input), images with their size, color mode and, when embedded and at most 1 MiB in base64 (16 MiB over the input), their RGBA pixels (a CMYK image's through the working CMYK profile; never a linked file's), and symbol instances with their symbol and transform. The objects come in paint order from the bottom, and an image that reaches the decoder counts toward the 16 MiB of pixels even when decoding fails. Every object counts toward the input's half of the memory cap; one whose fields besides its pixels and runs don't fit fails the run naming it and its size, a path or compound path that doesn't fit fails it too, and so do more than 100,000 of these objects. Its output returns each as `{id}` or exactly as given; any change or omission is refused before the document changes. Filters without `inputs` get the same input as before, except that compound paths that clip a clip group and paths inside a group that clips one are left out for every filter. Regressions: `crates/plugins/src/objects/tests.rs`, `crates/plugins/src/manifest.rs`, `crates/engine/src/tests/plugins.rs`, `crates/engine/tests/plugin_fuzz.rs`. Scores and hours unchanged.
|
||||
- **Filter plug-ins change type, images and symbol instances (G17):** a filter at plug-in API level 3 lists in `writes` the kinds among its `inputs` it may change, with `doc.write` in its `permissions`, and may return those objects with changed fields: type's runs (characters and character attributes, inline graphics kept as they were) and paragraph styles, an image's transform and opacity, an instance's transform and the symbol it shows (one already in the document; its overrides are cleared as Replace Symbol clears them), and each one's name. Runs are held to the input's limits (4,096 runs and 256 KiB of text a type object, 16 MiB over the output), a style of the filter's own needs a font family and a size of 0.1 to 1296 pt and its paints are checked as a path's are, and the characters of threaded type and type with ruby stay as they were. Any other changed field, or a value out of range, refuses the run naming the object and the field, with the document unchanged. The changes are one undo step, and an output that changes nothing, for every filter, records none. Images now also come with their `opacity`. Regressions: `crates/plugins/src/objects/tests.rs`, `crates/plugins/src/manifest.rs`, `crates/engine/src/tests/plugins.rs`. Scores and hours unchanged.
|
||||
- **Filter plug-ins change type, images and symbol instances (G17):** a filter at plug-in API level 3 lists in `writes` the kinds among its `inputs` it may change, with `doc.write` in its `permissions`, and may return those objects with changed fields: type's runs (characters and character attributes, inline graphics kept as they were) and paragraph styles, an image's transform and opacity, an instance's transform and the symbol it shows (one already in the document; its overrides are cleared as Replace Symbol clears them), and each one's name. Runs are held to the input's limits (4,096 runs and 256 KiB of text a type object, 16 MiB over the output), every number in every run's and paragraph's style is checked against the range `charStyle.new` and `paraStyle.new` keep it to (one shared check, also for a style the type already has), a custom Kinsoku set must be one of the document's, a style of the filter's own needs a font family and its paints are checked as a path's are, and the characters of threaded type and type with ruby stay as they were. Any other changed field, or a value out of range, refuses the run naming the object and the field, with the document unchanged. The changes are one undo step, and an output that changes nothing, for every filter, records none. Images now also come with their `opacity`. Regressions: `crates/plugins/src/objects/tests.rs`, `crates/plugins/src/manifest.rs`, `crates/engine/src/tests/plugins.rs`. Scores and hours unchanged.
|
||||
- **Plug-in grants cover one module (G17):** a grant counts only for the module with the id and SHA-256 it records. A module that lists permissions and has other bytes under the same id needs a new approval, even with the same permissions: `plugin.inspect` reports `needsApproval`, `plugin.install` refuses it without `grant`, Install Plug-in… and File › Open ask again, and the plug-in store and plug-in folders skip it. A module with a missing or empty permissions list needs no grant; without the list, it gets its kind's implied permissions. A grant with a malformed hash covers nothing. Regressions: `crates/plugins/src/permissions.rs`, `crates/engine/src/tests/plugins.rs`, `crates/ui-egui/src/tests/plugins.rs`. Scores and hours unchanged.
|
||||
- **Plug-in approval needs a person (G17):** a plug-in's permissions and heavy budget are approved in a dialog that only a person can confirm: the control channel, MCP and injected input are refused, and `plugin.install` takes `grant` or `allowHeavy` only with that approval. `vectorcraft-cli mcp` and `run` refuse them unless started with `--allow-plugin-grants`. Regressions: `crates/engine/src/tests/plugins.rs`, `crates/ui-egui/src/tests/automation.rs`, `apps/vectorcraft-cli/tests/it/cli.rs`. Scores and hours unchanged.
|
||||
- **A dialog's OK runs what it was opened for:** `ui.dialog.set`, and MCP's `answer_dialog` through it, can set a `__` field only when it is a control of that kind of dialog (a section or tab shown, a link between two fields, a name or search being typed). Every other `__` field, such as the `__command` and `__params` of a confirmation or the generic parameter dialog, a plug-in command dialog's `__command` and `__plugin`, or the paste a swatch conflict waits to finish, is refused with "the `<kind>` dialog cannot set protected field `<field>`"; the request sets no field, and with `action: "confirm"` OK does not run. Regressions: `crates/ui-egui/src/tests/automation.rs`, `crates/ui-egui/src/control/tests.rs`. Scores and hours unchanged.
|
||||
|
||||
Reference in new issue
Block a user