VectorCraft: An open-source, vector art tool written by scratch in pure Rust
G9: map AI5_RulerUnits value 6 to pixels on .ai import
nrq6993-a11ya48e65ba68fc
diff --git a/crates/eps/src/import/ai/read.rs b/crates/eps/src/import/ai/read.rsindex 45c89569b..c0d54d96b 100644--- a/crates/eps/src/import/ai/read.rs+++ b/crates/eps/src/import/ai/read.rs@@ -81,7 +81,7 @@ const MAX_HEX: usize = (MAX_PIXELS as usize) * 10;/// Largest side of the document and its artboards (points).const MAX_SIDE: f64 = 1e6;-/// `%AI5_RulerUnits` → [`Unit`] (Illustrator 7 spec table 3; 4 and 5 are centimeters and pixels in later files).+/// `%AI5_RulerUnits` → [`Unit`] (Illustrator 7 spec table 3; centimeters is 4; pixels is 6 in later files).fn ruler_unit(v: u8) -> Option<Unit> {Some(match v {0 => Unit::Inches,@@ -89,7 +89,7 @@ fn ruler_unit(v: u8) -> Option<Unit> {2 => Unit::Points,3 => Unit::Picas,4 => Unit::Centimeters,- 5 => Unit::Pixels,+ 5 | 6 => Unit::Pixels,_ => return None,})}diff --git a/crates/eps/src/import/ai/tests.rs b/crates/eps/src/import/ai/tests.rsindex b6c8c9e5c..28cf71fc1 100644--- a/crates/eps/src/import/ai/tests.rs+++ b/crates/eps/src/import/ai/tests.rs@@ -43,6 +43,8 @@ fn ruler_units_from_the_header_set_the_documents_units() {assert_eq!(read_ok(&stream(&body)).doc.units, Unit::Points, "default when the comment is absent");let with_in = with_mm.replace("AI5_RulerUnits: 1", "AI5_RulerUnits: 0");assert_eq!(read(with_in.as_bytes()).unwrap().doc.units, Unit::Inches);+ let with_px = with_mm.replace("AI5_RulerUnits: 1", "AI5_RulerUnits: 6");+ assert_eq!(read(with_px.as_bytes()).unwrap().doc.units, Unit::Pixels);}/// The children of the first layer.