Merge pull request #4185 from dotCooCoo/fix/stain-replaces-linked-type-paint

Symbol Stainer: stained type keeps no link to a global swatch
This commit is contained in:
BFlat
2026-10-26 08:40:28 +07:00
committed by GitHub
2 changed files with 7 additions and 1 deletions
+1 -1
View File
@@ -119,7 +119,7 @@ pub fn tint_node(n: &mut Node, color: &Color, amount: f32) {
for r in &mut t.runs {
for p in [&mut r.style.fill, &mut r.style.stroke] {
if let Paint::Solid { color: c, .. } = p {
*c = c.lerp(color, amount);
*p = Paint::solid(c.lerp(color, amount));
}
}
}
+6
View File
@@ -363,6 +363,12 @@ fn stain_mixes_type_strokes_too() {
let mut art = type_art(red.clone(), red);
tint_node(&mut art, &blue, 1.0);
assert_eq!(run_paints(&[art]), [(Paint::solid(blue), Paint::solid(blue))]);
// Characters painted with a global swatch lose the link, as a path's paint does: the mixed color
// is not the swatch's color.
let linked = Paint::Solid { color: Color::rgb(1.0, 0.0, 0.0), swatch: Some("Red".into()), tint: 0.5 };
let mut art = type_art(linked.clone(), linked);
tint_node(&mut art, &blue, 1.0);
assert_eq!(run_paints(&[art]), [(Paint::solid(blue), Paint::solid(blue))]);
}
#[test]