mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-28 09:21:55 +01:00
.ai save: type in a spot ink keeps its swatch link
Type in a spot ink or a global process color was saved to the text
document as its process values alone (a /SimplePaint with key 0), so
the saved file opened with the type in a plain process color: off its
ink's plate on separations, and white type in a white ink on none.
Saving warned about it ("swatch links of its colors").
A run's fill or stroke now names (key 5 of a /CAITextPaint) an art
style of one paint, its fill alone on (`0 1 Xd`), whose paint is the
color as a path's fill writes it (`x`, `Xx`, `Xk`, or `Xs` for
Registration). That is the form the .ai reader takes the ink and the
tint from since the previous change; key 0 keeps the process values.
Each style is read back with the reader's own parser before it is
used, and a link is kept only when it gives the same swatch and tint.
Those runs no longer count among the attributes of type left out;
a link to a process swatch that isn't global still does, and the
warning's text now says so.
Test in crates/eps/src/ai_editing/tests.rs. The parity doc has the row.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e8c8071e76
commit
68fdaf8e79
9 files changed
+168
-18
No files matched your search
@@ -5088,6 +5088,61 @@ fn kinsoku_settings_come_back_on_each_paragraph() {
|
||||
assert_eq!(export_ai_editing(&lossy, &opts()).unwrap().warnings, [writer::TYPE_ATTRIBUTES]);
|
||||
}
|
||||
|
||||
/// Type in spot inks (CMYK, RGB and Lab) and a global process color, as its fill and as its
|
||||
/// stroke, at full strength and at a tint: each color reads back linked to its swatch at its tint, with no warning, as key 5
|
||||
/// of the run's paint names an art style of one paint that holds the link. A link to a process
|
||||
/// swatch that isn't global still warns: the editing data can't hold it.
|
||||
#[test]
|
||||
fn type_in_spot_and_global_colors_reads_back_linked_at_its_tint() {
|
||||
use vectorcraft_doc::{CharStyle, TextObject, TextRun};
|
||||
use vectorcraft_geom::Point;
|
||||
let white = Color::cmyk(0.0, 0.0, 0.0, 0.0);
|
||||
let red = Color::cmyk(0.0, 1.0, 1.0, 0.0);
|
||||
let mut doc = Document::new(300.0, 200.0);
|
||||
doc.swatches = vec![
|
||||
Swatch { name: "[None]".into(), paint: Paint::None, global: false, spot: false },
|
||||
Swatch { name: "White Ink".into(), paint: solid(white), global: true, spot: true },
|
||||
Swatch { name: "Red Ink".into(), paint: solid(red), global: true, spot: true },
|
||||
Swatch { name: "Sky".into(), paint: solid(SKY), global: true, spot: true },
|
||||
Swatch { name: "Mint".into(), paint: solid(MINT), global: true, spot: true },
|
||||
Swatch { name: "Brand".into(), paint: solid(BRAND), global: true, spot: false },
|
||||
Swatch { name: "Ink".into(), paint: solid(GOLD), global: false, spot: false },
|
||||
]
|
||||
.into();
|
||||
doc.swatch_groups = vec![].into();
|
||||
let layer = doc.layers[0].id;
|
||||
let stroked = |fill: Paint, stroke: Paint| CharStyle { size: 24.0, fill, stroke, stroke_width: 1.0, ..CharStyle::default() };
|
||||
let mut t = TextObject::point(Point::new(20.0, 60.0), "", style(24.0, Color::BLACK));
|
||||
t.runs = vec![
|
||||
TextRun::new("WHITE ", stroked(linked("White Ink", white, 1.0), Paint::None)),
|
||||
TextRun::new("RED ", stroked(linked("Red Ink", red, 0.4), linked("Brand", BRAND, 0.6))),
|
||||
TextRun::new("SKY ", stroked(linked("Sky", SKY, 0.75), linked("Red Ink", red, 1.0))),
|
||||
TextRun::new("MINT ", stroked(linked("Mint", MINT, 0.3), Paint::None)),
|
||||
TextRun::new("BRAND", stroked(linked("Brand", BRAND, 1.0), linked("White Ink", white, 0.5))),
|
||||
];
|
||||
let n = text_node(&mut doc, t);
|
||||
doc.insert(Some(layer), usize::MAX, n).unwrap();
|
||||
let out = export_ai_editing(&doc, &opts()).unwrap();
|
||||
assert!(out.warnings.is_empty(), "{:?}", out.warnings);
|
||||
let runs = |d: &Document| {
|
||||
let mut all = vec![];
|
||||
paths(&d.layers, &mut all);
|
||||
all.iter()
|
||||
.filter_map(|n| match &n.kind {
|
||||
NodeKind::Text(t) => Some(t.runs.iter().map(|r| (r.text.clone(), paint(&r.style.fill), paint(&r.style.stroke))).collect::<Vec<_>>()),
|
||||
_ => None,
|
||||
})
|
||||
.collect::<Vec<_>>()
|
||||
};
|
||||
assert_eq!(runs(&read_back(&doc)), runs(&doc));
|
||||
let mut process = doc.clone();
|
||||
let id = process.layers[0].children().unwrap()[0].id;
|
||||
if let Some(NodeKind::Text(t)) = process.node_mut(id).map(|n| &mut n.kind) {
|
||||
t.runs[0].style.fill = linked("Ink", GOLD, 1.0);
|
||||
}
|
||||
assert_eq!(export_ai_editing(&process, &opts()).unwrap().warnings, [writer::TYPE_ATTRIBUTES]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn type_is_written_again_as_the_same_bytes() {
|
||||
let doc = typed();
|
||||
|
||||
@@ -1623,6 +1623,18 @@ impl<'a> Writer<'a> {
|
||||
if !self.take_objects(stub) {
|
||||
return;
|
||||
}
|
||||
// The art styles that hold the swatch links of its colors, its thread's too.
|
||||
let members: Vec<&vectorcraft_doc::TextObject> = match thread {
|
||||
Some(thread) => thread
|
||||
.iter()
|
||||
.filter_map(|id| match &doc.node(*id)?.kind {
|
||||
NodeKind::Text(t) => Some(t.as_ref()),
|
||||
_ => None,
|
||||
})
|
||||
.collect(),
|
||||
None => vec![t],
|
||||
};
|
||||
self.link_type_colors(&members);
|
||||
let placed = if let Some(thread) = thread {
|
||||
// A thread is checked for what it loses, in every frame, when its story is written.
|
||||
let placed = self.texts.thread(doc, thread, n.id, self.canvas, &|id| !cut_to_clipping_object(doc, id), &self.wraps_held);
|
||||
|
||||
@@ -335,6 +335,31 @@ impl Writer<'_> {
|
||||
std::mem::replace(&mut self.body, saved)
|
||||
}
|
||||
|
||||
/// Look at the swatch links of the colors of type `texts` ([`super::texts::TextDoc::set_link`]):
|
||||
/// each is held by an art style of one paint, its color with its swatch at its tint, which key 5
|
||||
/// of a run's paint names ([`Self::type_color_style`]), or by none.
|
||||
pub(super) fn link_type_colors(&mut self, texts: &[&vectorcraft_doc::TextObject]) {
|
||||
for p in self.texts.unlooked_links(texts) {
|
||||
let style = self.type_color_style(p);
|
||||
self.texts.set_link(p, style);
|
||||
}
|
||||
}
|
||||
|
||||
/// The name of the art style that holds the swatch link of type colored `p`: a style of one
|
||||
/// paint, its fill alone on (`0 1 Xd`), whose paint is `p` as a path's fill writes it (a spot or
|
||||
/// global process color by its name and tint, Registration). The reader gives type whose paint
|
||||
/// names that style the style's color at its tint, linked to its swatch
|
||||
/// ([`crate::import::parsed_type_color`]); `None`, and no style, when it wouldn't give the same
|
||||
/// swatch and tint (a swatch that is neither spot nor global, for one).
|
||||
fn type_color_style(&mut self, p: &Paint) -> Option<String> {
|
||||
let Paint::Solid { swatch: Some(name), tint, .. } = p else { return None };
|
||||
let ops = self.color_ops(p, false);
|
||||
let text = format!("/SimpleStyle :\n0 O\n{ops}0 1 0 0 0 Xy\n{NO_LINE}0 XR\n0 1 Xd\n/Paint ;\n /Def ;\n");
|
||||
let back = self.styles.parsed.get(&text).and_then(crate::import::parsed_type_color);
|
||||
let same = matches!(back, Some(Paint::Solid { swatch: Some(n), tint: t, .. }) if n == name && (t - tint).abs() <= 1e-4);
|
||||
same.then(|| self.styles.object_style(text))
|
||||
}
|
||||
|
||||
/// A fill style holding a color, as an effect's entry `key` or a fill's own.
|
||||
fn fill_style(&mut self, s: &mut String, color: vectorcraft_color::Color, key: &str) {
|
||||
let ops = self.color_ops(&Paint::solid(color), false);
|
||||
|
||||
@@ -31,7 +31,7 @@ use vectorcraft_geom::{Affine, PathData, Point};
|
||||
use crate::{ai_ops, ps};
|
||||
|
||||
/// What the text document holds of type, and what it leaves out.
|
||||
pub(in crate::ai_editing) const TYPE_ATTRIBUTES: &str = "attributes of type other than its font, size, leading, tracking, baseline shift, horizontal and vertical scale, solid fill, solid stroke and its weight, cap, join and miter limit, capitals, small capitals at the document's size, Tate-chu-yoko, Standard Vertical Roman Alignment, Insert Aki, paragraph alignment, indents, space before and after, hyphenation on or off, right-to-left direction, Kinsoku set, Kinsoku Shori Type, Burasagari and Bunri-Kinshi (for example underline, kerning, OpenType features, swatch links of its colors, character and paragraph styles, tabs, lists, optical margin alignment, area type's inset spacing, vertical alignment and flow, a minimum first baseline with the Ascent first baseline, and type on a path's effect, alignment and spacing and an end bracket at the very end of an open path) are left out of the editing data for other apps";
|
||||
pub(in crate::ai_editing) const TYPE_ATTRIBUTES: &str = "attributes of type other than its font, size, leading, tracking, baseline shift, horizontal and vertical scale, solid fill, solid stroke and its weight, cap, join and miter limit, capitals, small capitals at the document's size, Tate-chu-yoko, Standard Vertical Roman Alignment, Insert Aki, paragraph alignment, indents, space before and after, hyphenation on or off, right-to-left direction, Kinsoku set, Kinsoku Shori Type, Burasagari and Bunri-Kinshi (for example underline, kerning, OpenType features, swatch links of its colors other than to spot colors, global process colors and Registration, character and paragraph styles, tabs, lists, optical margin alignment, area type's inset spacing, vertical alignment and flow, a minimum first baseline with the Ascent first baseline, and type on a path's effect, alignment and spacing and an end bracket at the very end of an open path) are left out of the editing data for other apps";
|
||||
|
||||
/// The version of the text document's form (`/98 << /0 n >>`), as the newest files users sent have it.
|
||||
const STREAM_VERSION: u32 = 14;
|
||||
@@ -177,15 +177,32 @@ fn set(resources: Vec<V>, display: bool) -> V {
|
||||
|
||||
/// A paint: kind 0 gray (`[alpha, lightness]`), 1 RGB, 2 CMYK, as the reader's `paint` reads them.
|
||||
/// RGB values are an RGB color's own (in the working RGB space) and a Lab color's converted into
|
||||
/// the working RGB space ([`ai_ops::rgb_values`]).
|
||||
fn paint(c: &Color) -> V {
|
||||
/// the working RGB space ([`ai_ops::rgb_values`]). With `style`, the art style that links the color
|
||||
/// to its swatch (key 5, [`TextDoc::link`]): the reader takes the style's color, at its tint, in
|
||||
/// place of these values.
|
||||
fn paint(c: &Color, style: Option<&str>) -> V {
|
||||
let (kind, values) = match *c {
|
||||
Color::Gray { k } => (0, vec![1.0 - f64::from(k.clamp(0.0, 1.0))]),
|
||||
Color::Cmyk { c, m, y, k } => (2, [c, m, y, k].iter().map(|v| f64::from(v.clamp(0.0, 1.0))).collect()),
|
||||
Color::Rgb { .. } | Color::Lab { .. } => (1, ai_ops::rgb_values(*c).iter().map(|v| f64::from(*v)).collect()),
|
||||
};
|
||||
let values: Vec<f64> = std::iter::once(1.0).chain(values).collect();
|
||||
dict(vec![(99, V::Name("SimplePaint")), (0, dict(vec![(0, V::Int(kind)), (1, reals(&values))]))])
|
||||
let color = dict(vec![(0, V::Int(kind)), (1, reals(&values))]);
|
||||
match style {
|
||||
Some(name) => dict(vec![(99, V::Name("CAITextPaint")), (5, V::Str(name.to_owned())), (0, color)]),
|
||||
None => dict(vec![(99, V::Name("SimplePaint")), (0, color)]),
|
||||
}
|
||||
}
|
||||
|
||||
/// A color linked to a swatch, by the swatch's name and its tint ([`TextDoc::links`]).
|
||||
pub(in crate::ai_editing) type LinkKey = (String, u32);
|
||||
|
||||
/// The swatch and tint paint `p` is linked to, if it is.
|
||||
pub(in crate::ai_editing) fn link_key(p: &Paint) -> Option<LinkKey> {
|
||||
match p {
|
||||
Paint::Solid { swatch: Some(name), tint, .. } => Some((name.clone(), tint.to_bits())),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
/// The color of paint `p` when the text document can hold it (a solid color or none).
|
||||
@@ -447,14 +464,16 @@ fn held_aki(v: f64) -> f64 {
|
||||
|
||||
/// Has type `t` attributes the text document leaves out ([`TYPE_ATTRIBUTES`])? `fonts` holds the
|
||||
/// fonts already resolved.
|
||||
fn loses(t: &TextObject, fonts: &mut ResolvedFonts) -> bool {
|
||||
fn loses(t: &TextObject, fonts: &mut ResolvedFonts, links: &HashMap<LinkKey, Option<String>>) -> bool {
|
||||
// Small capitals are read back at Document Setup's default size.
|
||||
let default_small_caps = vectorcraft_doc::DocSetup::default().small_caps_size;
|
||||
// Is paint `p` held with its swatch link, by an art style ([`TextDoc::link`])?
|
||||
let linked = |p: &Paint| link_key(p).is_some_and(|k| matches!(links.get(&k), Some(Some(_))));
|
||||
// A run's style as the text document holds it: every other attribute at its default. A color
|
||||
// is held without its swatch link.
|
||||
// is held without its swatch link, unless an art style holds the link.
|
||||
let held_char = |s: &CharStyle| {
|
||||
let unlinked = |p: &Paint| match p {
|
||||
Paint::Solid { color, .. } => Paint::solid(*color),
|
||||
Paint::Solid { color, .. } if !linked(p) => Paint::solid(*color),
|
||||
other => other.clone(),
|
||||
};
|
||||
let stroked = !s.stroke.is_none();
|
||||
@@ -500,8 +519,8 @@ fn loses(t: &TextObject, fonts: &mut ResolvedFonts) -> bool {
|
||||
..s.clone()
|
||||
}
|
||||
};
|
||||
// A Lab color is written as RGB.
|
||||
let lab = |p: &Paint| matches!(p, Paint::Solid { color: Color::Lab { .. }, .. });
|
||||
// A Lab color is written as RGB, unless an art style holds it with its link.
|
||||
let lab = |p: &Paint| matches!(p, Paint::Solid { color: Color::Lab { .. }, .. }) && !linked(p);
|
||||
s != held_char(&s) || lab(&s.fill) || lab(&s.stroke) || !fonts.kept(&s)
|
||||
};
|
||||
// A paragraph's style as the text document holds it, and its text: aligned to the start of
|
||||
@@ -842,6 +861,10 @@ pub(in crate::ai_editing) struct TextDoc {
|
||||
doc_values: usize,
|
||||
/// The fonts of the styles written so far, as they resolve.
|
||||
resolved: ResolvedFonts,
|
||||
/// The swatch links of type's colors looked at so far, by swatch and tint: the art style that
|
||||
/// holds each (a style of one paint, the color with its swatch, which key 5 of a run's paint
|
||||
/// names), `None` when the editing data can't hold it ([`super::Writer::link_type_colors`]).
|
||||
links: HashMap<LinkKey, Option<String>>,
|
||||
}
|
||||
|
||||
impl TextDoc {
|
||||
@@ -851,7 +874,31 @@ impl TextDoc {
|
||||
|
||||
/// Has type `t` attributes the text document leaves out ([`loses`])?
|
||||
pub(in crate::ai_editing) fn loses(&mut self, t: &TextObject) -> bool {
|
||||
loses(t, &mut self.resolved)
|
||||
loses(t, &mut self.resolved, &self.links)
|
||||
}
|
||||
|
||||
/// The colors of type whose swatch links are still to be looked at: the fills and strokes of
|
||||
/// `texts`' runs that are linked to a swatch and not in [`Self::links`] yet, each once.
|
||||
pub(in crate::ai_editing) fn unlooked_links<'t>(&self, texts: &[&'t TextObject]) -> Vec<&'t Paint> {
|
||||
let mut seen = HashSet::new();
|
||||
texts
|
||||
.iter()
|
||||
.flat_map(|t| t.runs.iter().flat_map(|r| [&r.style.fill, &r.style.stroke]))
|
||||
.filter(|p| link_key(p).is_some_and(|k| !self.links.contains_key(&k) && seen.insert(k)))
|
||||
.collect()
|
||||
}
|
||||
|
||||
/// Record the art style `style` that holds the swatch link of colors linked as `p` is, or
|
||||
/// `None` when none does ([`Self::links`]).
|
||||
pub(in crate::ai_editing) fn set_link(&mut self, p: &Paint, style: Option<String>) {
|
||||
if let Some(k) = link_key(p) {
|
||||
self.links.insert(k, style);
|
||||
}
|
||||
}
|
||||
|
||||
/// The art style that holds the swatch link of `p`, if one does.
|
||||
fn link(&self, p: &Paint) -> Option<&str> {
|
||||
self.links.get(&link_key(p)?)?.as_deref()
|
||||
}
|
||||
|
||||
/// The index of the font of `st` in the font set.
|
||||
@@ -909,11 +956,13 @@ impl TextDoc {
|
||||
let fill = solid(&st.fill).flatten();
|
||||
// A stroke of no width keeps its paint.
|
||||
let stroke = solid(&st.stroke).flatten();
|
||||
// A color linked to a swatch names the art style that holds the link, the fill's for a
|
||||
// stroke too (the reader's `Texts::with_paints`).
|
||||
if let Some(c) = &fill {
|
||||
d.push((53, paint(c)));
|
||||
d.push((53, paint(c, self.link(&st.fill))));
|
||||
}
|
||||
if let Some(c) = &stroke {
|
||||
d.push((54, paint(c)));
|
||||
d.push((54, paint(c, self.link(&st.stroke))));
|
||||
}
|
||||
d.extend([(56, V::Bool(fill.is_some())), (57, V::Bool(stroke.is_some()))]);
|
||||
if stroke.is_some() {
|
||||
@@ -1243,7 +1292,7 @@ impl TextDoc {
|
||||
if !whole.runs.iter().any(|r| r.text.chars().any(|c| !c.is_whitespace())) || !self.room(&whole, texts.len()) {
|
||||
return None;
|
||||
}
|
||||
let lost = split_differs || texts.iter().any(|t| loses(t, &mut self.resolved));
|
||||
let lost = split_differs || texts.iter().any(|t| loses(t, &mut self.resolved, &self.links));
|
||||
let frames: Vec<usize> = texts.iter().map(|t| self.frame(t, canvas, scale)).collect();
|
||||
let story = self.story(&whole, &frames, scale);
|
||||
if !self.fits(mark) {
|
||||
@@ -1357,7 +1406,7 @@ impl TextDoc {
|
||||
(12, V::Int(0)),
|
||||
// Every run writes its own key 35, so this only sets where new type starts: Standard (1).
|
||||
(35, V::Int(1)),
|
||||
(53, paint(&Color::gray(1.0))),
|
||||
(53, paint(&Color::gray(1.0), None)),
|
||||
(56, V::Bool(true)),
|
||||
(57, V::Bool(false)),
|
||||
(63, real(1.0)),
|
||||
|
||||
@@ -98,7 +98,7 @@ pub(crate) use ai::{
|
||||
BLEND_BUDGET, BLEND_PLUGIN, BRUSH_MANAGER, BrushesRead, DEFORM_PLUGIN, EnvelopeGridPoint, MAX_BLEND_KEYS, MAX_BLEND_OBJECTS,
|
||||
MAX_CHECKED as ENVELOPE_CHECKS, MAX_EDITING_OBJECTS, MAX_GRADIENT_STOPS, MAX_LISTED, MAX_LISTED_NAME, MAX_MESH_SIDE, MAX_SYMBOLS, ParsedStyle,
|
||||
blend_reads, brush_plugin_name, brushes_kept, envelope_outline, envelope_upright, mesh_reads, parse_art_style, parsed_moves_with,
|
||||
read_brush_object, read_parsed_style, read_style_list, symbol_art_member, turn_brush_art_over, warp_number,
|
||||
parsed_type_color, read_brush_object, read_parsed_style, read_style_list, symbol_art_member, turn_brush_art_over, warp_number,
|
||||
};
|
||||
pub(crate) use ate::{MAX_BYTES as MAX_TEXT_DOCUMENT, MAX_FRAMES, MAX_SEGMENTS, MAX_STORY, MAX_VALUES as MAX_TEXT_VALUES, record_version};
|
||||
pub use native::{AiLayers, ai_alone, ai_alone_on_page, ai_alone_with, ai_layers_alone, ai_opened_artboard, is_loss, layered_ai, layered_ai_from};
|
||||
|
||||
@@ -60,8 +60,8 @@ pub use read::read;
|
||||
#[cfg(test)]
|
||||
pub(crate) use read::with_image_limits;
|
||||
pub(crate) use read::{
|
||||
BLEND_BUDGET, MAX_NODES as MAX_EDITING_OBJECTS, MAX_SYMBOLS, ParsedStyle, join_and, parse_art_style, parsed_moves_with, read_over_page,
|
||||
read_parsed_style, read_program, read_style_list, slot_frame, slot_of, symbol_art_member,
|
||||
BLEND_BUDGET, MAX_NODES as MAX_EDITING_OBJECTS, MAX_SYMBOLS, ParsedStyle, join_and, parse_art_style, parsed_moves_with, parsed_type_color,
|
||||
read_over_page, read_parsed_style, read_program, read_style_list, slot_frame, slot_of, symbol_art_member,
|
||||
};
|
||||
pub use read::{
|
||||
BindingRef, Brushes, PaletteSwatches, PlacedPage, Structure, Symbols, active_artboard, artboards, bindings_note, brushes, graphic_styles,
|
||||
|
||||
@@ -155,7 +155,7 @@ pub use document::{
|
||||
};
|
||||
pub(crate) use document::{slot_frame, slot_of};
|
||||
use graph::Graph;
|
||||
pub(crate) use ops::{ParsedStyle, parse_art_style, parsed_moves_with, read_parsed_style, read_style_list};
|
||||
pub(crate) use ops::{ParsedStyle, parse_art_style, parsed_moves_with, parsed_type_color, read_parsed_style, read_style_list};
|
||||
#[cfg(test)]
|
||||
pub(crate) use raster::with_image_limits;
|
||||
pub(crate) use types::BLEND_BUDGET;
|
||||
|
||||
@@ -1763,6 +1763,14 @@ pub(crate) fn parse_art_style(section: &[u8], name: &str) -> Option<ParsedStyle>
|
||||
crate::import::ai::style::art_styles(section).remove(name).map(|style| ParsedStyle { style })
|
||||
}
|
||||
|
||||
/// The color type takes from art style `parsed` when a character's fill or stroke names it (key 5
|
||||
/// of its paint, `ate`): a style of one paint whose paint is a color with a swatch, at its tint and
|
||||
/// linked to that swatch ([`crate::import::ai::style::ArtStyle::simple_color`]). `None` for any
|
||||
/// other style.
|
||||
pub(crate) fn parsed_type_color(parsed: &ParsedStyle) -> Option<&Paint> {
|
||||
parsed.style.simple_color.as_ref().map(|(paint, _)| paint)
|
||||
}
|
||||
|
||||
/// Art style `parsed` as the reader reads it ([`StyleRead`]): [`appearance_from_art_style`], with a
|
||||
/// style's one gradient fill as `own_gradient`, the object's own gradient, as [`styled`] reads it on
|
||||
/// objects other than type. A stroke that names a brush is read with that brush's name, as [`styled`]
|
||||
|
||||
@@ -424,6 +424,7 @@ Stop opacity on translated artboards remains outside this regression coverage.
|
||||
|
||||
| Date | Change | Summary |
|
||||
|---|---|---|
|
||||
| 2026-11-27 | minor | `.ai` save: type in a spot ink, a global process colour or Registration keeps its swatch link and its tint. Its fill and stroke in the text document name (key 5 of the paint) an art style of one paint, `0 1 Xd`, whose paint is the colour as a path's fill writes it (`x`, `Xx`, `Xk`, `Xs`), the form `.ai` import reads since the change below; key 0 still holds the process values at the tint. Each style is read back before it is written and kept only when the reader gives the same swatch and tint, so such type no longer counts among the attributes of type left out; a link to a process swatch that isn't global still does. Test `ai_editing::tests::type_in_spot_and_global_colors_reads_back_linked_at_its_tint` |
|
||||
| 2026-11-27 | minor | `.ai` and EPS import: type set in a spot ink or a global process colour keeps its ink. In the text document a character's fill or stroke is a colour (key 0: grey, RGB or CMYK) and the name of an art style (key 5). In users' files (used locally, never committed) that style is one paint (`/SimpleStyle`), always its fill's, for a stroke too; for a spot ink or a global process colour it is `c m y k (name) tint x`, `Xx` or `Xk`, and key 0 keeps only the ink's process values at that tint. Such type came in as that process colour, so it separated onto the process plates, and white type in a white ink onto none. It now takes the style's paint: the colour at its tint, linked to the document's swatch of that name, which the style's colour makes when the art doesn't (after the art's colours, before the header's custom colours). A style whose paint is a process colour or a gradient, one that also sets a stroke's colour or pattern (before or after the fill's) or another fill paint after it, one whose `Xd` doesn't turn on its fill alone, and a paint that names no style of the file, keep the colour of key 0 as before; type filled with a gradient still comes in black. Tests `type_set_in_a_spot_ink_takes_it_from_the_art_style_its_paint_names` in `crates/eps/src/import/tests_native.rs`, `a_run_painted_by_a_swatch_colours_art_style_takes_the_swatch` in `crates/eps/src/import/ate.rs` and `only_a_style_of_one_swatch_colour_holds_it_for_type` in `crates/eps/src/import/ai/style/tests.rs`. Scores and estimates unchanged. |
|
||||
| 2026-11-26 | minor | `.ai` and EPS import: where the text document makes the type of every text object that shows, point type made from it is matched with the page's type where it draws. Made type has no layout when it is matched, and its box was the estimate of type without one (0.55 em a character, running right from its anchor): beside right-aligned type, over half of centered type, across vertical type, and too short for a wide font. The page's type there was counted as type with no text object, with the note "some of the page's type has no text object in the layers, so it is left out" (a loss, so `convert` wouldn't write over the file), and the made type went on to be weighed against the page as type the page may not draw, and could be taken out. The box of made point type that shows now comes from its layout in the fonts the import has; the text object keeps no layout, so the document measures it when it opens, as before. Files where some text object's type isn't made keep the estimate: there the page's pieces where made type draws can belong to text objects stacked on it. The page comparison takes the same box for the layers' type areas (`type_areas` in `compare.rs`): made point type that differs from the page (laid out again, or in another font) counts as type where it draws, whatever its alignment. Counted as art beside the estimate, it could send the file to its PDF part or page, or be noted as art that differs. A file whose layers failed the comparison that way and opened without it now passes it and shows its notes. Tests `right_aligned_and_centered_point_type_takes_the_pages_type_where_it_draws`, `centered_point_type_at_a_heading_s_size_takes_the_pages_type_where_it_draws` and `right_aligned_point_type_that_differs_from_the_page_differs_as_type` in `crates/eps/src/import/tests_native.rs`, and `made_point_type_s_box_is_where_its_alignment_and_orientation_draw_it` in `crates/eps/src/import/native/slots.rs`. Scores and estimates unchanged. |
|
||||
| 2026-11-22 | minor | EPS import: type in a Type 1 or Type 42 font the file carries, whose family isn't available, is drawn in a TrueType font built from the glyphs the file shows (outlines and advances from the font program), kept with the document as PDF import keeps a PDF's (#4569), and spaced by those glyphs' own advances; once its text is edited it takes the fallback font. A string that draws a character with another glyph than the one kept for it comes in as outlines. The warning names those families with PDF import's words ("show as the file draws them, in the fonts it carries, until their text is edited"). Fonts the file only names, Type 3 fonts and type from an Illustrator editing copy are unchanged. Tests `embedded_type1_type_draws_with_the_files_glyphs`, `a_second_glyph_for_a_character_keeps_its_type_as_outlines`, `kept_type1_glyphs_survive_saving_and_go_when_the_text_is_edited`, `type_in_fonts_that_arent_available_is_named_in_a_warning` in `crates/eps/src/import/tests_type1.rs`, `type_in_a_carried_type42_font_draws_with_the_files_glyphs` in `crates/eps/src/import/tests_type42.rs`; scores unchanged |
|
||||
|
||||
Reference in new issue
Block a user