mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-19 16:49:25 +00:00
.cdr import: an ellipse of version 1 or 2 without its angles is damage
A drawn ellipse whose record ends before its two angles came in as a whole ellipse with no warning; it is now left out as damage. The file format table now says that version 3 envelopes are not applied and the objects under them are kept, and gives one count of the formats opened. PROVENANCE.md, the crate README and docs/mcp.md now say which parts of versions 1 to 4 public specifications cover.
This commit is contained in:
@@ -40,7 +40,9 @@ Status: `public-spec` (K, KR, Z, F or PR), `sample` (S), `unconfirmed` (a point
|
||||
and no sample file shows; listed so it can be checked against a file, with what the reader does
|
||||
when it is wrong).
|
||||
|
||||
No public specification covers versions 1 to 4. Their rows rest on the sample files they name.
|
||||
Public specifications cover only parts of versions 1 to 4: the rows that cite K, F or PR, such as
|
||||
the version 3 fill (R34) and page settings (R38). The other rows of those versions rest on the
|
||||
sample files they name.
|
||||
The test inputs are the synthetic files that `src/synth.rs` builds from the rows below; no sample
|
||||
file is committed.
|
||||
|
||||
|
||||
@@ -32,8 +32,9 @@ that are encrypted, ZIP64 archives or split across files.
|
||||
|
||||
## Versions 1 to 4
|
||||
|
||||
No public specification covers these versions. The reader follows the layouts of public sample
|
||||
files that `PROVENANCE.md` lists (rows R31 to R44), and its tests read the synthetic files that
|
||||
Public specifications cover only parts of these versions, such as the version 3 fill and page
|
||||
settings. For the rest, the reader follows the layouts of public sample files that
|
||||
`PROVENANCE.md` lists (rows R31 to R44), and its tests read the synthetic files that
|
||||
`src/synth.rs` builds from those rows.
|
||||
|
||||
| Version | Read | Left out or refused |
|
||||
|
||||
+16
-2
@@ -159,8 +159,9 @@ fn shape(rec: &[u8], fields: Fields, p: &Profile, budget: &mut Budget, warn: &mu
|
||||
let mut s = Rd::new(body);
|
||||
let (w, h) = (coord(&mut s, p)?, coord(&mut s, p)?);
|
||||
// Two angles follow. No source confirms how they make an arc, so an ellipse whose
|
||||
// angles differ is left out.
|
||||
if matches!((s.i16(), s.i16()), (Some(from), Some(to)) if from != to) {
|
||||
// angles differ is left out; one whose angles are missing is damage.
|
||||
let (from, to) = (s.i16()?, s.i16()?);
|
||||
if from != to {
|
||||
push(warn, Warning::UnsupportedObjects);
|
||||
return Some(None);
|
||||
}
|
||||
@@ -320,6 +321,19 @@ mod tests {
|
||||
assert_eq!(d.warnings, vec![Warning::Damaged]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn an_ellipse_without_its_angles_is_damage() {
|
||||
let ellipse =
|
||||
synth::wl_object(WlShape::Ellipse { w: 72.0, h: 36.0, angles: (0, 0) }, [1.0, 0.0, 0.0, 1.0, 0.0, 0.0], Some([1, 0, 0, 0, 100]), None);
|
||||
let mut cut = ellipse.clone();
|
||||
// A body size that ends the record after the ellipse's width and height.
|
||||
cut[28..30].copy_from_slice(&((Fields::of(b'e').least() - AFTER_BODY) as u16).to_le_bytes());
|
||||
cut.truncate(Fields::of(b'e').least());
|
||||
let d = read(&synth::wl_file(b'e', (612.0, 792.0), &[ellipse, cut])).unwrap();
|
||||
assert_eq!(d.pages[0].layers[0].objects.len(), 1);
|
||||
assert_eq!(d.warnings, vec![Warning::Damaged]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn fill_types_other_than_uniform_and_unknown_inks_are_named() {
|
||||
let mut textured =
|
||||
|
||||
@@ -21,7 +21,7 @@ Ordinary File > Save offers Save As when its own location refuses writes with a
|
||||
|---|---:|---:|---|
|
||||
| Formats opened or placed | ~30 | 31 | missing: FreeHand, DWG, PICT, PS |
|
||||
| Formats saved (Save As) | 6 (AI, AIT, PDF, EPS, SVG, SVGZ) | 6 + native | `.ai` written PDF-compatible (with an editing copy of the art: layers, groups, paths, colors, artboards) or as legacy version 7 (layers and groups, one artboard per file) |
|
||||
| Formats opened or placed | ~30 | 29 | missing: FreeHand, CorelDRAW, DWG, HEIC/HEIF, PICT, PS |
|
||||
| Formats opened or placed | ~30 | 30 | missing: FreeHand, DWG, HEIC/HEIF, PICT, PS |
|
||||
| Formats saved (Save As) | 6 (AI, AIT, PDF, EPS, SVG, SVGZ) | 6 + native | `.ai` written PDF-compatible (with an editing copy of the art: layers, groups, paths, colors, gradients, patterns, images, type, symbols, artboards, transparency, opacity masks, clipping) or as legacy version 7 (layers and groups, one artboard per file) |
|
||||
| Formats exported | ~16 | 18 | missing: DWG; extra: GIF/PNG-8 palette export, DXF up to 2018, layered PSD |
|
||||
| **Overall (weighted by use)** | | **~75%** | `.ai` and PDF dominate the weighting |
|
||||
@@ -308,7 +308,7 @@ Names in the editing data that aren't UTF-8 (layers, objects, artboards, colors,
|
||||
| PICT | open, place (legacy) | no | no | rarely used |
|
||||
| Pixar PXR | open, place (legacy) | yes (any set of the R, G, B and A channels in 8 or 12 bits, dumped or run-length encoded, in tiles; R alone is gray; alpha matted to black or unassociated) | no | recognized by its magic number; 12-bit samples are clamped to 0.0 to 1.0; null tiles are transparent with A and black without; the offsets aren't read, and the image takes the default resolution; a file cut short, with header values or packets the format doesn't define, or past the pixel allowance is refused with a message; tested on synthetic files only; tests in `crates/engine/src/cmd/fileio/tests_pxrread.rs` and `crates/engine/tests/import_fuzz.rs` |
|
||||
| FreeHand `.fh*` | open (legacy) | no | no | |
|
||||
| `.cdr` drawings | open | yes (versions 1 to 27, the `WL` files of versions 1 and 2 and the ZIP packages of versions 14 on included: pages, layers, guidelines, groups, PowerClips, curves, paths, rectangles, ellipses, arcs, polygons, uniform fills and outlines, from the object's style where it has none of its own; text, bitmaps, blends, contours, brush strokes, fountain, pattern, texture and PostScript fills and arrowheads are left out with a warning, and lenses and object transparency are not applied, with a warning; versions 1 and 2 open as one page and one layer without groups, arcs or pies, and version 3 objects under an envelope are left out with a warning; encrypted, ZIP64 and split packages are refused) | no | `.cdt` templates open as new untitled documents; File › Place reads both; record layouts and their sources in `crates/cdr/PROVENANCE.md`; synthetic test files only; tests in `crates/cdr/tests/it/read.rs`, `crates/engine/src/cmd/fileio/tests_cdr.rs` and `crates/engine/tests/import_fuzz.rs` |
|
||||
| `.cdr` drawings | open | yes (versions 1 to 27, the `WL` files of versions 1 and 2 and the ZIP packages of versions 14 on included: pages, layers, guidelines, groups, PowerClips, curves, paths, rectangles, ellipses, arcs, polygons, uniform fills and outlines, from the object's style where it has none of its own; text, bitmaps, blends, contours, brush strokes, fountain, pattern, texture and PostScript fills and arrowheads are left out with a warning, and lenses and object transparency are not applied, with a warning; versions 1 and 2 open as one page and one layer without groups, arcs or pies; version 3 envelopes are not applied, so the objects and groups under one keep their outlines and matrices, with a warning; encrypted, ZIP64 and split packages are refused) | no | `.cdt` templates open as new untitled documents; File › Place reads both; record layouts and their sources in `crates/cdr/PROVENANCE.md`; synthetic test files only; tests in `crates/cdr/tests/it/read.rs`, `crates/engine/src/cmd/fileio/tests_cdr.rs` and `crates/engine/tests/import_fuzz.rs` |
|
||||
| Text `.txt` | place, export | place (Text Import Options) | yes | |
|
||||
| RTF `.rtf` | place | place (area type with fonts, size, bold, italic, underline, strikethrough, caps, superscript and subscript, color, alignment, indents and paragraph spacing) | no | `tests/textimport.rs`, `place/rtf.rs`; fuzzed (`text_import_fuzz.rs`); `\'hh` bytes read as Windows-1252 or Mac Roman only |
|
||||
| Word `.docx` | place | place (area type with the document's styles and its fonts, size, bold, italic, underline, strikethrough, caps, superscript and subscript, color, alignment, indents and paragraph spacing) | no | `tests/textimport.rs`, `place/docx.rs`; fuzzed (`text_import_fuzz.rs`); list numbers, pictures and text boxes are left out |
|
||||
|
||||
+1
-1
@@ -6856,7 +6856,7 @@ transparency are not applied. The `warnings` of
|
||||
were left out. Drawings of versions after 27 are refused with a message, and so are packages that are
|
||||
encrypted, ZIP64 archives or split across files. VectorCraft doesn't write `.cdr` files.
|
||||
|
||||
No public specification covers versions 1 to 4, so the importer reads the layouts found in public sample files. A
|
||||
Public specifications cover only parts of versions 1 to 4, so for the rest the importer reads the layouts found in public sample files. A
|
||||
drawing of version 1 or 2 opens as one page with one layer: its rectangles, whole ellipses and curves with their
|
||||
matrices, uniform fills and outlines with their width and color. Its text, its arcs and pies, and its fills of other
|
||||
types are left out with the same warnings, and its groups are not kept. An object of another type ends the read of
|
||||
|
||||
Reference in New Issue
Block a user