mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-10-24 09:46:59 -06:00
EMF and WMF export: say when type is written as outlines and pattern fills as their tiles (#3850)
This commit is contained in:
@@ -33,6 +33,8 @@ const CLIPPING: &str = "clipping masks are not applied: the art they clip is wri
|
||||
const FLAT_GRADIENTS: &str = "gradients are written as one colour, the average of their stops";
|
||||
const FLAT_PATTERNS: &str = "pattern fills are written as one colour";
|
||||
const TOO_MANY_TILES: &str = "pattern fills past 250,000 tiles in all are written as one colour";
|
||||
const TEXT_OUTLINES: &str = "type is written as outlines: it can't be searched, selected or read aloud as text";
|
||||
const PATTERN_TILES: &str = "pattern fills are written as their tiles, one shape each";
|
||||
/// The warning for an image left out because it can't be decoded: the note raster exports give
|
||||
/// (`vectorcraft-engine`'s `rasterfx::undecoded_warning`).
|
||||
const UNDECODED: &str = "an image couldn't be decoded and is missing from the picture";
|
||||
@@ -197,6 +199,7 @@ impl<'a> Scene<'a> {
|
||||
}
|
||||
NodeKind::Text(_) => {
|
||||
if let Some(o) = vectorcraft_effects::outline_text(n) {
|
||||
self.warn(TEXT_OUTLINES);
|
||||
self.node(&o, true);
|
||||
}
|
||||
}
|
||||
@@ -316,6 +319,9 @@ impl<'a> Scene<'a> {
|
||||
return;
|
||||
}
|
||||
self.tiles_left -= tiles.len();
|
||||
if !tiles.is_empty() {
|
||||
self.warn(PATTERN_TILES);
|
||||
}
|
||||
let outer = self.opacity;
|
||||
self.opacity *= opacity.clamp(0.0, 1.0);
|
||||
self.ops.push(Op::Clip { path: bp.clone(), rule });
|
||||
|
||||
@@ -256,9 +256,12 @@ fn emf_clips_gradients_and_images() {
|
||||
fn type_is_written_as_outlines() {
|
||||
let t = TextObject::point(Point::new(10.0, 50.0), "Hi", CharStyle { fill: red(), ..CharStyle::default() });
|
||||
let d = doc_with(100.0, 100.0, vec![Node::new(NodeId(0), NodeKind::Text(Box::new(t)))]);
|
||||
let k = kinds(&emf_records(&emf(&d).bytes));
|
||||
let out = emf(&d);
|
||||
let k = kinds(&emf_records(&out.bytes));
|
||||
assert!(k.contains(&62), "glyphs are filled paths");
|
||||
assert!(!k.contains(&84) && !k.contains(&83), "no text records");
|
||||
// Said so (#3850).
|
||||
assert!(out.warnings.iter().any(|w| w.contains("type is written as outlines")), "{:?}", out.warnings);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -368,6 +371,8 @@ fn patterns_inside_pattern_tiles_share_one_tile_budget() {
|
||||
let (ops, warnings) = crate::scene::Scene::new(&d, d.artboards[0].rect, true).run();
|
||||
assert!(ops.len() < 300_000, "{} operations", ops.len());
|
||||
assert!(warnings.iter().any(|w| w.contains("one colour")), "{warnings:?}");
|
||||
// The tiles that were written are reported too (#3850).
|
||||
assert!(warnings.iter().any(|w| w.contains("written as their tiles")), "{warnings:?}");
|
||||
|
||||
// A tile filled with its own pattern multiplies at every level down to the nesting limit.
|
||||
let square = path(shapes::rectangle(Rect::new(0.0, 0.0, 4.0, 4.0)), pattern("self"), Paint::None, 0.0);
|
||||
|
||||
Reference in New Issue
Block a user