mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-10-31 21:27:00 -06:00
EPS import: the printer's crop marks after the layers aren't art outside them
An Illustrator EPS draws its crop marks after the last layer, between
%AI3_BeginCrops and %AI3_EndCrops (inside userdict /AI3_noCropMarks known
not { ... } if). The reader took them for art outside the layers, and the
whole file came in as its page in one layer. The section is now skipped,
as other non-art sections are; the crop area is %AI3_Cropmarks.
This commit is contained in:
@@ -246,6 +246,9 @@ pub(super) const SKIPPED: &[(&str, &str)] = &[
|
||||
("BeginSymbolList", "EndSymbolList"),
|
||||
("BeginTextDocument", "EndTextDocument"),
|
||||
("BeginEncoding", "EndEncoding"),
|
||||
// The printer's crop marks, drawn after the layers (`userdict /AI3_noCropMarks known not {
|
||||
// … } if`); the crop area they mark is `%AI3_Cropmarks`.
|
||||
("BeginCrops", "EndCrops"),
|
||||
];
|
||||
|
||||
/// The note for versioned content whose `%AI17_End_Versioned_Content` is missing: every
|
||||
|
||||
@@ -1929,3 +1929,15 @@ fn a_blend_record_is_read_to_its_length() {
|
||||
let (blend, warnings) = read_blend(&blend_file("%_10 50 m\n%_110 50 L\n", [Some("A"), Some("B")], &longer));
|
||||
assert!(matches!(blend.kind, NodeKind::Blend { .. }), "{warnings:?}");
|
||||
}
|
||||
|
||||
/// The printer's crop marks Illustrator draws after the last layer (`%AI3_BeginCrops`, inside
|
||||
/// `userdict /AI3_noCropMarks known not { … } if`) aren't art outside the layers: the file reads
|
||||
/// from its layers, without them (the crop area is `%AI3_Cropmarks`).
|
||||
#[test]
|
||||
fn crop_marks_after_the_layers_are_not_art() {
|
||||
let crops = "%AI3_BeginCrops\nuserdict /AI3_noCropMarks known not {\n0 A\nu\n0 R\n1 1 1 1 ([Registration]) 0 XS\n\
|
||||
0 J 0 j 0.5 w 4 M []0 d\n0 XR\n-9 -400 m\n-36 -400 L\nS\nU\n} if\n%AI3_EndCrops\n";
|
||||
let r = read_ok(&format!("{}{crops}", layer(&(rect_path(0.0, 0.0, 1.0, 1.0) + "f\n"))));
|
||||
assert_eq!(art(&r.doc).len(), 1);
|
||||
assert_eq!(r.doc.layers.len(), 1);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user