Type: new type made with a graphic style stays linked to it

With New Art Has Basic Appearance off and a basic graphic style picked
with nothing selected, only the first new type took the style. New type
was never linked to the style, so the next one inherited an unlinked
basic look and came out plain.

New type made with a graphic style's look now takes the style's opacity
and blend mode and is linked to it, as graphicStyle.apply does for type.
Other new type keeps its own opacity and blend mode.
This commit is contained in:
dotCooCoo committed 2026-12-04 21:42:28 -08:00
1 parent f26b870201
commit 2ce31c6d5d
5 files changed
+25 -6

No files matched your search

+1 -1
View File
@@ -174,7 +174,7 @@ pub fn specs() -> Vec<CommandSpec> {
"Create Text",
[],
None,
"{x, y, text, parent?: id (a shown, unlocked layer or group: the type goes on top of its contents, whatever the drawing mode; default: where the Type tools put new type), rotation?: deg clockwise about x, y (0: level), vertical?: bool = false, size?: pt 0.1..1296 (outside it: an error, and no type is made), font?: family, style? (default Regular, or the family's closest style when it has no Regular), color? (#rrggbbaa and #rgba are refused; size, font, style and color left out come from [Normal Character Style], the defaults unless the document redefined it), keepModel?: bool (as paint.setFill), area?: {width, height, fit?: none|autoHeight|shrinkText|block, fitMinPercent?, wordGap?, lineGap? (as text.areaOptions)}, placeholder?: bool (fill it with placeholder text instead, as the Type tools do with prefs placeholderText), justify?: \"auto\" (default: the start of each paragraph's direction)|\"left\"|\"center\"|\"right\"|\"justifyAll\" (point type: aligned on x, so \"center\" centres each line on the point and \"right\" ends it there; text.setStyle changes it later), leadingModel?: \"romanBaseline\"|\"emBoxTop\", charAlign?: \"romanBaseline\"|\"emBoxTop\"|\"emBoxCenter\"|\"emBoxBottom\"|\"icfTop\"|\"icfBottom\" (default: emBoxTop and emBoxCenter while the interface is in Japanese, else romanBaseline)} → {id, bounds: {x, y, width, height} (the new type's box as document.inspect reports it, after justify), overflow?: [id] (area type whose text doesn't fit its frame: the lines past it aren't drawn; left out when it fits), warning?: text (the font or style given isn't available: the type is drawn in the fallback font or the family's closest style)}; new area type gets Auto Size (fit autoHeight) when the autoSizeAreaType preference is on. When new art's template is more than one plain fill and stroke (New Art Has Basic Appearance off) or comes from a graphic style picked with nothing selected, the type takes its fills, strokes and effects, and with Override Character Color on its characters lose the fill and stroke those paint (a `color` given keeps the fill)",
"{x, y, text, parent?: id (a shown, unlocked layer or group: the type goes on top of its contents, whatever the drawing mode; default: where the Type tools put new type), rotation?: deg clockwise about x, y (0: level), vertical?: bool = false, size?: pt 0.1..1296 (outside it: an error, and no type is made), font?: family, style? (default Regular, or the family's closest style when it has no Regular), color? (#rrggbbaa and #rgba are refused; size, font, style and color left out come from [Normal Character Style], the defaults unless the document redefined it), keepModel?: bool (as paint.setFill), area?: {width, height, fit?: none|autoHeight|shrinkText|block, fitMinPercent?, wordGap?, lineGap? (as text.areaOptions)}, placeholder?: bool (fill it with placeholder text instead, as the Type tools do with prefs placeholderText), justify?: \"auto\" (default: the start of each paragraph's direction)|\"left\"|\"center\"|\"right\"|\"justifyAll\" (point type: aligned on x, so \"center\" centres each line on the point and \"right\" ends it there; text.setStyle changes it later), leadingModel?: \"romanBaseline\"|\"emBoxTop\", charAlign?: \"romanBaseline\"|\"emBoxTop\"|\"emBoxCenter\"|\"emBoxBottom\"|\"icfTop\"|\"icfBottom\" (default: emBoxTop and emBoxCenter while the interface is in Japanese, else romanBaseline)} → {id, bounds: {x, y, width, height} (the new type's box as document.inspect reports it, after justify), overflow?: [id] (area type whose text doesn't fit its frame: the lines past it aren't drawn; left out when it fits), warning?: text (the font or style given isn't available: the type is drawn in the fallback font or the family's closest style)}; new area type gets Auto Size (fit autoHeight) when the autoSizeAreaType preference is on. When new art's template is more than one plain fill and stroke (New Art Has Basic Appearance off) or comes from a graphic style picked with nothing selected, the type takes its fills, strokes and effects, and with Override Character Color on its characters lose the fill and stroke those paint (a `color` given keeps the fill); type with a style's look also takes the style's opacity and blend mode and is linked to it",
has_doc,
text_create
),
+2 -2
View File
@@ -291,7 +291,7 @@ impl NewArt {
}
/// Give new object `n` (in `d`) this look: its placed gradients land relative to its bounds, and
/// it links to the style (type keeps its own transparency).
/// it links to the style (type keeps its own transparency unless the look is a graphic style's).
pub(crate) fn apply(&self, d: &mut vectorcraft_doc::Document, n: &mut Node) {
n.appearance = self.appearance.clone().into();
if self.unit_box
@@ -300,7 +300,7 @@ impl NewArt {
{
n.appearance.rebase_gradients(GraphicStyle::UNIT_BOX, b);
}
if matches!(n.kind, NodeKind::Text(_)) {
if matches!(n.kind, NodeKind::Text(_)) && self.style.is_none() {
return;
}
(n.opacity, n.blend) = (self.opacity, self.blend);
+18
View File
@@ -558,3 +558,21 @@ fn a_graphic_style_clicked_with_nothing_selected_styles_the_next_type() {
assert_eq!(kept.appearance.effects.len(), 1);
assert_ne!(char_fill(&kept), Paint::None);
}
#[test]
fn a_basic_graphic_style_picked_with_basic_appearance_off_styles_each_new_type() {
let mut s = session();
let src = painted(&mut s, 20.0, "#ff0000", "#0000ff", 2.0);
let red = node(&s, src).appearance.fill_paint();
let name = run(&mut s, "graphicStyle.new", json!({"name": "Plain"}))["name"].as_str().unwrap().to_string();
run(&mut s, "appearance.setNewArtBasic", json!({"on": false}));
run(&mut s, "select.none", json!({}));
run(&mut s, "graphicStyle.apply", json!({"name": name}));
// The first type is linked to the style, so the next one, taking its look, gets it too.
for (y, text) in [(200, "one"), (250, "two")] {
let n = new_type(&mut s, json!({"x": 200, "y": y, "text": text}));
assert_eq!(n.appearance.fill_paint(), red, "{text}");
assert_eq!(s.selection_graphic_style().map(|(g, linked)| (g.name.clone(), linked)), Some((name.clone(), true)), "{text}");
run(&mut s, "select.none", json!({}));
}
}
+3 -2
View File
@@ -11562,8 +11562,9 @@ resets it.
New type (`text.create`) takes the template's fills, strokes and effects when the template is more than one plain fill
and stroke or comes from a graphic style; otherwise it has no fills or strokes of its own and its characters keep their
color. With Override Character Color on, its characters lose the fill and stroke the template paints, as when a
graphic style is applied to type; a `color` given to `text.create` keeps the characters' fill. The type keeps its own
opacity and blend mode.
graphic style is applied to type; a `color` given to `text.create` keeps the characters' fill. Type made with a graphic
style's look takes the style's opacity and blend mode and is linked to it; otherwise the type keeps its own opacity and
blend mode.
`appearance.setNewArtBasic` rejects an `on` value that is not a boolean. Omitting `on` toggles the current preference.
`appearance.setNewArt {fill?, stroke?, weight?, cap?, join?, miterLimit?, dash?, dashOffset?, fillOverprint?,
strokeOverprint?}` sets new art's fill, stroke and stroke options whatever is selected, and leaves the selection, its
+1 -1
View File
@@ -783,7 +783,7 @@ since 2026-10-01.
- **PDF editable import:** Place from bytes or a path with `link: false`, and `clipboard.importPdf` followed by Paste, preserve live type on the selected page. Place still honors `textAs: "outlines"`. Synthetic two-page regressions: `crates/engine/src/cmd/fileio/tests_pdffidelity.rs`. No change to the PDF reader's existing fallback rules.
- **Tab stops in `.ai`/EPS type and right-aligned lines with tabs (#6147):** type from the text document keeps its paragraphs' tab stops (key 30: positions and left, center, right and decimal alignments; leaders aren't read), at most 1,024 a paragraph and 2^20 a story, past which the default stops apply with a warning. In right-aligned area type, the text before a line's last tab sits at its stops, measured from the left edge, and the text after it (none when the tab ends the line, with its hyphen when the line is hyphenated) against the right edge; centred and justified lines, point type and right-to-left paragraphs are aligned as a whole as before. Evidence: `ate::tests::a_paragraph_keeps_its_tab_stops`, `ate::tests::a_story_s_tab_stops_are_bounded`, `tests::right_aligned_area_type_sets_the_text_after_its_last_tab_against_the_edge`, `import_fuzz::text_frames_with_hostile_paragraph_attributes_never_panic`. Scores unchanged.
- **`.ai`/EPS graphic styles that paint with a named gradient:** a graphic style library's style (or a file's listed style) whose fill, or the fill or stroke of a style of one paint, paints with one of the file's gradients by name loads with that gradient at the style's angle, fitted to the bounds of each object it is applied to (VectorCraft's own placement; the style stores only the gradient's name and angle). A style naming a gradient the file doesn't define, or painting with a pattern, is still left out. Evidence: `fileio::tests_aiimport::graphic_styles_in_a_ai_library_that_paint_with_a_named_gradient_load_with_it`, `style::tests::a_style_of_one_paint_reads_as_the_fill_and_stroke_its_xd_turns_on`. Scores unchanged.
- **New type takes new art's appearance:** with New Art Has Basic Appearance off, new objects take every appearance attribute of the current appearance ([Edit appearance attributes](https://helpx.adobe.com/illustrator/desktop/special-effects-styles/apply-graphic-styles/edit-appearance-attributes.html)). Type made with the Type tools (`text.create`) now takes the template's fills, strokes and effects when the template is more than one plain fill and stroke or comes from a graphic style picked with nothing selected, and with Override Character Color on its characters lose the fill and stroke those paint. With the option on and no style picked, new type is unchanged. Evidence: `tests::newart::with_basic_appearance_off_new_type_takes_the_last_selections_fills_and_effects`, `tests::newart::new_type_keeps_plain_characters_without_a_template_beyond_a_basic_fill_and_stroke`, `tests::newart::a_graphic_style_clicked_with_nothing_selected_styles_the_next_type`. Scores unchanged.
- **New type takes new art's appearance:** with New Art Has Basic Appearance off, new objects take every appearance attribute of the current appearance ([Edit appearance attributes](https://helpx.adobe.com/illustrator/desktop/special-effects-styles/apply-graphic-styles/edit-appearance-attributes.html)). Type made with the Type tools (`text.create`) now takes the template's fills, strokes and effects when the template is more than one plain fill and stroke or comes from a graphic style picked with nothing selected, and with Override Character Color on its characters lose the fill and stroke those paint. Type made with a style's look is linked to the style. With the option on and no style picked, new type is unchanged. Evidence: `tests::newart::with_basic_appearance_off_new_type_takes_the_last_selections_fills_and_effects`, `tests::newart::new_type_keeps_plain_characters_without_a_template_beyond_a_basic_fill_and_stroke`, `tests::newart::a_graphic_style_clicked_with_nothing_selected_styles_the_next_type`, `tests::newart::a_basic_graphic_style_picked_with_basic_appearance_off_styles_each_new_type`. Scores unchanged.
- **`.ai`/EPS type laid out closer to the file's page (#6137):** type from the text document keeps auto leading as auto, each line taking the paragraph's Auto Leading share (key 7) of the largest type on it ([Line and character spacing](https://helpx.adobe.com/illustrator/using/line-character-spacing.html)); the paragraph's hyphenation options (keys 10 to 15) are read; area type of one frame whose last lines the file sets, but which don't fit here, may get a frame taller from its bottom, by its lines' deepest descent plus 0.05 pt and only when that shows more of those lines and no more than the file has (`vectorcraft_text::fit_source_lines`), with a warning when it does: the frame can stay as it is, or show only some of them; and a line a soft return ends is justified as a wrapped line is, a paragraph's last line keeping its alignment. Evidence: `ate::tests::auto_leading_follows_the_size_of_each_line`, `ate::tests::a_paragraph_keeps_its_auto_leading`, `ate::tests::a_paragraph_keeps_its_hyphenation_options`, `ate::tests::the_last_lines_the_file_sets_in_its_frame_show`, `tests::fit_source_lines_keeps_the_last_lines_the_source_sets`, `tests::typo::soft_return_in_justified_text_spreads_like_a_wrapped_line`. Limits: frames grow only for area type of one frame, horizontal, by its lines' deepest descent plus 0.05 pt; type in a font that isn't installed, and hyphenation in a language that isn't imported, still lay out differently. Scores unchanged.
- **Graphs saved to `.ai` keep their data and settings:** a grouped column, stacked column, line or area graph is written to a `.ai` file, in either form, with the records the `.ai` reader reads (`crates/eps/src/import/ai/read/graph.rs`, #7311): `%_Gs`, its plot, type, settings, axes and table, its series' groups each tagged `Go`, and `%_GS` ([the specification](https://13thmonkey.org/documentation/fonts/AI7FileFormat.pdf), §17 and appendix A). The file opens again with the same live graph. A graph with settings the reader doesn't keep, graph designs, label formatting, more than 10,000 categories or 256 series, or art the reader doesn't attach a graph to is written as its art, with a warning. `crates/eps/src/legacy_ai/tests.rs` and `crates/eps/src/ai_editing/tests.rs` write and read back each kind of graph; `a_drawn_graph_saved_as_ai_opens_as_a_graph_unless_the_save_warns` checks every graph type the graph tools draw. Scores unchanged.
- **Graph legend swatches have their series' stroke:** a default legend swatch of a stacked column, stacked bar, area or pie series has the thin white stroke of the series' marks (VectorCraft's own rule), beside the plot or across the top, and a stroke kept on the series is on the swatch too. Each series' group then paints with one stroke, so a stacked column or area graph the graph tools draw is saved to `.ai` with its data and settings and opens again as a live graph; a stacked bar graph is still written as its art, as the reader has no type for it. Evidence: `cmd::graph::tests::a_legend_swatch_has_the_stroke_of_its_series_marks`, `cmd::graph::tests::a_drawn_stacked_column_graph_saved_as_ai_opens_as_a_graph_that_takes_new_data`, `cmd::graph::tests::a_drawn_graph_saved_as_ai_opens_as_a_graph_unless_the_save_warns`. Scores unchanged.