mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-19 11:34:27 +00:00
File formats: open and place .cmx files
.cmx exchange files with 32-bit coordinates open and place as editable art. vectorcraft-cdr reads the RIFF form CMX1, its header, the color, pen, line type, dash, outline and arrowhead tables, and each page's instructions in drawing order, into the drawing model the .cdr reader uses, so the importer maps pages, layers, groups and curves with uniform fills and outlines the same way. A layer that holds nothing is left out. A page that gives no size of its own takes the size of the drawing's bounds, which the page header stores, and is centered on them. Text, images, rectangles, ellipses, clipping paths, fills other than uniform ones and arrowheads are left out, and lenses are not applied; the warnings name each kind, with rows in every complete catalog. Big-endian files and files with 16-bit coordinates are refused with a message. Layouts and their sources are rows R53 to R63 of crates/cdr/PROVENANCE.md; tests use synthetic files only.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "vectorcraft-cdr"
|
||||
description = "Bounded reader for .cdr drawings of versions 1 to 27: WL records, RIFF index, compressed lists, ZIP packages, shapes, fills, outlines, pages and layers"
|
||||
description = "Bounded reader for .cdr drawings of versions 1 to 27 and .cmx files: WL records, RIFF index, compressed lists, ZIP packages, shapes, fills, outlines, pages and layers"
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
license.workspace = true
|
||||
|
||||
@@ -38,10 +38,17 @@ Sources:
|
||||
https://ftp.maps.canada.ca/pub/nrcan_rncan/raster/tactile/approach-approch/cdr/banff_ap_en.cdr and
|
||||
https://ftp.maps.canada.ca/pub/nrcan_rncan/raster/tactile/atlas-atlas/cdr/ab_en_br.cdr
|
||||
- **DM**: the clip art of https://discmaster.textfiles.com/browse/31541, by file name
|
||||
- **CX**: the `.cmx` files of https://telparia.com/fileFormatSamples/image/cmx/, by file name. The
|
||||
nine with 32-bit coordinates are `balloon.cmx`, `bars.cmx`, `bluecros.cmx`, `bluedrop.cmx`,
|
||||
`gold_bar.cmx`, `goldblue.cmx`, `PC.CMX`, `squares.cmx` and `thatch.cmx`; they carry no picture
|
||||
of their drawing.
|
||||
- **CN**: the `.cmx` notes of an MIT OR Apache-2.0 drawing program, which mark each layout
|
||||
"confirmed" when the program's authors found it in sample files,
|
||||
https://github.com/tracedraw/tracedraw/blob/2ac6d02e97773e040a51be6cfb27cc424e3deeaa/docs/cmx-format.md
|
||||
|
||||
Status: `public-spec` (K, KF, KR, Z, F or PR), `sample` (S), `unconfirmed` (a point no source states
|
||||
and no sample file shows; listed so it can be checked against a file, with what the reader does
|
||||
when it is wrong).
|
||||
Status: `public-spec` (K, KF, KR, Z, F or PR), `sample` (S), `public-notes` (a layout CN marks
|
||||
confirmed that no CX file shows), `unconfirmed` (a point no source states and no sample file shows;
|
||||
listed so it can be checked against a file, with what the reader does when it is wrong).
|
||||
|
||||
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
|
||||
@@ -103,3 +110,14 @@ file is committed.
|
||||
| R50 | Bit 5 (0x20) of the outline's line type scales the outline's width and dashes with the shape's matrix. The engine multiplies them by the square root of the matrix's area factor (VectorCraft's own value for a matrix that scales x and y differently) | S: UC `outl_scale_with_cdr7.cdr` to `outl_scale_with_cdr12.cdr`, of whose outlines only one, 3.969 mm wide, has line type 0x22 and the others 0x02 or 0x01; TDF 76771 (version 15), whose outline of line type 0x22 is 10 mm wide on a shape that the matrix stretches and skews, and whose picture draws that outline several times wider and skewed | sample (the bit; the single width for a matrix that scales x and y differently: VectorCraft's own) |
|
||||
| R51 | A `trfd` offsets table holds one offset more than the entries; each entry runs from its offset to the next, and the last offset is the record's end | KF L1079, L1113-L1121; S: every `trfd` of versions 4 to 25 in the sample files (25,425 records) has the extra offset, equal to the record's length | public-spec |
|
||||
| R52 | Byte 0 of argument 14001 is the fill's winding flag. VectorCraft reads a byte other than 0 as the nonzero fill rule, and 0 or an object without the argument as even-odd | KF L575-L583, L1047; S: the argument is 4 bytes in the sample files that carry it, with byte 0 = 1 on LT `complexshape_blackfill_nooutline` of `testset/12` and `testset/15` to `testset/25` and on objects of TDF 127576 (13) and 60026 (14), and 0 on 27 objects of TP `example.cdr` (17) | public-spec (the flag: KF; which rule each value means, and the rule without the argument: VectorCraft's own reading, and a wrong reading fills or leaves holes where a curve's subpaths overlap) |
|
||||
| R53 | A `.cmx` file is a RIFF form of type `CMX1`, little-endian (a `RIFX` form is big-endian and is refused); its chunks are laid out as R4. A chunk can run short of its contents: when the bytes after it don't read as a chunk id, the next id is four letters at an even distance of 2 to 64 bytes | CN "Container"; S: all 14 CX files are `RIFF` forms of type `CMX1`; in `balloon.cmx`, `bars.cmx`, `bluecros.cmx`, `bluedrop.cmx`, `gold_bar.cmx`, `goldblue.cmx`, `squares.cmx` and `thatch.cmx` 16 bytes follow `ccmm` and 4 follow `rlst` before the next id | sample |
|
||||
| R54 | `cont`: byte 52 is the coordinate size as an ASCII digit, `4` for 32-bit coordinates and `2` for 16-bit ones (refused); bytes 64 to 72 hold an f64, the size of a coordinate unit in meters. A value that isn't above 0 and at most 1 reads as 0.1 µm (VectorCraft's own fallback) | CN "Container"; S: the nine CX files with `4` all hold 1e-7; `abydos.cmx`, `CM33.CMX`, `LIZARDS.CMX`, `output.000.cmx` and `test.cmx` hold `2` | sample |
|
||||
| R55 | A table (`rclr`, `rpen`, `rott`, `rdot`, `rotl`) is a u16 entry count, then one field list per entry; an instruction's body is field lists too. A field is a u8 tag, a u16 length counting its 3 header bytes, and the data; 0xff ends the list. Objects name table entries from 1 | CN "Tables"; S: every one of these tables in the nine CX files with 32-bit coordinates reads its count of entries with no bytes left | sample |
|
||||
| R56 | A color entry: a property list in field 10 (a u32 length, then parts laid out as R11's, the color in part 1 as R14), or in older files the model and palette bytes in field 1 and the values in field 2. Models of the older fields: 2 cyan, magenta, yellow and black in percent; 3 the same in 0 to 255; 5 red, green and blue in 0 to 255. Other models read as black with a warning | CN "Tables" (`rclr`); S: every color of the nine CX files is model 2 in the older fields | sample (model 2), public-notes (field 10), unconfirmed (models 3 and 5 of the older fields, read as the program of CN reads them; a wrong reading gives a wrong color) |
|
||||
| R57 | `rpen` field 1: the width as a u32 in coordinate units (then an aspect, an angle and a matrix, not read). `rott` field 1: a flags byte (1 no outline, 2 solid, 4 dashed, 8 behind the fill, 16 scaled with the object), then the caps in the low 4 bits and the join in the high 4 bits, numbered as R12. `rdot` field 1: a u16 count, then the dash and gap lengths in outline widths (u16 each) | CN "Tables"; S: line types 0x02 and 0x22 with caps and joins 0x00, 0x01 and 0x11 in the CX files | public-notes (the flags 4, 8 and 16 and the cap and join numbering; bit 0x20, set in `balloon.cmx`, is not read) |
|
||||
| R58 | `rotl` field 1: six u16, the 1-based entries of the outline's line type, screen, color, arrowhead pair, pen and dash pattern | CN "Tables"; S: every `rotl` entry of the CX files names entries that exist | sample |
|
||||
| R59 | `rota`: a u16 count, then pairs of u16 (start and end arrowheads, 0 for none), not field lists | CN "Tables"; S: `rota` is `01 00 00 00 00 00` in every CX file | sample (pairs of 0), public-notes (other values) |
|
||||
| R60 | A `page` chunk is a stream of instructions: a u16 size counting the whole instruction and an i16 code, or 0xFFFF, a u32 size and the code (the long form); then field lists. Codes: 9 and 10 begin and end a page, 11 and 12 a layer, 13 and 14 a group, 67 a curve; 20 and 21 a text object, 65 its drawn characters, 66 an ellipse, 68 a rectangle, 69 an image, 88 and 89 add and remove a clipping path, 111 a jump whose field 1 is the u32 file offset to go on from (the bytes jumped over hold images). Objects are drawn in file order, the first at the back | CN "page: instructions"; S: codes 9 to 14 and 67 in the CX files; in `squares.cmx` the large square comes first and the two smaller ones inside it after | sample (9 to 14, 67, the order), public-notes (the long form and the other codes) |
|
||||
| R61 | Field 4 of instruction 9: the page's width and height, u32 each in coordinate units. Without it, field 1 gives the drawing's bounds: a u16 page number, a u32, then the left, top, right and bottom edges as i32 in coordinate units; the page takes the bounds' size and is centered on them (VectorCraft's own choice) | CN "page: instructions"; S: none of the CX files has field 4; in all nine with 32-bit coordinates, the four edges in field 1 match the extent of the file's curves | public-notes (field 4), sample (field 1) |
|
||||
| R62 | A layer's name: field 4 as a u32 count and UTF-16 units, or field 1 from byte 12 as a u16 count and 8-bit characters (read as Windows-1252, VectorCraft's own choice). A curve: field 1 its rendering attributes, field 2 a u16 point count, the points as i32 x and y, then a type byte for each as R16; coordinates are from the page's center, y up | CN "page: instructions" and "Coordinates"; S: the 8-bit names `Layer 1`, `Desktop`, `Grid` and `Guides` of the CX files (the last three hold nothing in every file); every curve of the CX files has field 2 of exactly 2 + 9 bytes per point | sample (8-bit names, curves), public-notes (field 4) |
|
||||
| R63 | Rendering attributes: a mask (1 fill, 2 outline, 4 lens), then a field list for the fill when the mask names it and one for the outline. The fill's field 1 is a u16 type and a field list; type 0 is no fill, type 1 a uniform fill whose field 1 is the color entry (u16) and a screen (u16); other types (2 fountain and more) are not read. The outline's field 1 is its `rotl` entry (u16) | CN "Rendering attributes"; S: masks 1, 2 and 3, fill types 1, 2 and 6, and uniform fills with a 4-byte field 1 in the CX files | sample |
|
||||
|
||||
+22
-2
@@ -57,12 +57,32 @@ reports version 1 for the marker `e` and version 2 for the other two. A RIFF fil
|
||||
a version before 3 is refused, and so is the version 4 template form type `CDST`, which reads as
|
||||
not a `.cdr` drawing.
|
||||
|
||||
## `.cmx` files
|
||||
|
||||
`read_cmx` reads `.cmx` exchange files with 32-bit coordinates (rows R53 to R63) into the same
|
||||
drawing model, with a version of 0. It reads the color, pen, line type, dash, outline and
|
||||
arrowhead tables, then each page's instructions in drawing order:
|
||||
|
||||
| In the `.cmx` file | Read as |
|
||||
|---|---|
|
||||
| Pages, with the size the page gives, or else the size of the drawing's bounds that the page stores | pages; a page sized to the bounds is centered on them |
|
||||
| Layers, by their UTF-16 or 8-bit name | drawing layers; a layer that holds nothing is left out |
|
||||
| Groups | groups |
|
||||
| Curves (moves, lines and cubic curves, as `.cdr` point lists) | paths |
|
||||
| Uniform fills: CMYK in percent or 0 to 255, RGB, and library colors with their names | colors, spot colors |
|
||||
| Outlines: width, color, caps, joins, dashes, the no-outline, behind-the-fill and scaled-with flags | outlines |
|
||||
|
||||
Text, images, rectangles, ellipses, clipping paths, fills other than uniform ones, outline
|
||||
arrowheads and lenses are not read; the drawing's `warnings` name each kind it held. A clipping
|
||||
path is left out and the objects it clips are read without it. Files in big-endian byte order and
|
||||
files with 16-bit coordinates are refused.
|
||||
|
||||
## Provenance
|
||||
|
||||
`PROVENANCE.md` lists every record layout the reader relies on, with its public source and status.
|
||||
Code cites the rows by id (`R1` ...), and `tests/it/provenance.rs` fails when a cited id has no row.
|
||||
The test inputs are synthetic drawings built by `src/synth.rs` (the `synth` feature); no
|
||||
third-party file is committed.
|
||||
The test inputs are synthetic drawings built by `src/synth.rs` and `src/synth_cmx.rs` (the
|
||||
`synth` feature); no third-party file is committed.
|
||||
|
||||
## Limits
|
||||
|
||||
|
||||
@@ -0,0 +1,631 @@
|
||||
//! Reader for `.cmx` exchange files with 32-bit coordinates: the RIFF form `CMX1` (R53), its
|
||||
//! header (R54), the color, pen, line type, dash, outline and arrowhead tables (R55 to R59) and the
|
||||
//! instructions of each page (R60): pages, layers, groups and curves (R61, R62) with uniform fills
|
||||
//! and outlines (R63). Text, images, rectangles, ellipses, clipping paths, other fills and lenses
|
||||
//! are left out with a warning.
|
||||
|
||||
use crate::bytes::{Rd, u32_at};
|
||||
use crate::geometry::path_of;
|
||||
use crate::layout::{self, Profile};
|
||||
use crate::limits::Budget;
|
||||
use crate::model::{Cap, Color, Drawing, Geometry, Join, Layer, LayerKind, Matrix, Object, Outline, Page, Pt, Shape};
|
||||
use crate::records::{name, property_color};
|
||||
use crate::riff::{LIST, push};
|
||||
use crate::{Error, Warning};
|
||||
|
||||
const FORM: [u8; 4] = *b"CMX1";
|
||||
/// Meters per coordinate unit when the header gives no usable value: the 0.1 µm of every sample
|
||||
/// file with 32-bit coordinates (R54).
|
||||
const DEFAULT_UNIT: f64 = 1e-7;
|
||||
/// How far past a chunk that runs short the next chunk id is looked for (R53).
|
||||
const RESYNC: usize = 64;
|
||||
/// The chunks the reader uses (R53 to R60).
|
||||
const READ_IDS: [[u8; 4]; 9] = [*b"LIST", *b"cont", *b"page", *b"rclr", *b"rpen", *b"rott", *b"rdot", *b"rotl", *b"rota"];
|
||||
/// The most UTF-16 units read of a layer's name; [`name`] keeps 256 of them.
|
||||
const MAX_NAME_UNITS: usize = 4096;
|
||||
|
||||
// Instruction codes (R60).
|
||||
const BEGIN_PAGE: i16 = 9;
|
||||
const END_PAGE: i16 = 10;
|
||||
const BEGIN_LAYER: i16 = 11;
|
||||
const END_LAYER: i16 = 12;
|
||||
const BEGIN_GROUP: i16 = 13;
|
||||
const END_GROUP: i16 = 14;
|
||||
const BEGIN_TEXT: i16 = 20;
|
||||
const END_TEXT: i16 = 21;
|
||||
const GLYPH_RUN: i16 = 65;
|
||||
const ELLIPSE: i16 = 66;
|
||||
const CURVE: i16 = 67;
|
||||
const RECTANGLE: i16 = 68;
|
||||
const IMAGE: i16 = 69;
|
||||
const ADD_CLIP: i16 = 88;
|
||||
const REMOVE_CLIP: i16 = 89;
|
||||
const JUMP: i16 = 111;
|
||||
|
||||
/// Does `bytes` start as a CMX file: a RIFF or RIFX form of type `CMX1` (R53)?
|
||||
pub(crate) fn is_cmx(bytes: &[u8]) -> bool {
|
||||
matches!(bytes.get(0..4), Some(b"RIFF" | b"RIFX")) && bytes.get(8..12) == Some(FORM.as_slice())
|
||||
}
|
||||
|
||||
/// A chunk outside the `LIST` chunks: its id, its body and where the body starts in the file.
|
||||
struct Chunk<'a> {
|
||||
id: [u8; 4],
|
||||
body: &'a [u8],
|
||||
start: usize,
|
||||
}
|
||||
|
||||
/// The tables that page instructions refer to by 1-based index (R55 to R59).
|
||||
#[derive(Default)]
|
||||
struct Tables {
|
||||
colors: Vec<Option<Color>>,
|
||||
/// Outline widths in points.
|
||||
pens: Vec<Option<f64>>,
|
||||
/// Flags, and the caps and join.
|
||||
line_types: Vec<Option<(u8, u8)>>,
|
||||
dashes: Vec<Vec<u16>>,
|
||||
/// Line type, screen, color, arrowheads, pen and dashes.
|
||||
outlines: Vec<Option<[u16; 6]>>,
|
||||
arrowheads: Vec<(u16, u16)>,
|
||||
}
|
||||
|
||||
pub(crate) fn drawing(bytes: &[u8], budget: &mut Budget) -> Result<Drawing, Error> {
|
||||
if !is_cmx(bytes) {
|
||||
return Err(Error::NotCmx);
|
||||
}
|
||||
if bytes.get(0..4) == Some(b"RIFX") {
|
||||
return Err(Error::Unsupported("big-endian CMX files"));
|
||||
}
|
||||
let mut warn = Vec::new();
|
||||
let chunks = chunks(bytes, budget, &mut warn)?;
|
||||
let cont = chunks.iter().find(|c| c.id == *b"cont").map(|c| c.body).ok_or(Error::Damaged("CMX header"))?;
|
||||
match cont.get(52) {
|
||||
Some(b'4') => {}
|
||||
Some(b'2') => return Err(Error::Unsupported("CMX files with 16-bit coordinates")),
|
||||
_ => return Err(Error::Damaged("CMX header")),
|
||||
}
|
||||
let meters = Rd::at(cont, 64).f64().filter(|m| *m > 0.0 && *m <= 1.0).unwrap_or(DEFAULT_UNIT);
|
||||
let unit = meters / 0.0254 * 72.0;
|
||||
let tables = Tables::read(&chunks, unit, budget, &mut warn)?;
|
||||
let mut pages = Vec::new();
|
||||
for c in chunks.iter().filter(|c| c.id == *b"page") {
|
||||
pages.push(PageRead::new(&tables, unit, budget, &mut warn).read(c)?);
|
||||
}
|
||||
Ok(Drawing { version: 0, page_size: None, pages, master: Vec::new(), guides: Vec::new(), warnings: warn })
|
||||
}
|
||||
|
||||
/// The chunks of the file in order, those inside `LIST` chunks in place (R53).
|
||||
fn chunks<'a>(b: &'a [u8], budget: &mut Budget, warn: &mut Vec<Warning>) -> Result<Vec<Chunk<'a>>, Error> {
|
||||
let declared = u32_at(b, 4).and_then(|n| (n as usize).checked_add(8)).unwrap_or(b.len());
|
||||
if declared > b.len() {
|
||||
// The file was cut short of the size its header gives.
|
||||
push(warn, Warning::Damaged);
|
||||
}
|
||||
let end = declared.min(b.len());
|
||||
let mut out = Vec::new();
|
||||
// (position, end, depth) of the lists still to walk; a list's children go before the rest of
|
||||
// the list that holds it.
|
||||
let mut stack = vec![(12usize, end, 0usize)];
|
||||
while let Some((mut pos, end, depth)) = stack.pop() {
|
||||
while pos.saturating_add(8) <= end {
|
||||
let Some(id) = Rd::at(b, pos).fourcc() else { break };
|
||||
if !id.iter().all(|c| c.is_ascii_alphanumeric() || *c == b' ') {
|
||||
match resync(b, pos, end) {
|
||||
Some(next) => {
|
||||
pos = next;
|
||||
continue;
|
||||
}
|
||||
None => {
|
||||
push(warn, Warning::Damaged);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
budget.take_chunk()?;
|
||||
let size = u32_at(b, pos + 4).map_or(0, |s| s as usize);
|
||||
let start = pos + 8;
|
||||
let stop = start.saturating_add(size);
|
||||
if stop > end {
|
||||
// Stray bytes that happen to start with four letters give a length past the list:
|
||||
// look for the next chunk id after them. A chunk the reader uses is kept, cut at
|
||||
// the end of the list.
|
||||
if !READ_IDS.contains(&id)
|
||||
&& let Some(next) = resync(b, pos, end)
|
||||
{
|
||||
pos = next;
|
||||
continue;
|
||||
}
|
||||
push(warn, Warning::Damaged);
|
||||
}
|
||||
let stop = stop.min(end);
|
||||
let next = stop.saturating_add(size & 1);
|
||||
if id == LIST {
|
||||
if depth >= budget.limits.depth {
|
||||
push(warn, Warning::TooDeep);
|
||||
pos = next;
|
||||
continue;
|
||||
}
|
||||
stack.push((next, end, depth));
|
||||
stack.push((start + 4, stop, depth + 1));
|
||||
break;
|
||||
}
|
||||
if let Some(body) = b.get(start..stop) {
|
||||
out.push(Chunk { id, body, start });
|
||||
}
|
||||
pos = next;
|
||||
}
|
||||
}
|
||||
Ok(out)
|
||||
}
|
||||
|
||||
/// Where the next chunk id after `pos` lies: four letters at an even distance of 2 to [`RESYNC`]
|
||||
/// bytes (R53).
|
||||
fn resync(b: &[u8], pos: usize, end: usize) -> Option<usize> {
|
||||
(pos + 2..=pos.saturating_add(RESYNC).min(end.saturating_sub(8)))
|
||||
.step_by(2)
|
||||
.find(|&p| b.get(p..p + 4).is_some_and(|t| t.iter().all(u8::is_ascii_alphabetic)))
|
||||
}
|
||||
|
||||
/// The end of the field list at `pos` of `b`: after its 0xff, or the end of `b` when a field runs
|
||||
/// past it (R55).
|
||||
fn list_end(b: &[u8], mut pos: usize) -> usize {
|
||||
while let Some(&tag) = b.get(pos) {
|
||||
if tag == 0xff {
|
||||
return pos + 1;
|
||||
}
|
||||
match Rd::at(b, pos + 1).u16().map(usize::from).filter(|n| *n >= 3) {
|
||||
Some(n) if pos + n <= b.len() => pos += n,
|
||||
_ => break,
|
||||
}
|
||||
}
|
||||
b.len()
|
||||
}
|
||||
|
||||
/// The data of field `tag` in the field list `b` (R55).
|
||||
fn field(b: &[u8], tag: u8) -> Option<&[u8]> {
|
||||
let mut pos = 0;
|
||||
while let Some(&t) = b.get(pos) {
|
||||
if t == 0xff {
|
||||
return None;
|
||||
}
|
||||
let n = usize::from(Rd::at(b, pos + 1).u16()?);
|
||||
let data = b.get(pos + 3..pos.checked_add(n)?).filter(|_| n >= 3)?;
|
||||
if t == tag {
|
||||
return Some(data);
|
||||
}
|
||||
pos += n;
|
||||
}
|
||||
None
|
||||
}
|
||||
|
||||
/// The field lists of a table: a u16 count, then that many lists (R55). Each entry counts toward
|
||||
/// the chunk limit.
|
||||
fn entries<'a>(d: &'a [u8], budget: &mut Budget) -> Result<Vec<&'a [u8]>, Error> {
|
||||
let count = Rd::new(d).u16().map_or(0, usize::from);
|
||||
let mut out = Vec::new();
|
||||
let mut pos = 2;
|
||||
for _ in 0..count {
|
||||
if pos >= d.len() {
|
||||
break;
|
||||
}
|
||||
budget.take_chunk()?;
|
||||
let end = list_end(d, pos);
|
||||
out.push(d.get(pos..end).unwrap_or_default());
|
||||
pos = end;
|
||||
}
|
||||
Ok(out)
|
||||
}
|
||||
|
||||
impl Tables {
|
||||
/// The first chunk of each table; a table that is missing is empty.
|
||||
fn read(chunks: &[Chunk], unit: f64, budget: &mut Budget, warn: &mut Vec<Warning>) -> Result<Tables, Error> {
|
||||
let first = |id: &[u8; 4]| chunks.iter().find(|c| c.id == *id).map_or(&[][..], |c| c.body);
|
||||
// A color record of field 10 holds a property list as a `.cdr` fill does (R56).
|
||||
let record = layout::for_version(1300);
|
||||
let mut t = Tables::default();
|
||||
for e in entries(first(b"rclr"), budget)? {
|
||||
t.colors.push(color(e, record.as_ref(), warn));
|
||||
}
|
||||
for e in entries(first(b"rpen"), budget)? {
|
||||
t.pens.push(field(e, 1).and_then(|f| Rd::new(f).u32()).map(|w| f64::from(w) * unit));
|
||||
}
|
||||
for e in entries(first(b"rott"), budget)? {
|
||||
t.line_types.push(field(e, 1).and_then(|f| Some((*f.first()?, f.get(1).copied().unwrap_or(0)))));
|
||||
}
|
||||
for e in entries(first(b"rdot"), budget)? {
|
||||
let mut r = Rd::new(field(e, 1).unwrap_or_default());
|
||||
let n = r.u16().map_or(0, usize::from);
|
||||
t.dashes.push((0..n).map_while(|_| r.u16()).collect());
|
||||
}
|
||||
for e in entries(first(b"rotl"), budget)? {
|
||||
t.outlines.push(field(e, 1).and_then(|f| {
|
||||
let mut r = Rd::new(f);
|
||||
Some([r.u16()?, r.u16()?, r.u16()?, r.u16()?, r.u16()?, r.u16()?])
|
||||
}));
|
||||
}
|
||||
// Arrowhead pairs are plain u16 pairs after the count, not field lists (R59).
|
||||
let mut r = Rd::new(first(b"rota"));
|
||||
let n = r.u16().map_or(0, usize::from);
|
||||
for _ in 0..n {
|
||||
let Some(pair) = r.u16().zip(r.u16()) else { break };
|
||||
budget.take_chunk()?;
|
||||
t.arrowheads.push(pair);
|
||||
}
|
||||
Ok(t)
|
||||
}
|
||||
|
||||
/// Entry `index` (1-based) of `list`, or `None` with a warning when there is none.
|
||||
fn get<T: Clone>(list: &[Option<T>], index: u16, warn: &mut Vec<Warning>) -> Option<T> {
|
||||
let found = usize::from(index).checked_sub(1).and_then(|i| list.get(i)).cloned().flatten();
|
||||
if found.is_none() {
|
||||
push(warn, Warning::Damaged);
|
||||
}
|
||||
found
|
||||
}
|
||||
|
||||
fn color(&self, index: u16, warn: &mut Vec<Warning>) -> Color {
|
||||
Tables::get(&self.colors, index, warn).unwrap_or(Color::Rgb([0.0; 3]))
|
||||
}
|
||||
|
||||
/// The outline of `rotl` entry `index`, or `None` when its line type draws none (R57, R58).
|
||||
fn outline(&self, index: u16, budget: &mut Budget, warn: &mut Vec<Warning>) -> Option<Outline> {
|
||||
let [line, _screen, color, arrows, pen, dash] = Tables::get(&self.outlines, index, warn)?;
|
||||
let (flags, caps_join) = Tables::get(&self.line_types, line, warn).unwrap_or((2, 0));
|
||||
if flags & 1 != 0 {
|
||||
return None;
|
||||
}
|
||||
let width = Tables::get(&self.pens, pen, warn).unwrap_or(0.0);
|
||||
let mut dashes = Vec::new();
|
||||
if flags & 4 != 0 {
|
||||
let stored = usize::from(dash).checked_sub(1).and_then(|i| self.dashes.get(i));
|
||||
match stored {
|
||||
Some(d) if budget.take_dashes(d.len()) => dashes = d.iter().map(|x| f64::from(*x)).collect(),
|
||||
Some(_) => push(warn, Warning::TooDeep),
|
||||
None => push(warn, Warning::Damaged),
|
||||
}
|
||||
}
|
||||
if usize::from(arrows).checked_sub(1).and_then(|i| self.arrowheads.get(i)).is_some_and(|(s, e)| *s != 0 || *e != 0) {
|
||||
push(warn, Warning::Arrowheads);
|
||||
}
|
||||
Some(Outline {
|
||||
width,
|
||||
color: self.color(color, warn),
|
||||
cap: match caps_join & 0x0f {
|
||||
1 => Cap::Round,
|
||||
2 => Cap::Square,
|
||||
_ => Cap::Butt,
|
||||
},
|
||||
join: match caps_join >> 4 {
|
||||
1 => Join::Round,
|
||||
2 => Join::Bevel,
|
||||
_ => Join::Miter,
|
||||
},
|
||||
dashes,
|
||||
behind_fill: flags & 8 != 0,
|
||||
scale_with: flags & 16 != 0,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
/// A color entry (R56): the property list of field 10 when there is one, else the model and
|
||||
/// palette bytes of field 1 and the values of field 2. Colors in other models read as black with a
|
||||
/// warning.
|
||||
fn color(e: &[u8], record: Option<&Profile>, warn: &mut Vec<Warning>) -> Option<Color> {
|
||||
if let (Some(f), Some(p)) = (field(e, 10), record) {
|
||||
let mut r = Rd::new(f);
|
||||
let len = r.u32()? as usize;
|
||||
return property_color(r.bytes(len.min(r.left()))?, p, warn);
|
||||
}
|
||||
let model = *field(e, 1)?.first()?;
|
||||
let v = field(e, 2)?;
|
||||
let byte = |i: usize| v.get(i).map(|b| f32::from(*b));
|
||||
let pct = |i: usize| byte(i).map(|x| (x / 100.0).clamp(0.0, 1.0));
|
||||
let full = |i: usize| byte(i).map(|x| x / 255.0);
|
||||
Some(match model {
|
||||
2 => Color::Cmyk([pct(0)?, pct(1)?, pct(2)?, pct(3)?]),
|
||||
3 => Color::Cmyk([full(0)?, full(1)?, full(2)?, full(3)?]),
|
||||
5 => Color::Rgb([full(0)?, full(1)?, full(2)?]),
|
||||
_ => {
|
||||
push(warn, Warning::UnknownColors);
|
||||
Color::Rgb([0.0; 3])
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/// The objects of one layer while it is read: the layer's own list, then one list for each group
|
||||
/// left open.
|
||||
struct LayerRead {
|
||||
name: String,
|
||||
lists: Vec<Vec<Object>>,
|
||||
}
|
||||
|
||||
impl LayerRead {
|
||||
/// The layer, its open groups closed. Lists are drawn back to front (R60), and the model holds
|
||||
/// them front to back.
|
||||
fn finish(mut self) -> Layer {
|
||||
while self.lists.len() > 1 {
|
||||
close_group(&mut self.lists);
|
||||
}
|
||||
let mut objects = self.lists.pop().unwrap_or_default();
|
||||
objects.reverse();
|
||||
Layer { name: self.name, kind: LayerKind::Drawing, flags: Default::default(), objects, guides: Vec::new() }
|
||||
}
|
||||
}
|
||||
|
||||
/// Close the innermost open group of `lists` into the one that holds it.
|
||||
fn close_group(lists: &mut Vec<Vec<Object>>) {
|
||||
if lists.len() < 2 {
|
||||
return;
|
||||
}
|
||||
let mut objects = lists.pop().unwrap_or_default();
|
||||
objects.reverse();
|
||||
if let Some(top) = lists.last_mut() {
|
||||
top.push(Object::Group { objects, flags: Default::default() });
|
||||
}
|
||||
}
|
||||
|
||||
/// The reading of one page chunk.
|
||||
struct PageRead<'t, 'b> {
|
||||
tables: &'t Tables,
|
||||
unit: f64,
|
||||
budget: &'b mut Budget,
|
||||
warn: &'b mut Vec<Warning>,
|
||||
size: Option<(f64, f64)>,
|
||||
/// The page's center in the file's coordinates when the page takes its size from the
|
||||
/// drawing's bounds; points are moved by it so the art lies on the page.
|
||||
center: (f64, f64),
|
||||
layers: Vec<Layer>,
|
||||
open: Option<LayerRead>,
|
||||
/// Groups nested past the depth limit that are still open; their content is left out.
|
||||
skipped: usize,
|
||||
}
|
||||
|
||||
impl<'t, 'b> PageRead<'t, 'b> {
|
||||
fn new(tables: &'t Tables, unit: f64, budget: &'b mut Budget, warn: &'b mut Vec<Warning>) -> Self {
|
||||
PageRead { tables, unit, budget, warn, size: None, center: (0.0, 0.0), layers: Vec::new(), open: None, skipped: 0 }
|
||||
}
|
||||
|
||||
/// The instructions of a page chunk: a u16 size counting the whole instruction and an i16 code,
|
||||
/// or 0xFFFF, a u32 size and the code; then the code's field lists (R60).
|
||||
fn read(mut self, c: &Chunk) -> Result<Page, Error> {
|
||||
let d = c.body;
|
||||
let mut pos = 0usize;
|
||||
while pos.saturating_add(4) <= d.len() {
|
||||
self.budget.take_chunk()?;
|
||||
let mut r = Rd::at(d, pos);
|
||||
let (size, code, head) = match r.u16() {
|
||||
Some(0xFFFF) => match (r.u32(), r.i16()) {
|
||||
(Some(size), Some(code)) => (size as usize, code, 8),
|
||||
_ => break,
|
||||
},
|
||||
Some(size) => match r.i16() {
|
||||
Some(code) => (usize::from(size), code, 4),
|
||||
None => break,
|
||||
},
|
||||
None => break,
|
||||
};
|
||||
if size < head {
|
||||
push(self.warn, Warning::Damaged);
|
||||
break;
|
||||
}
|
||||
let end = pos.saturating_add(size);
|
||||
if end > d.len() {
|
||||
push(self.warn, Warning::Damaged);
|
||||
}
|
||||
let body = d.get(pos + head..end.min(d.len())).unwrap_or_default();
|
||||
if code == JUMP {
|
||||
// Field 1 is the file offset the instructions go on from; the bytes passed over
|
||||
// hold the page's images (R60).
|
||||
let target = field(body, 1).and_then(|f| Rd::new(f).u32()).and_then(|t| (t as usize).checked_sub(c.start));
|
||||
pos = target.filter(|t| *t >= end && *t <= d.len()).unwrap_or(end);
|
||||
if pos > end {
|
||||
push(self.warn, Warning::UnsupportedObjects);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
self.instruction(code, body);
|
||||
pos = end;
|
||||
}
|
||||
if pos < d.len() {
|
||||
// An instruction whose head runs past the page was not read.
|
||||
push(self.warn, Warning::Damaged);
|
||||
}
|
||||
self.close_layer();
|
||||
// A layer that holds nothing (the special layers every sample file lists empty) is left
|
||||
// out. The file lists layers back to front.
|
||||
let mut layers = self.layers;
|
||||
layers.retain(|l| !l.objects.is_empty());
|
||||
layers.reverse();
|
||||
Ok(Page { size: self.size, layers })
|
||||
}
|
||||
|
||||
fn instruction(&mut self, code: i16, body: &[u8]) {
|
||||
match code {
|
||||
BEGIN_PAGE => {
|
||||
// Field 4: the page's width and height (R61).
|
||||
let mut r = Rd::new(field(body, 4).unwrap_or_default());
|
||||
if let (Some(w), Some(h)) = (r.u32(), r.u32()) {
|
||||
let (w, h) = (f64::from(w) * self.unit, f64::from(h) * self.unit);
|
||||
self.size = (w > 0.0 && h > 0.0).then_some((w, h));
|
||||
}
|
||||
if self.size.is_none() {
|
||||
self.size_from_bounds(field(body, 1).unwrap_or_default());
|
||||
}
|
||||
}
|
||||
BEGIN_LAYER => {
|
||||
self.close_layer();
|
||||
let name = self.layer_name(body).unwrap_or_else(|| format!("Layer {}", self.layers.len() + 1));
|
||||
self.open = Some(LayerRead { name, lists: vec![Vec::new()] });
|
||||
}
|
||||
END_LAYER => self.close_layer(),
|
||||
BEGIN_GROUP => {
|
||||
let open = self.layer().lists.len();
|
||||
if self.skipped > 0 || open > self.budget.limits.depth {
|
||||
self.skipped += 1;
|
||||
push(self.warn, Warning::TooDeep);
|
||||
} else if self.budget.take_object() {
|
||||
self.layer().lists.push(Vec::new());
|
||||
} else {
|
||||
// Past the object limit the group's content joins the group that holds it.
|
||||
self.skipped += 1;
|
||||
push(self.warn, Warning::TooDeep);
|
||||
}
|
||||
}
|
||||
END_GROUP => {
|
||||
if self.skipped > 0 {
|
||||
self.skipped -= 1;
|
||||
} else {
|
||||
close_group(&mut self.layer().lists);
|
||||
}
|
||||
}
|
||||
CURVE if self.skipped == 0 => {
|
||||
if let Some(shape) = self.curve(body) {
|
||||
if self.budget.take_object() {
|
||||
if let Some(list) = self.layer().lists.last_mut() {
|
||||
list.push(Object::Shape(Box::new(shape)));
|
||||
}
|
||||
} else {
|
||||
push(self.warn, Warning::TooDeep);
|
||||
}
|
||||
}
|
||||
}
|
||||
BEGIN_TEXT | GLYPH_RUN | ELLIPSE | RECTANGLE | IMAGE | ADD_CLIP => push(self.warn, Warning::UnsupportedObjects),
|
||||
// These and the other codes (text styles and characters, color contexts) draw nothing
|
||||
// on their own.
|
||||
END_PAGE | END_TEXT | REMOVE_CLIP => {}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
||||
/// A page without a size of its own is sized to the drawing's bounds in field 1 (R61): a u16
|
||||
/// page number, a u32 of flags, then the left, top, right and bottom edges as i32 in
|
||||
/// coordinate units. The page is centered on those bounds.
|
||||
fn size_from_bounds(&mut self, f: &[u8]) {
|
||||
let mut r = Rd::new(f);
|
||||
if r.u16().is_none() || r.u32().is_none() {
|
||||
return;
|
||||
}
|
||||
let (Some(l), Some(t), Some(rt), Some(b)) = (r.i32(), r.i32(), r.i32(), r.i32()) else {
|
||||
return;
|
||||
};
|
||||
let (l, t, rt, b) = (f64::from(l) * self.unit, f64::from(t) * self.unit, f64::from(rt) * self.unit, f64::from(b) * self.unit);
|
||||
let (w, h) = ((rt - l).abs(), (t - b).abs());
|
||||
if w > 0.0 && h > 0.0 {
|
||||
self.size = Some((w, h));
|
||||
self.center = ((l + rt) / 2.0, (t + b) / 2.0);
|
||||
}
|
||||
}
|
||||
|
||||
/// The open layer, or a new one when objects come before any layer begins.
|
||||
fn layer(&mut self) -> &mut LayerRead {
|
||||
let n = self.layers.len() + 1;
|
||||
self.open.get_or_insert_with(|| LayerRead { name: format!("Layer {n}"), lists: vec![Vec::new()] })
|
||||
}
|
||||
|
||||
fn close_layer(&mut self) {
|
||||
self.skipped = 0;
|
||||
if let Some(l) = self.open.take() {
|
||||
self.layers.push(l.finish());
|
||||
}
|
||||
}
|
||||
|
||||
/// A layer's name: field 4 as a u32 count and UTF-16 units, else field 1 from byte 12 as a
|
||||
/// u16 count and 8-bit characters (R62).
|
||||
fn layer_name(&mut self, body: &[u8]) -> Option<String> {
|
||||
// A field 4 that can't be read leaves the name to field 1.
|
||||
let wide = field(body, 4).and_then(|f| {
|
||||
let mut r = Rd::new(f);
|
||||
let n = (r.u32()? as usize).min(MAX_NAME_UNITS).min(r.left() / 2);
|
||||
Some((r.bytes(n * 2)?, layout::for_version(1200)?))
|
||||
});
|
||||
if let Some((units, l)) = wide {
|
||||
let s = name(units, &l, self.warn);
|
||||
if !s.trim().is_empty() {
|
||||
return Some(s);
|
||||
}
|
||||
}
|
||||
let mut r = Rd::at(field(body, 1)?, 12);
|
||||
let n = usize::from(r.u16()?).min(r.left());
|
||||
let s = name(r.bytes(n)?, &layout::for_version(1100)?, self.warn);
|
||||
(!s.trim().is_empty()).then_some(s)
|
||||
}
|
||||
|
||||
/// A curve (R62): field 1 its rendering attributes, field 2 a u16 point count, the points (i32
|
||||
/// x and y) and one type byte for each. Points are from the page's center, y up.
|
||||
fn curve(&mut self, body: &[u8]) -> Option<Shape> {
|
||||
let mut r = Rd::new(field(body, 2).unwrap_or_default());
|
||||
let Some(count) = r.u16().map(usize::from) else {
|
||||
// A curve without its points is lost.
|
||||
push(self.warn, Warning::Damaged);
|
||||
return None;
|
||||
};
|
||||
// `stored` points are read, so the type bytes are found after all of them, and the first
|
||||
// `n`, those that have a type byte, are kept. When the field holds every point, a short
|
||||
// field has lost type bytes; otherwise it holds as many whole points and types as fit.
|
||||
let left = r.left();
|
||||
let (stored, n) = match count.checked_mul(8).filter(|c| *c <= left) {
|
||||
Some(c) => (count, count.min(left - c)),
|
||||
None => (count.min(left / 9), count.min(left / 9)),
|
||||
};
|
||||
if n < count {
|
||||
push(self.warn, Warning::Damaged);
|
||||
}
|
||||
if !self.budget.take_coordinates(stored) {
|
||||
push(self.warn, Warning::TooDeep);
|
||||
return None;
|
||||
}
|
||||
let mut points = Vec::with_capacity(stored);
|
||||
for _ in 0..stored {
|
||||
let (x, y) = (f64::from(r.i32()?) * self.unit, f64::from(r.i32()?) * self.unit);
|
||||
points.push(Pt { x: x - self.center.0, y: y - self.center.1 });
|
||||
}
|
||||
points.truncate(n);
|
||||
let path = path_of(&points, r.bytes(n)?);
|
||||
if path.subpaths.is_empty() {
|
||||
return None;
|
||||
}
|
||||
let (fill, outline) = self.attributes(field(body, 1).unwrap_or_default());
|
||||
Some(Shape::new(Geometry::Path(path), Matrix::IDENTITY, fill, outline))
|
||||
}
|
||||
|
||||
/// Rendering attributes (R63): a mask (1 fill, 2 outline, 4 lens), then a field list for the
|
||||
/// fill and one for the outline when the mask names them.
|
||||
fn attributes(&mut self, a: &[u8]) -> (Option<Color>, Option<Outline>) {
|
||||
let Some(&mask) = a.first() else { return (None, None) };
|
||||
let mut pos = 1;
|
||||
let mut fill = None;
|
||||
if mask & 1 != 0 {
|
||||
let end = list_end(a, pos);
|
||||
let list = a.get(pos..end).unwrap_or_default();
|
||||
pos = end;
|
||||
// Field 1: the fill type (u16), then its own field list; type 1, uniform, names its
|
||||
// color in field 1.
|
||||
let v = field(list, 1).unwrap_or_default();
|
||||
match Rd::new(v).u16() {
|
||||
Some(0) | None => {}
|
||||
Some(1) => {
|
||||
let index = field(v.get(2..).unwrap_or_default(), 1).and_then(|c| Rd::new(c).u16());
|
||||
fill = Some(match index {
|
||||
Some(i) => self.tables.color(i, self.warn),
|
||||
None => {
|
||||
push(self.warn, Warning::Damaged);
|
||||
Color::Rgb([0.0; 3])
|
||||
}
|
||||
});
|
||||
}
|
||||
Some(_) => push(self.warn, Warning::UnsupportedFills),
|
||||
}
|
||||
}
|
||||
let mut outline = None;
|
||||
if mask & 2 != 0 {
|
||||
let list = a.get(pos..list_end(a, pos)).unwrap_or_default();
|
||||
match field(list, 1).and_then(|f| Rd::new(f).u16()) {
|
||||
Some(i) => outline = self.tables.outline(i, self.budget, self.warn),
|
||||
None => push(self.warn, Warning::Damaged),
|
||||
}
|
||||
}
|
||||
if mask & 4 != 0 {
|
||||
push(self.warn, Warning::Lenses);
|
||||
}
|
||||
(fill, outline)
|
||||
}
|
||||
}
|
||||
@@ -91,7 +91,7 @@ fn points(b: &[u8], mut r: Rd, count: usize, p: &Profile, budget: &mut Budget, w
|
||||
}
|
||||
|
||||
/// The subpaths that points and their type bytes draw.
|
||||
fn path_of(points: &[Pt], types: &[u8]) -> Path {
|
||||
pub(crate) fn path_of(points: &[Pt], types: &[u8]) -> Path {
|
||||
let mut subpaths = Vec::new();
|
||||
let mut cur: Option<SubPath> = None;
|
||||
// The last two control points: a curve end uses only those.
|
||||
|
||||
+27
-3
@@ -1,11 +1,13 @@
|
||||
//! Reader for `.cdr` drawings of versions 1 to 27 (`.cdr`, and `.cdt` templates): the `WL` files
|
||||
//! of versions 1 and 2, the RIFF chunk tree of versions 3 on with its compressed lists, the ZIP
|
||||
//! packages of versions 14 on with their data streams, then pages, layers, guidelines, groups,
|
||||
//! curves, rectangles, ellipses, arcs and polygons with uniform fills and outlines.
|
||||
//! curves, rectangles, ellipses, arcs and polygons with uniform fills and outlines. It also reads
|
||||
//! `.cmx` exchange files with 32-bit coordinates ([`read_cmx`]): their pages, layers, groups and
|
||||
//! curves with uniform fills and outlines.
|
||||
//!
|
||||
//! Every record layout the reader relies on is listed in `PROVENANCE.md` with its public source
|
||||
//! and status; code cites the row ids (R1 ...). Reading is bounded by [`Limits`], never recurses and does not
|
||||
//! panic. Nothing here writes `.cdr` files.
|
||||
//! panic. Nothing here writes `.cdr` or `.cmx` files.
|
||||
#![forbid(unsafe_code)]
|
||||
#![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable)]
|
||||
|
||||
@@ -13,6 +15,7 @@ use std::fmt;
|
||||
|
||||
mod build;
|
||||
mod bytes;
|
||||
mod cmx;
|
||||
mod geometry;
|
||||
mod inline;
|
||||
mod layout;
|
||||
@@ -24,6 +27,8 @@ mod riff;
|
||||
mod styles;
|
||||
#[cfg(any(test, feature = "synth"))]
|
||||
pub mod synth;
|
||||
#[cfg(any(test, feature = "synth"))]
|
||||
pub mod synth_cmx;
|
||||
mod wl;
|
||||
mod zip;
|
||||
|
||||
@@ -36,11 +41,19 @@ pub fn is_cdr(bytes: &[u8]) -> bool {
|
||||
riff::is_cdr_riff(bytes) || package::is_package(bytes) || wl::is_wl(bytes)
|
||||
}
|
||||
|
||||
/// Does `bytes` start as a `.cmx` exchange file: a RIFF form (or its big-endian RIFX form) of type
|
||||
/// `CMX1`?
|
||||
pub fn is_cmx(bytes: &[u8]) -> bool {
|
||||
cmx::is_cmx(bytes)
|
||||
}
|
||||
|
||||
/// Why a file can't be read.
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub enum Error {
|
||||
/// Not a `.cdr` drawing.
|
||||
NotCdr,
|
||||
/// Not a `.cmx` file.
|
||||
NotCmx,
|
||||
/// A drawing of a version this reader doesn't read (hundreds: 2800 is version 28).
|
||||
Version(u16),
|
||||
/// A container structure that doesn't parse.
|
||||
@@ -48,7 +61,7 @@ pub enum Error {
|
||||
/// Past one of the [`Limits`].
|
||||
Limit(&'static str),
|
||||
/// A file this reader doesn't open: an encrypted, ZIP64 or split package, or a RIFF file that
|
||||
/// names a version before 3.
|
||||
/// names a version before 3; a big-endian `.cmx` file or one with 16-bit coordinates.
|
||||
Unsupported(&'static str),
|
||||
}
|
||||
|
||||
@@ -56,6 +69,7 @@ impl fmt::Display for Error {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
match self {
|
||||
Error::NotCdr => write!(f, "not a CDR drawing"),
|
||||
Error::NotCmx => write!(f, "not a CMX file"),
|
||||
Error::Version(v) => write!(f, "version {} drawings are not read", v / 100),
|
||||
Error::Damaged(what) => write!(f, "damaged {what}"),
|
||||
Error::Limit(what) => write!(f, "past the {what} limit"),
|
||||
@@ -84,3 +98,13 @@ pub fn read(bytes: &[u8], limits: Limits) -> Result<Drawing, Error> {
|
||||
ix.stream_warnings(&mut drawing.warnings);
|
||||
Ok(drawing)
|
||||
}
|
||||
|
||||
/// Read a `.cmx` exchange file within `limits`. Files in big-endian byte order and files with
|
||||
/// 16-bit coordinates are refused with [`Error::Unsupported`]. Its [`Drawing::version`] is 0.
|
||||
pub fn read_cmx(bytes: &[u8], limits: Limits) -> Result<Drawing, Error> {
|
||||
if bytes.len() > limits.input {
|
||||
return Err(Error::Limit("input size"));
|
||||
}
|
||||
let mut budget = limits::Budget::new(limits);
|
||||
cmx::drawing(bytes, &mut budget)
|
||||
}
|
||||
|
||||
@@ -15,7 +15,8 @@ pub struct Limits {
|
||||
pub members: usize,
|
||||
/// Nested lists below the file's own. Deeper content is left out with a warning.
|
||||
pub depth: usize,
|
||||
/// Chunks in the index, nested ones included, and the entries and styles of the style table.
|
||||
/// Chunks in the index, nested ones included, and the entries and styles of the style table;
|
||||
/// in a `.cmx` file, its chunks, table entries and page instructions.
|
||||
pub chunks: usize,
|
||||
/// Objects mapped (shapes, groups and guidelines).
|
||||
pub objects: usize,
|
||||
|
||||
@@ -241,7 +241,8 @@ pub enum Warning {
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
pub struct Drawing {
|
||||
/// In hundreds, as a RIFF file stores it: 300 to 2799. A file of version 1 or 2 stores no
|
||||
/// number: it gives 200 when its marker byte is the one of version 2, and 100 otherwise.
|
||||
/// number: it gives 200 when its marker byte is the one of version 2, and 100 otherwise. A
|
||||
/// `.cmx` file gives 0.
|
||||
pub version: u16,
|
||||
/// Page size from the document settings, in points.
|
||||
pub page_size: Option<(f64, f64)>,
|
||||
|
||||
@@ -212,7 +212,7 @@ fn counted_utf16(r: &mut Rd, warn: &mut Vec<Warning>) -> Option<String> {
|
||||
|
||||
/// The color of the property list of a tagged uniform fill (R11) or outline (R12): its color
|
||||
/// record, named by the library name it carries.
|
||||
fn property_color(b: &[u8], p: &Profile, warn: &mut Vec<Warning>) -> Option<Color> {
|
||||
pub(crate) fn property_color(b: &[u8], p: &Profile, warn: &mut Vec<Warning>) -> Option<Color> {
|
||||
let mut r = Rd::new(b);
|
||||
let (mut found, mut name) = (None, None);
|
||||
while r.left() >= 5 {
|
||||
|
||||
@@ -0,0 +1,274 @@
|
||||
//! Synthetic `.cmx` files for tests and fuzz seeds, built from the layouts in `PROVENANCE.md` (R53
|
||||
//! to R63). Not a `.cmx` writer: nothing checks that other programs open these files.
|
||||
|
||||
/// A chunk: its id, a u32 size, the body and a pad byte after an odd body (R53).
|
||||
pub fn chunk(id: &[u8; 4], body: &[u8]) -> Vec<u8> {
|
||||
let mut out = id.to_vec();
|
||||
out.extend((body.len() as u32).to_le_bytes());
|
||||
out.extend(body);
|
||||
if body.len() % 2 == 1 {
|
||||
out.push(0);
|
||||
}
|
||||
out
|
||||
}
|
||||
|
||||
/// A `LIST` chunk of form `form`.
|
||||
pub fn list(form: &[u8; 4], children: &[Vec<u8>]) -> Vec<u8> {
|
||||
let mut body = form.to_vec();
|
||||
body.extend(children.concat());
|
||||
chunk(b"LIST", &body)
|
||||
}
|
||||
|
||||
/// The RIFF form `CMX1` around `children`.
|
||||
pub fn riff(children: &[Vec<u8>]) -> Vec<u8> {
|
||||
let mut body = b"CMX1".to_vec();
|
||||
body.extend(children.concat());
|
||||
chunk(b"RIFF", &body)
|
||||
}
|
||||
|
||||
/// The header (R54): `coord` is the coordinate size digit (`b'4'` or `b'2'`) and `meters` the size
|
||||
/// of a coordinate unit. The header string and the system name, which the reader doesn't read,
|
||||
/// are left as zeros.
|
||||
pub fn cont(coord: u8, meters: f64) -> Vec<u8> {
|
||||
let mut c = vec![0u8; 180];
|
||||
c[48] = b'2';
|
||||
c[52] = coord;
|
||||
c[54] = b'2';
|
||||
c[64..72].copy_from_slice(&meters.to_le_bytes());
|
||||
chunk(b"cont", &c)
|
||||
}
|
||||
|
||||
/// A field: its tag, a u16 length counting the 3 header bytes, then `data` (R55).
|
||||
pub fn field(tag: u8, data: &[u8]) -> Vec<u8> {
|
||||
let mut f = vec![tag];
|
||||
f.extend(((data.len() + 3) as u16).to_le_bytes());
|
||||
f.extend(data);
|
||||
f
|
||||
}
|
||||
|
||||
/// A field list: the fields, then 0xff (R55).
|
||||
pub fn fields(fields: &[Vec<u8>]) -> Vec<u8> {
|
||||
let mut l = fields.concat();
|
||||
l.push(0xff);
|
||||
l
|
||||
}
|
||||
|
||||
/// A table chunk: a u16 count, then the entries (field lists) (R55).
|
||||
pub fn table(id: &[u8; 4], entries: &[Vec<u8>]) -> Vec<u8> {
|
||||
let mut d = (entries.len() as u16).to_le_bytes().to_vec();
|
||||
d.extend(entries.concat());
|
||||
chunk(id, &d)
|
||||
}
|
||||
|
||||
/// A color entry in the older form: the model and palette bytes in field 1, the values in field 2
|
||||
/// (R56).
|
||||
pub fn color(model: u8, values: &[u8]) -> Vec<u8> {
|
||||
fields(&[field(1, &[model, 5]), field(2, values)])
|
||||
}
|
||||
|
||||
/// A color entry with a property list in field 10 whose color record (part 1) holds `model` and
|
||||
/// the four value bytes `v` (R56).
|
||||
pub fn color_record(model: u16, v: [u8; 4]) -> Vec<u8> {
|
||||
let mut part = vec![1u8];
|
||||
part.extend(12u32.to_le_bytes());
|
||||
part.extend(model.to_le_bytes());
|
||||
part.extend(5u16.to_le_bytes());
|
||||
part.extend([0; 4]);
|
||||
part.extend(v);
|
||||
let mut rec = (part.len() as u32).to_le_bytes().to_vec();
|
||||
rec.extend(part);
|
||||
fields(&[field(10, &rec)])
|
||||
}
|
||||
|
||||
/// A pen entry (R57): the width in coordinate units, an aspect of 100 and no angle, with the
|
||||
/// identity matrix.
|
||||
pub fn pen(width: u32) -> Vec<u8> {
|
||||
let mut d = width.to_le_bytes().to_vec();
|
||||
d.extend(100u16.to_le_bytes());
|
||||
d.extend(0i32.to_le_bytes());
|
||||
d.extend(1u16.to_le_bytes());
|
||||
fields(&[field(1, &d)])
|
||||
}
|
||||
|
||||
/// A line type entry (R57): its flags and the caps (low 4 bits) and join (high 4 bits).
|
||||
pub fn line_type(flags: u8, caps_join: u8) -> Vec<u8> {
|
||||
fields(&[field(1, &[flags, caps_join])])
|
||||
}
|
||||
|
||||
/// A dash pattern entry (R57): the lengths in outline widths.
|
||||
pub fn dashes(lengths: &[u16]) -> Vec<u8> {
|
||||
let mut d = (lengths.len() as u16).to_le_bytes().to_vec();
|
||||
d.extend(lengths.iter().flat_map(|l| l.to_le_bytes()));
|
||||
fields(&[field(1, &d)])
|
||||
}
|
||||
|
||||
/// An outline entry (R58): 1-based indexes of the line type, screen, color, arrowhead pair, pen and
|
||||
/// dash pattern.
|
||||
pub fn outline(parts: [u16; 6]) -> Vec<u8> {
|
||||
fields(&[field(1, &parts.iter().flat_map(|p| p.to_le_bytes()).collect::<Vec<u8>>())])
|
||||
}
|
||||
|
||||
/// The arrowhead pairs chunk (R59): a u16 count, then start and end (u16 each).
|
||||
pub fn arrowheads(pairs: &[(u16, u16)]) -> Vec<u8> {
|
||||
let mut d = (pairs.len() as u16).to_le_bytes().to_vec();
|
||||
for (s, e) in pairs {
|
||||
d.extend(s.to_le_bytes());
|
||||
d.extend(e.to_le_bytes());
|
||||
}
|
||||
chunk(b"rota", &d)
|
||||
}
|
||||
|
||||
/// An instruction in the short form: a u16 size counting the whole instruction, the code, the
|
||||
/// body (R60).
|
||||
pub fn instr(code: i16, body: &[u8]) -> Vec<u8> {
|
||||
let mut i = ((body.len() + 4) as u16).to_le_bytes().to_vec();
|
||||
i.extend(code.to_le_bytes());
|
||||
i.extend(body);
|
||||
i
|
||||
}
|
||||
|
||||
/// An instruction in the long form: 0xFFFF, a u32 size counting the whole instruction, the code,
|
||||
/// the body (R60).
|
||||
pub fn long_instr(code: i16, body: &[u8]) -> Vec<u8> {
|
||||
let mut i = 0xFFFFu16.to_le_bytes().to_vec();
|
||||
i.extend(((body.len() + 8) as u32).to_le_bytes());
|
||||
i.extend(code.to_le_bytes());
|
||||
i.extend(body);
|
||||
i
|
||||
}
|
||||
|
||||
/// Begin a page (R61), with its width and height in coordinate units in field 4 when given.
|
||||
pub fn begin_page(size: Option<(u32, u32)>) -> Vec<u8> {
|
||||
let mut f = vec![field(1, &[1, 0, 0, 0, 0, 0])];
|
||||
if let Some((w, h)) = size {
|
||||
let mut d = w.to_le_bytes().to_vec();
|
||||
d.extend(h.to_le_bytes());
|
||||
f.push(field(4, &d));
|
||||
}
|
||||
instr(9, &fields(&f))
|
||||
}
|
||||
|
||||
/// Begin a page (R61) without a size of its own, with the drawing's left, top, right and bottom
|
||||
/// edges in field 1.
|
||||
pub fn begin_page_in_bounds(left: i32, top: i32, right: i32, bottom: i32) -> Vec<u8> {
|
||||
let mut d = vec![1, 0, 0, 0, 0, 0];
|
||||
for v in [left, top, right, bottom] {
|
||||
d.extend(v.to_le_bytes());
|
||||
}
|
||||
instr(9, &fields(&[field(1, &d)]))
|
||||
}
|
||||
|
||||
/// Begin a layer (R62) named in 8-bit characters in field 1 from byte 12, and in UTF-16 in
|
||||
/// field 4 when `wide` is given.
|
||||
pub fn begin_layer(name: &str, wide: Option<&str>) -> Vec<u8> {
|
||||
let mut d = vec![1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0];
|
||||
d.extend((name.len() as u16).to_le_bytes());
|
||||
d.extend(name.bytes());
|
||||
let mut f = vec![field(1, &d)];
|
||||
if let Some(w) = wide {
|
||||
let units: Vec<u16> = w.encode_utf16().collect();
|
||||
let mut d = (units.len() as u32).to_le_bytes().to_vec();
|
||||
d.extend(units.iter().flat_map(|u| u.to_le_bytes()));
|
||||
f.push(field(4, &d));
|
||||
}
|
||||
instr(11, &fields(&f))
|
||||
}
|
||||
|
||||
pub fn end_layer() -> Vec<u8> {
|
||||
instr(12, &[])
|
||||
}
|
||||
|
||||
pub fn end_page() -> Vec<u8> {
|
||||
instr(10, &[])
|
||||
}
|
||||
|
||||
pub fn begin_group() -> Vec<u8> {
|
||||
instr(13, &fields(&[field(1, &[0; 26])]))
|
||||
}
|
||||
|
||||
pub fn end_group() -> Vec<u8> {
|
||||
instr(14, &[])
|
||||
}
|
||||
|
||||
/// Rendering attributes (R63): a uniform fill of color `fill` and the outline `outline` (1-based
|
||||
/// indexes; `None` leaves the part out of the mask), and `lens` sets the lens bit.
|
||||
pub fn attrs(fill: Option<u16>, outline: Option<u16>, lens: bool) -> Vec<u8> {
|
||||
let mask = u8::from(fill.is_some()) | (u8::from(outline.is_some()) << 1) | (u8::from(lens) << 2);
|
||||
let mut a = vec![mask];
|
||||
if let Some(c) = fill {
|
||||
let mut v = 1u16.to_le_bytes().to_vec();
|
||||
let mut uniform = c.to_le_bytes().to_vec();
|
||||
uniform.extend(0u16.to_le_bytes());
|
||||
v.extend(fields(&[field(1, &uniform)]));
|
||||
a.extend(fields(&[field(1, &v)]));
|
||||
}
|
||||
if let Some(o) = outline {
|
||||
a.extend(fields(&[field(1, &o.to_le_bytes())]));
|
||||
}
|
||||
a
|
||||
}
|
||||
|
||||
/// Rendering attributes with a fill of type `kind` and no settings of its own.
|
||||
pub fn attrs_fill_type(kind: u16) -> Vec<u8> {
|
||||
let mut a = vec![1u8];
|
||||
a.extend(fields(&[field(1, &kind.to_le_bytes())]));
|
||||
a
|
||||
}
|
||||
|
||||
/// A curve (R62): `attrs`, then a u16 count, the points (i32 x, y) and their type bytes.
|
||||
pub fn curve(attrs: &[u8], points: &[(i32, i32)], types: &[u8]) -> Vec<u8> {
|
||||
let mut g = (points.len() as u16).to_le_bytes().to_vec();
|
||||
for (x, y) in points {
|
||||
g.extend(x.to_le_bytes());
|
||||
g.extend(y.to_le_bytes());
|
||||
}
|
||||
g.extend(types);
|
||||
instr(67, &fields(&[field(1, attrs), field(2, &g), field(3, &[0; 16])]))
|
||||
}
|
||||
|
||||
/// A closed square of side `side` with its lower left corner at (`x`, `y`).
|
||||
pub fn square(attrs: &[u8], x: i32, y: i32, side: i32) -> Vec<u8> {
|
||||
curve(attrs, &[(x, y), (x + side, y), (x + side, y + side), (x, y + side), (x, y)], &[0x0c, 0x44, 0x44, 0x44, 0x48])
|
||||
}
|
||||
|
||||
/// A `page` chunk of `instructions`.
|
||||
pub fn page(instructions: &[Vec<u8>]) -> Vec<u8> {
|
||||
chunk(b"page", &instructions.concat())
|
||||
}
|
||||
|
||||
/// The tables of [`sample`]: colors red (RGB), black (CMYK in percent) and blue (a color record,
|
||||
/// blue, green, red); pens of 0.5 mm and 1 mm; line types solid with round caps and joins, none,
|
||||
/// and dashed behind the fill; one dash pattern; three outlines; one empty arrowhead pair.
|
||||
pub fn tables() -> Vec<Vec<u8>> {
|
||||
vec![
|
||||
table(b"rclr", &[color(5, &[255, 0, 0]), color(2, &[0, 0, 0, 100]), color_record(5, [255, 0, 0, 0])]),
|
||||
table(b"rpen", &[pen(5_000), pen(10_000)]),
|
||||
table(b"rott", &[line_type(2, 0x11), line_type(1, 0), line_type(2 | 4 | 8, 0x02)]),
|
||||
table(b"rdot", &[dashes(&[3, 1])]),
|
||||
table(b"rotl", &[outline([1, 1, 2, 1, 1, 1]), outline([2, 1, 2, 1, 1, 1]), outline([3, 1, 3, 1, 2, 1])]),
|
||||
arrowheads(&[(0, 0)]),
|
||||
]
|
||||
}
|
||||
|
||||
/// One page of 210 x 297 mm with two layers: "Art" holds a red square outlined in black, then a
|
||||
/// group of a square with no outline and a blue one with the dashed outline; "Top" holds a black
|
||||
/// square drawn last. Units are 0.1 µm.
|
||||
pub fn sample() -> Vec<u8> {
|
||||
let p = page(&[
|
||||
begin_page(Some((2_100_000, 2_970_000))),
|
||||
begin_layer("Art", None),
|
||||
square(&attrs(Some(1), Some(1), false), -500_000, -500_000, 1_000_000),
|
||||
begin_group(),
|
||||
square(&attrs(Some(2), Some(2), false), 0, 0, 100_000),
|
||||
square(&attrs(Some(3), Some(3), false), 200_000, 0, 100_000),
|
||||
end_group(),
|
||||
end_layer(),
|
||||
begin_layer("Top", Some("Top")),
|
||||
square(&attrs(Some(2), None, false), 0, 0, 10_000),
|
||||
end_layer(),
|
||||
end_page(),
|
||||
]);
|
||||
let mut children = vec![cont(b'4', 1e-7), p];
|
||||
children.extend(tables());
|
||||
riff(&children)
|
||||
}
|
||||
@@ -0,0 +1,433 @@
|
||||
//! Reading synthetic `.cmx` files built from the layouts in `PROVENANCE.md` (R53 to R63), and
|
||||
//! hostile ones.
|
||||
|
||||
use proptest::prelude::*;
|
||||
use vectorcraft_cdr::model::{Cap, Color, Geometry, Join, Object, Shape};
|
||||
use vectorcraft_cdr::synth_cmx::*;
|
||||
use vectorcraft_cdr::{Error, Limits, Warning, is_cdr, is_cmx, read_cmx};
|
||||
|
||||
fn shape(o: &Object) -> &Shape {
|
||||
match o {
|
||||
Object::Shape(s) => s,
|
||||
other => panic!("not a shape: {other:?}"),
|
||||
}
|
||||
}
|
||||
|
||||
/// The (x, y) bounds of a shape's path.
|
||||
fn bounds(s: &Shape) -> (f64, f64, f64, f64) {
|
||||
let Geometry::Path(p) = &s.geometry else { panic!("not a path") };
|
||||
let mut b = (f64::MAX, f64::MAX, f64::MIN, f64::MIN);
|
||||
for sp in &p.subpaths {
|
||||
for pt in std::iter::once(sp.start).chain(sp.segments.iter().map(|s| match s {
|
||||
vectorcraft_cdr::model::Segment::Line(p) | vectorcraft_cdr::model::Segment::Cubic(_, _, p) => *p,
|
||||
})) {
|
||||
b = (b.0.min(pt.x), b.1.min(pt.y), b.2.max(pt.x), b.3.max(pt.y));
|
||||
}
|
||||
}
|
||||
b
|
||||
}
|
||||
|
||||
fn near(a: f64, b: f64) -> bool {
|
||||
(a - b).abs() < 1e-6
|
||||
}
|
||||
|
||||
/// The file with `children` after a 32-bit header and the sample tables.
|
||||
fn file(pages: &[Vec<u8>]) -> Vec<u8> {
|
||||
let mut children = vec![cont(b'4', 1e-7)];
|
||||
children.extend(pages.iter().cloned());
|
||||
children.extend(tables());
|
||||
riff(&children)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_cmx_file_is_told_from_a_cdr_drawing() {
|
||||
let f = sample();
|
||||
assert!(is_cmx(&f) && !is_cdr(&f));
|
||||
let mut rifx = f.clone();
|
||||
rifx[..4].copy_from_slice(b"RIFX");
|
||||
assert!(is_cmx(&rifx));
|
||||
assert!(!is_cmx(b"RIFF\0\0\0\0CDR9"));
|
||||
assert_eq!(read_cmx(b"RIFF\0\0\0\0CDR9", Limits::default()), Err(Error::NotCmx));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn pages_layers_groups_and_curves() {
|
||||
let d = read_cmx(&sample(), Limits::default()).unwrap();
|
||||
assert_eq!(d.version, 0);
|
||||
assert!(d.warnings.is_empty(), "{:?}", d.warnings);
|
||||
assert_eq!(d.pages.len(), 1);
|
||||
let page = &d.pages[0];
|
||||
// 2,100,000 units of 0.1 µm are 210 mm.
|
||||
let (w, h) = page.size.unwrap();
|
||||
assert!(near(w, 210.0 / 25.4 * 72.0) && near(h, 297.0 / 25.4 * 72.0), "{w} {h}");
|
||||
// The layer drawn last is in front: the model lists layers front to back.
|
||||
let names: Vec<&str> = page.layers.iter().map(|l| l.name.as_str()).collect();
|
||||
assert_eq!(names, ["Top", "Art"]);
|
||||
let art = &page.layers[1].objects;
|
||||
assert_eq!(art.len(), 2);
|
||||
// The group, drawn after the red square, is in front of it.
|
||||
let Object::Group { objects: kids, .. } = &art[0] else { panic!("{:?}", art[0]) };
|
||||
assert_eq!(kids.len(), 2);
|
||||
let red = shape(&art[1]);
|
||||
assert_eq!(red.fill, Some(Color::Rgb([1.0, 0.0, 0.0])));
|
||||
// 1,000,000 units are 100 mm; the square's corner is 50 mm left of and below the center.
|
||||
let mm = 72.0 / 25.4;
|
||||
let b = bounds(red);
|
||||
assert!(near(b.0, -50.0 * mm) && near(b.1, -50.0 * mm) && near(b.2, 50.0 * mm) && near(b.3, 50.0 * mm), "{b:?}");
|
||||
let Geometry::Path(p) = &red.geometry else { panic!() };
|
||||
assert!(p.subpaths.len() == 1 && p.subpaths[0].closed && p.subpaths[0].segments.len() == 4);
|
||||
let o = red.outline.as_ref().unwrap();
|
||||
assert!(near(o.width, 0.5 * mm));
|
||||
assert_eq!((o.color.clone(), o.cap, o.join), (Color::Cmyk([0.0, 0.0, 0.0, 1.0]), Cap::Round, Join::Round));
|
||||
assert!(o.dashes.is_empty() && !o.behind_fill && !o.scale_with);
|
||||
// Line type 1 draws no outline.
|
||||
let blue = shape(&kids[0]);
|
||||
let black = shape(&kids[1]);
|
||||
assert!(black.outline.is_none());
|
||||
assert_eq!(black.fill, Some(Color::Cmyk([0.0, 0.0, 0.0, 1.0])));
|
||||
// The color record's values are blue, green and red.
|
||||
assert_eq!(blue.fill, Some(Color::Rgb([0.0, 0.0, 1.0])));
|
||||
let o = blue.outline.as_ref().unwrap();
|
||||
assert!(near(o.width, 1.0 * mm));
|
||||
assert_eq!((o.dashes.clone(), o.behind_fill, o.cap, o.join), (vec![3.0, 1.0], true, Cap::Square, Join::Miter));
|
||||
assert_eq!(page.layers[0].name, "Top");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn layer_names_and_layers_without_objects() {
|
||||
let p = page(&[
|
||||
begin_page(None),
|
||||
begin_layer("Ebene 1", Some("Слой 1")),
|
||||
square(&attrs(Some(1), None, false), 0, 0, 1000),
|
||||
end_layer(),
|
||||
begin_layer("Gitter", None),
|
||||
end_layer(),
|
||||
begin_layer("Caf\u{e9}", None),
|
||||
square(&attrs(Some(1), None, false), 0, 0, 1000),
|
||||
end_layer(),
|
||||
end_page(),
|
||||
]);
|
||||
let d = read_cmx(&file(&[p]), Limits::default()).unwrap();
|
||||
let page = &d.pages[0];
|
||||
assert_eq!(page.size, None);
|
||||
// The empty layer is left out, and the UTF-16 name wins over the 8-bit one.
|
||||
let names: Vec<&str> = page.layers.iter().map(|l| l.name.as_str()).collect();
|
||||
assert_eq!(names, ["Caf\u{c3}\u{a9}", "Слой 1"]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn objects_before_any_layer_get_one() {
|
||||
let p = page(&[begin_page(None), square(&attrs(Some(1), None, false), 0, 0, 1000)]);
|
||||
let d = read_cmx(&file(&[p]), Limits::default()).unwrap();
|
||||
assert_eq!(d.pages[0].layers.len(), 1);
|
||||
assert_eq!(d.pages[0].layers[0].name, "Layer 1");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_page_without_a_size_takes_the_drawings_bounds() {
|
||||
// A square of 100 mm whose bounds lie off the file's origin, above and to the right.
|
||||
let p = page(&[
|
||||
begin_page_in_bounds(1_000_000, 3_000_000, 2_000_000, 2_000_000),
|
||||
begin_layer("L", None),
|
||||
square(&attrs(Some(1), None, false), 1_000_000, 2_000_000, 1_000_000),
|
||||
end_layer(),
|
||||
end_page(),
|
||||
]);
|
||||
let d = read_cmx(&file(&[p]), Limits::default()).unwrap();
|
||||
let page = &d.pages[0];
|
||||
let side = 100.0 / 25.4 * 72.0;
|
||||
let (w, h) = page.size.unwrap();
|
||||
assert!(near(w, side) && near(h, side), "{w} x {h}");
|
||||
// The page is centered on the bounds, so the square fills it.
|
||||
let (x0, y0, x1, y1) = bounds(shape(&page.layers[0].objects[0]));
|
||||
assert!(near(x0, -side / 2.0) && near(x1, side / 2.0) && near(y0, -side / 2.0) && near(y1, side / 2.0), "{x0} {y0} {x1} {y1}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn curves_and_open_groups() {
|
||||
let c =
|
||||
curve(&attrs(None, Some(1), false), &[(0, 0), (100, 0), (100, 100), (0, 100), (200, 200), (300, 200)], &[0x00, 0xc0, 0xc0, 0x84, 0x00, 0x44]);
|
||||
// A group the layer leaves open closes with it.
|
||||
let p = page(&[begin_page(None), begin_layer("L", None), begin_group(), c, end_layer()]);
|
||||
let d = read_cmx(&file(&[p]), Limits::default()).unwrap();
|
||||
let objects = &d.pages[0].layers[0].objects;
|
||||
let Object::Group { objects: kids, .. } = &objects[0] else { panic!("{objects:?}") };
|
||||
let s = shape(&kids[0]);
|
||||
assert!(s.fill.is_none());
|
||||
let Geometry::Path(p) = &s.geometry else { panic!() };
|
||||
assert_eq!(p.subpaths.len(), 2);
|
||||
assert!(matches!(p.subpaths[0].segments[..], [vectorcraft_cdr::model::Segment::Cubic(..)]));
|
||||
assert!(!p.subpaths[1].closed);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_curve_without_its_points_is_reported() {
|
||||
let p = page(&[begin_page(None), begin_layer("L", None), instr(67, &fields(&[field(1, &attrs(Some(1), None, false))])), end_layer()]);
|
||||
let d = read_cmx(&file(&[p]), Limits::default()).unwrap();
|
||||
assert!(d.warnings.contains(&Warning::Damaged), "{:?}", d.warnings);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_layer_name_too_short_to_read_in_utf_16_reads_in_8_bit() {
|
||||
let mut d = vec![1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0];
|
||||
d.extend(b"Art");
|
||||
let layer = instr(11, &fields(&[field(1, &d), field(4, &[3, 0])]));
|
||||
let p = page(&[begin_page(None), layer, square(&attrs(Some(1), None, false), 0, 0, 1000), end_layer()]);
|
||||
let d = read_cmx(&file(&[p]), Limits::default()).unwrap();
|
||||
assert_eq!(d.pages[0].layers[0].name, "Art");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn what_is_not_read_is_reported() {
|
||||
let other = |code: i16| instr(code, &fields(&[field(1, &[0; 8])]));
|
||||
let p = page(&[
|
||||
begin_page(None),
|
||||
begin_layer("L", None),
|
||||
other(66),
|
||||
other(68),
|
||||
other(20),
|
||||
other(88),
|
||||
square(&attrs_fill_type(2), 0, 0, 1000),
|
||||
square(&attrs(Some(1), None, true), 0, 0, 1000),
|
||||
end_layer(),
|
||||
]);
|
||||
let d = read_cmx(&file(&[p]), Limits::default()).unwrap();
|
||||
for w in [Warning::UnsupportedObjects, Warning::UnsupportedFills, Warning::Lenses] {
|
||||
assert!(d.warnings.contains(&w), "{w:?}: {:?}", d.warnings);
|
||||
}
|
||||
// A fill of another type leaves the curve unfilled; the curve is still read.
|
||||
let objects = &d.pages[0].layers[0].objects;
|
||||
assert_eq!(objects.len(), 2);
|
||||
assert!(shape(&objects[1]).fill.is_none());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn colors_of_other_models_and_missing_entries() {
|
||||
let mut children = vec![cont(b'4', 1e-7)];
|
||||
children.push(page(&[
|
||||
begin_page(None),
|
||||
begin_layer("L", None),
|
||||
square(&attrs(Some(1), None, false), 0, 0, 1000),
|
||||
square(&attrs(Some(9), None, false), 0, 0, 1000),
|
||||
square(&attrs(Some(2), None, false), 0, 0, 1000),
|
||||
]));
|
||||
children.push(table(b"rclr", &[color(7, &[1, 2, 3, 4]), color(3, &[255, 0, 0, 255])]));
|
||||
let d = read_cmx(&riff(&children), Limits::default()).unwrap();
|
||||
assert!(d.warnings.contains(&Warning::UnknownColors) && d.warnings.contains(&Warning::Damaged), "{:?}", d.warnings);
|
||||
let objects = &d.pages[0].layers[0].objects;
|
||||
assert_eq!(shape(&objects[0]).fill, Some(Color::Cmyk([1.0, 0.0, 0.0, 1.0])));
|
||||
assert_eq!(shape(&objects[1]).fill, Some(Color::Rgb([0.0; 3])));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn outline_arrowheads_are_reported() {
|
||||
let mut children = vec![cont(b'4', 1e-7)];
|
||||
children.push(page(&[begin_page(None), begin_layer("L", None), square(&attrs(None, Some(1), false), 0, 0, 1000)]));
|
||||
children.extend(tables().into_iter().filter(|t| !t.starts_with(b"rota")));
|
||||
children.push(arrowheads(&[(0, 2)]));
|
||||
let d = read_cmx(&riff(&children), Limits::default()).unwrap();
|
||||
assert_eq!(d.warnings, vec![Warning::Arrowheads]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_long_instruction_and_a_jump_over_image_bytes() {
|
||||
// The jump's target counts from the start of the file: header, `cont`, then the page body.
|
||||
let before = riff(&[cont(b'4', 1e-7), page(&[])]).len() - 8;
|
||||
let head = [begin_page(None), begin_layer("L", None)].concat();
|
||||
let jump_len = 4 + 1 + 3 + 4;
|
||||
let image = vec![0xEEu8; 37];
|
||||
let target = (before + 8 + head.len() + jump_len + image.len()) as u32;
|
||||
let jump = instr(111, &fields(&[field(1, &target.to_le_bytes())]));
|
||||
assert_eq!(jump.len(), jump_len);
|
||||
let body = [
|
||||
head,
|
||||
jump,
|
||||
image,
|
||||
long_instr(67, &curve(&attrs(Some(1), None, false), &[(0, 0), (10, 0), (10, 10)], &[0x0c, 0x44, 0x48])[4..]),
|
||||
end_layer(),
|
||||
]
|
||||
.concat();
|
||||
let mut children = vec![cont(b'4', 1e-7), chunk(b"page", &body)];
|
||||
children.extend(tables());
|
||||
let d = read_cmx(&riff(&children), Limits::default()).unwrap();
|
||||
// The images jumped over are not read, and the warning says so.
|
||||
assert_eq!(d.warnings, [Warning::UnsupportedObjects]);
|
||||
assert_eq!(d.pages[0].layers[0].objects.len(), 1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn bytes_after_a_chunk_that_runs_short_are_passed_over() {
|
||||
let stray = vec![0x10, 0x00, 0x16, 0x00, 0x01, 0x0b, 0x00, 0x01, 0, 0, 0, 0, 0, 0, 0, 0xff];
|
||||
let mut children = vec![cont(b'4', 1e-7), stray, list(b"pgls", &[page(&[begin_page(None), square(&attrs(Some(1), None, false), 0, 0, 1000)])])];
|
||||
children.extend(tables());
|
||||
let d = read_cmx(&riff(&children), Limits::default()).unwrap();
|
||||
assert!(d.warnings.is_empty(), "{:?}", d.warnings);
|
||||
assert_eq!(d.pages[0].layers[0].objects.len(), 1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn other_byte_orders_and_coordinate_sizes_are_refused() {
|
||||
let mut f = sample();
|
||||
f[..4].copy_from_slice(b"RIFX");
|
||||
assert_eq!(read_cmx(&f, Limits::default()), Err(Error::Unsupported("big-endian CMX files")));
|
||||
let mut children = vec![cont(b'2', 1e-3)];
|
||||
children.extend(tables());
|
||||
assert_eq!(read_cmx(&riff(&children), Limits::default()), Err(Error::Unsupported("CMX files with 16-bit coordinates")));
|
||||
assert_eq!(read_cmx(&riff(&tables()), Limits::default()), Err(Error::Damaged("CMX header")));
|
||||
assert_eq!(read_cmx(&riff(&[cont(b'9', 1e-7)]), Limits::default()), Err(Error::Damaged("CMX header")));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_header_without_a_usable_unit_reads_0_1_micrometers() {
|
||||
for meters in [0.0, -1.0, f64::NAN, 2.0] {
|
||||
let mut children = vec![cont(b'4', meters), page(&[begin_page(Some((2_100_000, 2_970_000)))])];
|
||||
children.extend(tables());
|
||||
let d = read_cmx(&riff(&children), Limits::default()).unwrap();
|
||||
let (w, _) = d.pages[0].size.unwrap();
|
||||
assert!(near(w, 210.0 / 25.4 * 72.0), "{meters}: {w}");
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn groups_past_the_depth_limit_are_left_out() {
|
||||
let mut ins = vec![begin_page(None), begin_layer("L", None)];
|
||||
for _ in 0..6 {
|
||||
ins.push(begin_group());
|
||||
}
|
||||
ins.push(square(&attrs(Some(1), None, false), 0, 0, 1000));
|
||||
for _ in 0..6 {
|
||||
ins.push(end_group());
|
||||
}
|
||||
ins.push(square(&attrs(Some(1), None, false), 0, 0, 1000));
|
||||
let d = read_cmx(&file(&[page(&ins)]), Limits { depth: 3, ..Limits::default() }).unwrap();
|
||||
assert!(d.warnings.contains(&Warning::TooDeep));
|
||||
// The square after the groups is still read, beside the three groups kept.
|
||||
let objects = &d.pages[0].layers[0].objects;
|
||||
assert_eq!(objects.len(), 2);
|
||||
let mut depth = 0;
|
||||
let mut o = &objects[1];
|
||||
while let Object::Group { objects: kids, .. } = o {
|
||||
depth += 1;
|
||||
match kids.first() {
|
||||
Some(k) => o = k,
|
||||
None => break,
|
||||
}
|
||||
}
|
||||
assert_eq!(depth, 3);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn counts_past_the_limits_are_bounded() {
|
||||
let ins: Vec<Vec<u8>> = std::iter::once(begin_page(None)).chain((0..50).map(|_| square(&attrs(Some(1), None, false), 0, 0, 1000))).collect();
|
||||
let f = file(&[page(&ins)]);
|
||||
let d = read_cmx(&f, Limits { objects: 10, ..Limits::default() }).unwrap();
|
||||
assert_eq!(d.pages[0].layers[0].objects.len(), 10);
|
||||
assert!(d.warnings.contains(&Warning::TooDeep));
|
||||
let d = read_cmx(&f, Limits { coordinates: 12, ..Limits::default() }).unwrap();
|
||||
assert_eq!(d.pages[0].layers[0].objects.len(), 2);
|
||||
assert_eq!(read_cmx(&f, Limits { chunks: 20, ..Limits::default() }), Err(Error::Limit("chunk count")));
|
||||
assert_eq!(read_cmx(&f, Limits { input: 10, ..Limits::default() }), Err(Error::Limit("input size")));
|
||||
let dashed = |n: u16| {
|
||||
let mut children = vec![cont(b'4', 1e-7)];
|
||||
children.push(page(&[begin_page(None), square(&attrs(None, Some(3), false), 0, 0, 1000), square(&attrs(None, Some(3), false), 0, 0, 1000)]));
|
||||
children.extend(tables());
|
||||
read_cmx(&riff(&children), Limits { dashes: usize::from(n), ..Limits::default() }).unwrap()
|
||||
};
|
||||
let d = dashed(3);
|
||||
let o: Vec<usize> = d.pages[0].layers[0].objects.iter().map(|o| shape(o).outline.as_ref().unwrap().dashes.len()).collect();
|
||||
assert_eq!(o, [0, 2]);
|
||||
assert!(d.warnings.contains(&Warning::TooDeep));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_curve_cut_short_keeps_the_points_it_holds() {
|
||||
let mut c = curve(&attrs(Some(1), None, false), &[(0, 0), (10, 0), (10, 10)], &[0x0c, 0x44, 0x48]);
|
||||
// Claim 9 points where 3 are stored: the field's own length still covers only 3.
|
||||
let at = c.windows(2).position(|w| w == [3, 0]).unwrap();
|
||||
c[at] = 9;
|
||||
let p = page(&[begin_page(None), c]);
|
||||
let d = read_cmx(&file(&[p]), Limits::default()).unwrap();
|
||||
assert!(d.warnings.contains(&Warning::Damaged));
|
||||
assert_eq!(d.pages[0].layers[0].objects.len(), 1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_curve_that_lost_type_bytes_keeps_its_first_points() {
|
||||
// Three whole points and only two of their type bytes.
|
||||
let mut g = 3u16.to_le_bytes().to_vec();
|
||||
for (x, y) in [(0i32, 0i32), (1_000_000, 0), (1_000_000, 1_000_000)] {
|
||||
g.extend(x.to_le_bytes());
|
||||
g.extend(y.to_le_bytes());
|
||||
}
|
||||
g.extend([0x0c, 0x44]);
|
||||
let c = instr(67, &fields(&[field(1, &attrs(None, Some(1), false)), field(2, &g)]));
|
||||
let d = read_cmx(&file(&[page(&[begin_page(None), c])]), Limits::default()).unwrap();
|
||||
assert!(d.warnings.contains(&Warning::Damaged), "{:?}", d.warnings);
|
||||
let Geometry::Path(p) = &shape(&d.pages[0].layers[0].objects[0]).geometry else { panic!() };
|
||||
let side = 100.0 / 25.4 * 72.0;
|
||||
assert!(near(p.subpaths[0].start.x, 0.0) && near(p.subpaths[0].start.y, 0.0));
|
||||
match p.subpaths[0].segments[..] {
|
||||
[vectorcraft_cdr::model::Segment::Line(e)] => assert!(near(e.x, side) && near(e.y, 0.0), "{e:?}"),
|
||||
ref other => panic!("{other:?}"),
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_file_cut_short_of_its_declared_size_is_reported() {
|
||||
let mut f = file(&[]);
|
||||
let declared = (f.len() as u32 - 8 + 100).to_le_bytes();
|
||||
f[4..8].copy_from_slice(&declared);
|
||||
let d = read_cmx(&f, Limits::default()).unwrap();
|
||||
assert!(d.warnings.contains(&Warning::Damaged), "{:?}", d.warnings);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_page_that_ends_inside_an_instruction_is_reported() {
|
||||
let p = page(&[begin_page(None), begin_layer("L", None), square(&attrs(Some(1), None, false), 0, 0, 1000), end_layer(), vec![1, 0]]);
|
||||
let d = read_cmx(&file(&[p]), Limits::default()).unwrap();
|
||||
assert!(d.warnings.contains(&Warning::Damaged), "{:?}", d.warnings);
|
||||
assert_eq!(d.pages[0].layers[0].objects.len(), 1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_chunk_64_bytes_past_stray_bytes_is_found() {
|
||||
let p = page(&[begin_page(None), begin_layer("L", None), square(&attrs(Some(1), None, false), 0, 0, 1000), end_layer()]);
|
||||
let mut children = vec![cont(b'4', 1e-7), [vec![1u8; 64], p].concat()];
|
||||
children.extend(tables());
|
||||
let d = read_cmx(&riff(&children), Limits::default()).unwrap();
|
||||
assert_eq!(d.pages.len(), 1);
|
||||
assert_eq!(d.pages[0].layers[0].objects.len(), 1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn stray_letters_with_a_length_past_the_file_are_passed_over() {
|
||||
let mut stray = b"abcd".to_vec();
|
||||
stray.extend(0xFFFF_FF00u32.to_le_bytes());
|
||||
let p = page(&[begin_page(None), begin_layer("L", None), square(&attrs(Some(1), None, false), 0, 0, 1000), end_layer()]);
|
||||
let mut children = vec![cont(b'4', 1e-7), [stray, p].concat()];
|
||||
children.extend(tables());
|
||||
let d = read_cmx(&riff(&children), Limits::default()).unwrap();
|
||||
assert_eq!(d.pages.len(), 1);
|
||||
assert_eq!(d.pages[0].layers[0].objects.len(), 1);
|
||||
}
|
||||
|
||||
proptest! {
|
||||
#![proptest_config(ProptestConfig { cases: 256, ..ProptestConfig::default() })]
|
||||
|
||||
#[test]
|
||||
fn never_panics_on_garbage(bytes in prop::collection::vec(any::<u8>(), 0..2048)) {
|
||||
let mut b = b"RIFF\0\0\0\0CMX1".to_vec();
|
||||
b.extend(bytes);
|
||||
let _ = read_cmx(&b, Limits::default());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn never_panics_on_mutated_samples(edits in prop::collection::vec((any::<usize>(), any::<u8>()), 1..24)) {
|
||||
let mut b = sample();
|
||||
let n = b.len();
|
||||
for (at, v) in edits {
|
||||
b[at % n] = v;
|
||||
}
|
||||
let _ = read_cmx(&b, Limits::default());
|
||||
}
|
||||
}
|
||||
@@ -3,5 +3,6 @@
|
||||
#![allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)]
|
||||
|
||||
mod bench;
|
||||
mod cmx;
|
||||
mod provenance;
|
||||
mod read;
|
||||
|
||||
@@ -17,7 +17,8 @@
|
||||
//! - `eps`: EPS export options (flattened transparency, previews, the embedded document), `document.exportEps`.
|
||||
//! - `dxfimport`: the DXF options `document.open` and Place read, `document.dxfInfo`.
|
||||
//! - `metafile`: EMF and WMF export, open and place; PICT open and place.
|
||||
//! - `cdr`: `.cdr` drawings of versions 1 to 27 and `.cdt` templates, open and place.
|
||||
//! - `cdr`: `.cdr` drawings of versions 1 to 27 and `.cdt` templates, and `.cmx` files with
|
||||
//! 32-bit coordinates, open and place.
|
||||
//! - `hpgl`: HP-GL export options and plots.
|
||||
//! - `importer`: files that importer plug-ins open (`document.open {importer}`, and extensions no
|
||||
//! built-in format reads).
|
||||
@@ -179,6 +180,8 @@ mod tests_artboard_fill;
|
||||
#[cfg(test)]
|
||||
mod tests_cdr;
|
||||
#[cfg(test)]
|
||||
mod tests_cmx;
|
||||
#[cfg(test)]
|
||||
mod tests_pdf;
|
||||
#[cfg(test)]
|
||||
mod tests_pdfcolor;
|
||||
|
||||
@@ -4,7 +4,8 @@
|
||||
//! `vectorcraft-cdr` reads, mapped to editable VectorCraft art. Pages become
|
||||
//! artboards side by side; layers of the same name on different pages become one layer where the
|
||||
//! pages stack them in the same order. What the
|
||||
//! reader leaves out is listed in the warnings, one line for each kind ([`note`]).
|
||||
//! reader leaves out is listed in the warnings, one line for each kind ([`note`]). `.cmx` exchange
|
||||
//! files with 32-bit coordinates are mapped the same way, with their own warnings ([`cmx_note`]).
|
||||
|
||||
use std::collections::HashMap;
|
||||
use std::sync::Arc;
|
||||
@@ -30,6 +31,15 @@ const TOO_DEEP: &str = "parts of the drawing nested too deeply, or past the impo
|
||||
const DAMAGED: &str = "damaged parts of the drawing were left out";
|
||||
const PAGES_CUT: &str = "CDR pages longer than 163,830 pt were opened at that length, and art near their edges lies outside the artboard";
|
||||
|
||||
const CMX_UNSUPPORTED_OBJECTS: &str =
|
||||
"CMX text, images, rectangles, ellipses, clipping paths and other objects VectorCraft doesn't read yet were left out";
|
||||
const CMX_UNSUPPORTED_FILLS: &str = "CMX fills other than uniform colors were left out";
|
||||
const CMX_UNKNOWN_COLORS: &str = "colors in CMX color models VectorCraft doesn't read were opened as black";
|
||||
const CMX_SPOT_LOOKS: &str = "CMX library colors that the file stores only by number were opened as black spot colors";
|
||||
const CMX_ARROWHEADS: &str = "CMX outline arrowheads were left out";
|
||||
const CMX_LENSES: &str = "CMX lenses were not applied";
|
||||
const CMX_PAGES_CUT: &str = "CMX pages longer than 163,830 pt were opened at that length, and art near their edges lies outside the artboard";
|
||||
|
||||
/// What reading a drawing left out or changed, for each kind the reader reports.
|
||||
fn note(w: Warning) -> &'static str {
|
||||
match w {
|
||||
@@ -45,6 +55,20 @@ fn note(w: Warning) -> &'static str {
|
||||
}
|
||||
}
|
||||
|
||||
/// What reading a `.cmx` file left out or changed. The reader reports no envelopes in one.
|
||||
fn cmx_note(w: Warning) -> &'static str {
|
||||
match w {
|
||||
Warning::UnsupportedObjects | Warning::Envelopes => CMX_UNSUPPORTED_OBJECTS,
|
||||
Warning::UnsupportedFills => CMX_UNSUPPORTED_FILLS,
|
||||
Warning::UnknownColors => CMX_UNKNOWN_COLORS,
|
||||
Warning::SpotLooks => CMX_SPOT_LOOKS,
|
||||
Warning::Arrowheads => CMX_ARROWHEADS,
|
||||
Warning::Lenses => CMX_LENSES,
|
||||
Warning::TooDeep => TOO_DEEP,
|
||||
Warning::Damaged => DAMAGED,
|
||||
}
|
||||
}
|
||||
|
||||
/// The page size used when neither the page nor the document settings give one: US Letter,
|
||||
/// VectorCraft's own choice.
|
||||
const FALLBACK_PAGE: (f64, f64) = (612.0, 792.0);
|
||||
@@ -79,8 +103,25 @@ pub(super) fn import(bytes: &[u8]) -> Result<(Document, Vec<String>)> {
|
||||
}
|
||||
why => err(format!("this CDR drawing can't be read ({why})")),
|
||||
})?;
|
||||
Ok(build(&d, note, PAGES_CUT))
|
||||
}
|
||||
|
||||
/// Is `bytes` a `.cmx` file, of any byte order or coordinate size?
|
||||
pub(super) fn is_cmx(bytes: &[u8]) -> bool {
|
||||
vectorcraft_cdr::is_cmx(bytes)
|
||||
}
|
||||
|
||||
/// A `.cmx` file with 32-bit coordinates: its pages, layers, groups and curves with uniform fills
|
||||
/// and outlines, mapped as a `.cdr` drawing's are.
|
||||
pub(super) fn import_cmx(bytes: &[u8]) -> Result<(Document, Vec<String>)> {
|
||||
let d = vectorcraft_cdr::read_cmx(bytes, Limits::default()).map_err(|why| err(format!("this CMX file can't be read ({why})")))?;
|
||||
Ok(build(&d, cmx_note, CMX_PAGES_CUT))
|
||||
}
|
||||
|
||||
/// The document of `d`, and one warning for each kind of content left out or changed.
|
||||
fn build(d: &cd::Drawing, note: fn(Warning) -> &'static str, pages_cut: &str) -> (Document, Vec<String>) {
|
||||
let mut b = shapes::Builder::new();
|
||||
let mut doc = b.document(&d);
|
||||
let mut doc = b.document(d);
|
||||
let mut warnings: Vec<String> = Vec::new();
|
||||
for w in d.warnings.iter().chain(&b.notes) {
|
||||
if !warnings.iter().any(|x| x == note(*w)) {
|
||||
@@ -88,10 +129,10 @@ pub(super) fn import(bytes: &[u8]) -> Result<(Document, Vec<String>)> {
|
||||
}
|
||||
}
|
||||
if b.pages_cut {
|
||||
warnings.push(PAGES_CUT.to_string());
|
||||
warnings.push(pages_cut.to_string());
|
||||
}
|
||||
doc.limit_depth_noting(&mut warnings);
|
||||
Ok((doc, warnings))
|
||||
(doc, warnings)
|
||||
}
|
||||
|
||||
/// Where each page lies in the document: its artboard, and the map from its own space (points
|
||||
|
||||
@@ -537,6 +537,9 @@ pub const FORMATS: &[Format] = &[
|
||||
// them.
|
||||
reader("cdr", "CDR Drawing", &["cdr"], "application/vnd.corel-draw", false), // brand-ok: shared MIME type
|
||||
reader("cdt", "CDR Template", &["cdt"], "application/vnd.corel-draw", false), // brand-ok: shared MIME type
|
||||
// `.cmx` exchange files with 32-bit coordinates, read by `vectorcraft-cdr`; exports don't write
|
||||
// them.
|
||||
reader("cmx", "CMX", &["cmx"], "image/x-cmx", false),
|
||||
// QuickDraw pictures, read by `vectorcraft_metafile::import_pict` into paths, type and images.
|
||||
reader("pict", "PICT", &["pct", "pic", "pict"], "image/x-pict", false),
|
||||
];
|
||||
@@ -598,17 +601,18 @@ pub const OPEN_EXTS: &[&str] = &[
|
||||
"afpub",
|
||||
"cdr",
|
||||
"cdt",
|
||||
"cmx",
|
||||
];
|
||||
|
||||
/// Extensions in [`OPEN_EXTS`] the packaging declares no type for: Photoshop documents belong to
|
||||
/// raster editors, so Finder and file managers don't offer a vector app for them, and there is no
|
||||
/// `.epsf`, `.ps`, Targa, PCX, Pixar, JPEG 2000, HEIC/HEIF, JPEG XL or `.cdr` type, nor one for the `.pns`, `.dib` and `.rle` names of
|
||||
/// `.epsf`, `.ps`, Targa, PCX, Pixar, JPEG 2000, HEIC/HEIF, JPEG XL, `.cdr` or `.cmx` type, nor one for the `.pns`, `.dib` and `.rle` names of
|
||||
/// PNG and BMP files (File › Open and Place still read them all). On Linux the desktop entry's EPS
|
||||
/// type (shared-mime-info's) also covers `.epsf`, so file managers offer VectorCraft for it.
|
||||
/// The packaging declares no type for HP-GL plot files or PICT pictures either.
|
||||
pub const UNASSOCIATED_EXTS: &[&str] = &[
|
||||
"psd", "pdd", "psb", "epsf", "ps", "pns", "dib", "rle", "tga", "vda", "icb", "vst", "pcx", "pxr", "jpf", "jpx", "jp2", "j2k", "j2c", "jpc",
|
||||
"heic", "heif", "jxl", "cdr", "cdt", "plt", "hpgl", "hgl", "hpg", "pct", "pic", "pict",
|
||||
"heic", "heif", "jxl", "cdr", "cdt", "cmx", "plt", "hpgl", "hgl", "hpg", "pct", "pic", "pict",
|
||||
];
|
||||
|
||||
/// The extension that picks each writable format when exporting (the format's first; PNG-8 shares
|
||||
@@ -697,6 +701,7 @@ pub const PLACE_EXTS: &[&str] = &[
|
||||
"afpub",
|
||||
"cdr",
|
||||
"cdt",
|
||||
"cmx",
|
||||
"txt",
|
||||
"rtf",
|
||||
"docx",
|
||||
|
||||
@@ -96,6 +96,9 @@ pub fn detect(name: &str, bytes: &[u8]) -> Option<&'static Format> {
|
||||
// A template keeps its meaning from the extension.
|
||||
return by_name.filter(|f| f.id == "cdt").or_else(|| format("cdr"));
|
||||
}
|
||||
if super::cdr::is_cmx(bytes) {
|
||||
return format("cmx");
|
||||
}
|
||||
if vectorcraft_format::sniff(bytes) {
|
||||
// A template keeps its meaning from the extension, like .ait.
|
||||
return by_name.filter(|f| f.id == "template").or_else(|| format("vectorcraft"));
|
||||
@@ -549,6 +552,10 @@ pub fn load_with(name: &str, bytes: &[u8], opts: &LoadOptions) -> Result<Loaded>
|
||||
let (doc, warnings) = super::cdr::import(bytes)?;
|
||||
(doc, warnings, false)
|
||||
}
|
||||
"cmx" => {
|
||||
let (doc, warnings) = super::cdr::import_cmx(bytes)?;
|
||||
(doc, warnings, false)
|
||||
}
|
||||
// A PSD or PSB file's layers become layers (`layers`, default on); without layers, or with
|
||||
// `layers: false`, its merged image opens. Layers that can't be read leave the merged image.
|
||||
"psd" | "psb" if opts.layers => match super::psdlayers::import_active(bytes, opts.hidden_layers) {
|
||||
@@ -800,12 +807,12 @@ fn open_loaded(
|
||||
loaded.with_grid_prefs(&s.prefs).with_unit_prefs(&s.prefs);
|
||||
// EPS now has an ordinary Save path. Its preview, partial-program and damaged-editing
|
||||
// fallbacks must ask before overwriting the richer source they could not fully read. Every
|
||||
// warning of a `.cdr` drawing names content the import left out or changed.
|
||||
// warning of a `.cdr` drawing or a `.cmx` file names content the import left out or changed.
|
||||
let losses: Vec<String> = warnings
|
||||
.iter()
|
||||
.filter(|w| {
|
||||
is_loss(w)
|
||||
|| matches!(format.id, "cdr" | "cdt")
|
||||
|| matches!(format.id, "cdr" | "cdt" | "cmx")
|
||||
|| (format.id == "eps"
|
||||
&& (matches!(w.as_str(), EDITING_DAMAGED | EDITING_STALE)
|
||||
|| w.starts_with("this file's PostScript couldn't be read")
|
||||
|
||||
@@ -0,0 +1,124 @@
|
||||
//! `.cmx` files: Open and Place, by extension and by content, mapped to artboards, layers, groups,
|
||||
//! paths, solid paint and strokes, with their warnings and refusals.
|
||||
|
||||
use super::*;
|
||||
use serde_json::json;
|
||||
use vectorcraft_cdr::synth_cmx::*;
|
||||
use vectorcraft_doc::{Node, NodeKind};
|
||||
|
||||
fn paths(nodes: &[std::sync::Arc<Node>], out: &mut Vec<Node>) {
|
||||
for n in nodes {
|
||||
match &n.kind {
|
||||
NodeKind::Layer { children, .. } | NodeKind::Group { children, .. } => paths(children, out),
|
||||
_ => out.push((**n).clone()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn warnings(r: &serde_json::Value) -> Vec<String> {
|
||||
r["warnings"].as_array().map(|w| w.iter().filter_map(|w| w.as_str().map(str::to_string)).collect()).unwrap_or_default()
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_cmx_file_opens_as_editable_art() {
|
||||
let mut s = Session::new();
|
||||
let r = open_bytes(&mut s, "drawing.cmx", &sample(), None).unwrap();
|
||||
assert_eq!(r["format"], "cmx");
|
||||
assert!(warnings(&r).is_empty(), "{r}");
|
||||
let doc = &s.doc().unwrap().doc;
|
||||
// One 210 x 297 mm page.
|
||||
assert_eq!(doc.artboards.len(), 1);
|
||||
let ab = doc.artboards[0].rect;
|
||||
assert_eq!((ab.width().round(), ab.height().round()), (595.0, 842.0));
|
||||
// Bottom to top: the layer drawn first is at the bottom.
|
||||
let names: Vec<String> = doc.layers.iter().map(|l| l.name.clone().unwrap_or_default()).collect();
|
||||
assert_eq!(names, ["Art", "Top"]);
|
||||
let art = doc.layers[0].children().unwrap();
|
||||
assert_eq!(art.len(), 2);
|
||||
assert!(matches!(art[1].kind, NodeKind::Group { .. }), "the group drawn after the red square is above it");
|
||||
let mut all = Vec::new();
|
||||
paths(&doc.layers, &mut all);
|
||||
assert_eq!(all.len(), 4);
|
||||
// The red square: 100 mm on a side, centered on the page, with a fill and a stroke.
|
||||
let red = &all[0];
|
||||
let b = doc.bounds_of(&[red.id], false).unwrap();
|
||||
let mm = 72.0 / 25.4;
|
||||
assert!((b.width() - 100.0 * mm).abs() < 0.01 && (b.center().x - ab.center().x).abs() < 0.01, "{b:?}");
|
||||
assert_eq!(red.appearance.items.len(), 2);
|
||||
// The square whose line type draws no outline has a fill only.
|
||||
assert_eq!(all[1].appearance.items.len(), 1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn detection_by_content_and_place() {
|
||||
let bytes = sample();
|
||||
let mut s = Session::new();
|
||||
// A renamed file is found by its content, and a .cmx extension alone reads it as one.
|
||||
assert_eq!(open_bytes(&mut s, "renamed.bin", &bytes, None).unwrap()["format"], "cmx");
|
||||
assert_eq!(detect("drawing.png", &bytes).map(|f| f.id), Some("cmx"));
|
||||
assert_eq!(detect("drawing.cmx", b"").map(|f| f.id), Some("cmx"));
|
||||
s.execute("file.new", &json!({"width":100,"height":100})).unwrap();
|
||||
s.execute("file.place", &json!({"name":"art.cmx", "dataBase64":vectorcraft_format::base64_encode(&bytes)})).unwrap();
|
||||
assert!(s.doc().unwrap().doc.layers.iter().any(|l| !l.children().unwrap().is_empty()));
|
||||
let f = format("cmx").unwrap();
|
||||
assert!(f.read && !f.write);
|
||||
assert!(OPEN_EXTS.contains(&"cmx") && PLACE_EXTS.contains(&"cmx") && UNASSOCIATED_EXTS.contains(&"cmx"));
|
||||
assert!(!SAVE_FORMATS.contains(&"cmx"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn what_is_left_out_is_named_in_the_warnings() {
|
||||
let mut children = vec![cont(b'4', 1e-7)];
|
||||
children.push(page(&[
|
||||
begin_page(None),
|
||||
begin_layer("L", None),
|
||||
instr(66, &fields(&[field(1, &[0; 8])])),
|
||||
square(&attrs_fill_type(2), 0, 0, 1000),
|
||||
square(&attrs(Some(1), Some(1), true), 0, 0, 1000),
|
||||
]));
|
||||
children.extend(tables().into_iter().filter(|t| !t.starts_with(b"rota")));
|
||||
children.push(arrowheads(&[(1, 0)]));
|
||||
let mut s = Session::new();
|
||||
let w = warnings(&open_bytes(&mut s, "drawing.cmx", &riff(&children), None).unwrap());
|
||||
assert_eq!(
|
||||
w,
|
||||
[
|
||||
"CMX text, images, rectangles, ellipses, clipping paths and other objects VectorCraft doesn't read yet were left out",
|
||||
"CMX fills other than uniform colors were left out",
|
||||
"CMX outline arrowheads were left out",
|
||||
"CMX lenses were not applied",
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_file_the_open_left_things_out_of_is_not_written_over_unasked() {
|
||||
let d = std::env::temp_dir().join(format!("vc-cmx-loss-{}", std::process::id()));
|
||||
std::fs::create_dir_all(&d).unwrap();
|
||||
let src = d.join("drawing.cmx");
|
||||
let mut children = vec![cont(b'4', 1e-7), page(&[begin_page(None), square(&attrs_fill_type(2), 0, 0, 1000)])];
|
||||
children.extend(tables());
|
||||
let original = riff(&children);
|
||||
std::fs::write(&src, &original).unwrap();
|
||||
let mut s = Session::new();
|
||||
s.execute("document.open", &json!({ "path": src.to_string_lossy() })).unwrap();
|
||||
let e = s.execute("document.export", &json!({ "path": src.to_string_lossy(), "format": "svg" })).unwrap_err().to_string();
|
||||
assert!(e.contains("acknowledgeLoss"), "{e}");
|
||||
assert_eq!(std::fs::read(&src).unwrap(), original);
|
||||
std::fs::remove_dir_all(d).ok();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn files_that_are_not_read_say_why() {
|
||||
let mut s = Session::new();
|
||||
let mut rifx = sample();
|
||||
rifx[..4].copy_from_slice(b"RIFX");
|
||||
let e = open_bytes(&mut s, "a.cmx", &rifx, None).unwrap_err().to_string();
|
||||
assert!(e.contains("this CMX file can't be read (big-endian CMX files are not read)"), "{e}");
|
||||
let e = open_bytes(&mut s, "b.cmx", &riff(&[cont(b'2', 1e-3)]), None).unwrap_err().to_string();
|
||||
assert!(e.contains("this CMX file can't be read (CMX files with 16-bit coordinates are not read)"), "{e}");
|
||||
let e = open_bytes(&mut s, "c.cmx", &riff(&[]), None).unwrap_err().to_string();
|
||||
assert!(e.contains("this CMX file can't be read (damaged CMX header)"), "{e}");
|
||||
let e = open_bytes(&mut s, "d.cmx", b"not a cmx file", None).unwrap_err().to_string();
|
||||
assert!(e.contains("this CMX file can't be read (not a CMX file)"), "{e}");
|
||||
}
|
||||
@@ -9,6 +9,7 @@
|
||||
//! Illustrator EPS and `.ai` files (the layers they carry, damaged or hostile), nor Affinity documents
|
||||
//! (mutated object streams, archives and indexed PNG previews, hostile image dimensions), nor
|
||||
//! `.cdr` drawings (mutated and cut short, plain, compressed and packaged, opened and placed),
|
||||
//! nor `.cmx` files (mutated, cut short and garbage after the header, opened and placed),
|
||||
//! nor the font files a folder search reads (damaged fonts, collections whose headers give any count of
|
||||
//! faces), nor scripts written for the reference app checked without running them (garbage,
|
||||
//! generated script text and mutated scripts).
|
||||
@@ -433,6 +434,52 @@ proptest! {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------- .cmx files ----------
|
||||
|
||||
proptest! {
|
||||
#![proptest_config(config())]
|
||||
|
||||
#[test]
|
||||
fn cmx_mutated_files_render_and_export(
|
||||
cut in prop::option::of(12usize..4096),
|
||||
edits in prop::collection::vec((0usize..8192, any::<u8>()), 0..24),
|
||||
) {
|
||||
let mut bytes = vectorcraft_cdr::synth_cmx::sample();
|
||||
let n = bytes.len();
|
||||
for (at, b) in edits { bytes[at % n] = b; }
|
||||
if let Some(cut) = cut {
|
||||
bytes.truncate(cut);
|
||||
}
|
||||
survive("CMX file", || vectorcraft_engine::cmd::fileio::load("x.cmx", &bytes).ok().map(|l| l.doc))?;
|
||||
let r = catch_quiet(|| {
|
||||
let mut s = vectorcraft_engine::Session::new();
|
||||
s.execute("file.new", &json!({"width":100,"height":100})).unwrap();
|
||||
let p = json!({"name":"x.cmx", "dataBase64":vectorcraft_format::base64_encode(&bytes)});
|
||||
let _ = no_panic(s.execute("file.place", &p));
|
||||
});
|
||||
prop_assert!(r.is_ok(), "CMX placement panicked: {:?}", r.err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn cmx_garbage_opens_and_places_without_panicking(tail in prop::collection::vec(any::<u8>(), 0..2048)) {
|
||||
// A 32-bit header, so the garbage is walked as chunks, tables and instructions.
|
||||
let mut bytes = b"RIFF".to_vec();
|
||||
let cont = vectorcraft_cdr::synth_cmx::cont(b'4', 1e-7);
|
||||
bytes.extend(((4 + cont.len() + tail.len()) as u32).to_le_bytes());
|
||||
bytes.extend(b"CMX1");
|
||||
bytes.extend(cont);
|
||||
bytes.extend(tail);
|
||||
survive("CMX garbage", || vectorcraft_engine::cmd::fileio::load("x.cmx", &bytes).ok().map(|l| l.doc))?;
|
||||
let r = catch_quiet(|| {
|
||||
let mut s = vectorcraft_engine::Session::new();
|
||||
s.execute("file.new", &json!({"width":100,"height":100})).unwrap();
|
||||
let p = json!({"name":"x.cmx", "dataBase64":vectorcraft_format::base64_encode(&bytes)});
|
||||
let _ = no_panic(s.execute("file.place", &p));
|
||||
});
|
||||
prop_assert!(r.is_ok(), "CMX placement panicked: {:?}", r.err());
|
||||
}
|
||||
}
|
||||
|
||||
// ---------- Affinity documents with every feature the reader maps ----------
|
||||
|
||||
#[path = "support/affinity_docs.rs"]
|
||||
|
||||
@@ -8078,6 +8078,14 @@ breakText Glyphs Glifs
|
||||
@msg parts of the drawing nested too deeply, or past the import limits, were left out s’han omès les parts del dibuix imbricades massa a fons o fora dels límits d’importació
|
||||
@msg damaged parts of the drawing were left out s’han omès les parts danyades del dibuix
|
||||
@msg CDR pages longer than 163,830 pt were opened at that length, and art near their edges lies outside the artboard les pàgines del CDR de més de 163.830 pt s’han obert amb aquesta longitud, i el dibuix a prop de les vores queda fora del tauler
|
||||
@msg this CMX file can't be read ({why}) no es pot llegir aquest fitxer CMX ({why})
|
||||
@msg CMX text, images, rectangles, ellipses, clipping paths and other objects VectorCraft doesn't read yet were left out s’han omès els textos, les imatges, els rectangles, les el·lipses, els camins de retall i altres objectes del CMX que el VectorCraft encara no llegeix
|
||||
@msg CMX fills other than uniform colors were left out s’han omès els emplenaments del CMX que no són colors uniformes
|
||||
@msg colors in CMX color models VectorCraft doesn't read were opened as black els colors en models de color del CMX que el VectorCraft no llegeix s’han obert en negre
|
||||
@msg CMX library colors that the file stores only by number were opened as black spot colors els colors de biblioteca del CMX que el fitxer desa només pel número s’han obert com a colors directes negres
|
||||
@msg CMX outline arrowheads were left out s’han omès les puntes de fletxa dels contorns del CMX
|
||||
@msg CMX lenses were not applied no s’han aplicat les lents del CMX
|
||||
@msg CMX pages longer than 163,830 pt were opened at that length, and art near their edges lies outside the artboard les pàgines del CMX de més de 163.830 pt s’han obert amb aquesta longitud, i el dibuix a prop de les vores queda fora del tauler
|
||||
@msg You must choose a side pattern. Heu de triar un patró lateral.
|
||||
@msg invalid pattern tile choice opció de mosaic de patró no vàlida
|
||||
@msg no pattern named `{choice}` no hi ha cap patró anomenat `{choice}`
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -6108,6 +6108,14 @@ variable-list-end {0}, {1} {0} a {1}
|
||||
@msg parts of the drawing nested too deeply, or past the import limits, were left out části výkresu vnořené příliš hluboko nebo za hranicemi importu byly vynechány
|
||||
@msg damaged parts of the drawing were left out poškozené části výkresu byly vynechány
|
||||
@msg CDR pages longer than 163,830 pt were opened at that length, and art near their edges lies outside the artboard stránky CDR delší než 163 830 pt byly otevřeny v této délce a kresba u jejich okrajů leží mimo pracovní plochu
|
||||
@msg this CMX file can't be read ({why}) tento soubor CMX nelze přečíst ({why})
|
||||
@msg CMX text, images, rectangles, ellipses, clipping paths and other objects VectorCraft doesn't read yet were left out texty, obrázky, obdélníky, elipsy, ořezové cesty a další objekty CMX, které VectorCraft zatím nečte, byly vynechány
|
||||
@msg CMX fills other than uniform colors were left out výplně CMX jiné než jednolité barvy byly vynechány
|
||||
@msg colors in CMX color models VectorCraft doesn't read were opened as black barvy v barevných modelech CMX, které VectorCraft nečte, byly otevřeny jako černé
|
||||
@msg CMX library colors that the file stores only by number were opened as black spot colors knihovní barvy CMX, které soubor ukládá jen číslem, byly otevřeny jako černé přímé barvy
|
||||
@msg CMX outline arrowheads were left out šipky na obrysových čarách CMX byly vynechány
|
||||
@msg CMX lenses were not applied čočky CMX nebyly použity
|
||||
@msg CMX pages longer than 163,830 pt were opened at that length, and art near their edges lies outside the artboard stránky CMX delší než 163 830 pt byly otevřeny v této délce a kresba u jejich okrajů leží mimo pracovní plochu
|
||||
@msg the PSD image is too large to read ({_1} × {_2} pixels) obraz PSD je příliš velký na přečtení ({_1} × {_2} obrazových bodů)
|
||||
@msg zipped 1-bit PSD image data with prediction can't be read zazipovaná 1bitová obrazová data PSD s predikcí nelze přečíst
|
||||
@msg the PSD file's layer data uses an unknown compression ({m}) data vrstev souboru PSD používají neznámou kompresi ({m})
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -379,6 +379,14 @@ liquify-list-end {0}, {1} {0} og {1}
|
||||
@msg parts of the drawing nested too deeply, or past the import limits, were left out dele af tegningen, der er indlejret for dybt eller ligger ud over importgrænserne, blev udeladt
|
||||
@msg damaged parts of the drawing were left out beskadigede dele af tegningen blev udeladt
|
||||
@msg CDR pages longer than 163,830 pt were opened at that length, and art near their edges lies outside the artboard CDR-sider, der er længere end 163.830 pt, blev åbnet i den længde, og grafik nær deres kanter ligger uden for tegnefladen
|
||||
@msg this CMX file can't be read ({why}) denne CMX-fil kan ikke læses ({why})
|
||||
@msg CMX text, images, rectangles, ellipses, clipping paths and other objects VectorCraft doesn't read yet were left out tekst, billeder, rektangler, ellipser, beskæringsstier og andre CMX-objekter, som VectorCraft endnu ikke læser, blev udeladt
|
||||
@msg CMX fills other than uniform colors were left out CMX-udfyldninger, der ikke er ensfarvede, blev udeladt
|
||||
@msg colors in CMX color models VectorCraft doesn't read were opened as black farver i CMX-farvemodeller, som VectorCraft ikke læser, blev åbnet som sorte
|
||||
@msg CMX library colors that the file stores only by number were opened as black spot colors CMX-biblioteksfarver, som filen kun gemmer som et nummer, blev åbnet som sorte spotfarver
|
||||
@msg CMX outline arrowheads were left out pilespidser på CMX-konturer blev udeladt
|
||||
@msg CMX lenses were not applied CMX-linser blev ikke anvendt
|
||||
@msg CMX pages longer than 163,830 pt were opened at that length, and art near their edges lies outside the artboard CMX-sider, der er længere end 163.830 pt, blev åbnet i den længde, og grafik nær deres kanter ligger uden for tegnefladen
|
||||
@msg the JPEG XL file is cut short JPEG XL-filen er afkortet
|
||||
@msg the JPEG XL container is too large to read JPEG XL-containeren er for stor til at blive læst
|
||||
@msg CMYK JPEG XL images can't be read CMYK-billeder i JPEG XL kan ikke læses
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -5850,6 +5850,14 @@ variable-list-end {0}, {1} {0} und {1}
|
||||
@msg parts of the drawing nested too deeply, or past the import limits, were left out Teile der Zeichnung, die zu tief verschachtelt sind oder die Importgrenzen überschreiten, wurden ausgelassen
|
||||
@msg damaged parts of the drawing were left out beschädigte Teile der Zeichnung wurden ausgelassen
|
||||
@msg CDR pages longer than 163,830 pt were opened at that length, and art near their edges lies outside the artboard CDR-Seiten, die länger als 163.830 pt sind, wurden in dieser Länge geöffnet, und Grafik nahe ihren Rändern liegt außerhalb der Zeichenfläche
|
||||
@msg this CMX file can't be read ({why}) diese CMX-Datei kann nicht gelesen werden ({why})
|
||||
@msg CMX text, images, rectangles, ellipses, clipping paths and other objects VectorCraft doesn't read yet were left out Texte, Bilder, Rechtecke, Ellipsen, Beschneidungspfade und andere CMX-Objekte, die VectorCraft noch nicht liest, wurden ausgelassen
|
||||
@msg CMX fills other than uniform colors were left out CMX-Füllungen außer einheitlichen Farben wurden ausgelassen
|
||||
@msg colors in CMX color models VectorCraft doesn't read were opened as black Farben in CMX-Farbmodellen, die VectorCraft nicht liest, wurden als Schwarz geöffnet
|
||||
@msg CMX library colors that the file stores only by number were opened as black spot colors CMX-Bibliotheksfarben, die die Datei nur als Nummer speichert, wurden als schwarze Volltonfarben geöffnet
|
||||
@msg CMX outline arrowheads were left out Pfeilspitzen an CMX-Umrisslinien wurden ausgelassen
|
||||
@msg CMX lenses were not applied CMX-Linsen wurden nicht angewendet
|
||||
@msg CMX pages longer than 163,830 pt were opened at that length, and art near their edges lies outside the artboard CMX-Seiten, die länger als 163.830 pt sind, wurden in dieser Länge geöffnet, und Grafik nahe ihren Rändern liegt außerhalb der Zeichenfläche
|
||||
@msg the PSD image is too large to read ({_1} × {_2} pixels) das PSD-Bild ist zu groß zum Lesen ({_1} × {_2} Pixel)
|
||||
@msg zipped 1-bit PSD image data with prediction can't be read ZIP-komprimierte 1-Bit-PSD-Bilddaten mit Vorhersage können nicht gelesen werden
|
||||
@msg the PSD file's layer data uses an unknown compression ({m}) die Ebenendaten der PSD-Datei verwenden eine unbekannte Komprimierung ({m})
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -5802,6 +5802,14 @@ variable-list-end {0}, {1} {0} και {1}
|
||||
@msg parts of the drawing nested too deeply, or past the import limits, were left out παραλείφθηκαν τμήματα του σχεδίου με υπερβολικά βαθιά ένθεση ή πέρα από τα όρια εισαγωγής
|
||||
@msg damaged parts of the drawing were left out παραλείφθηκαν κατεστραμμένα τμήματα του σχεδίου
|
||||
@msg CDR pages longer than 163,830 pt were opened at that length, and art near their edges lies outside the artboard οι σελίδες του CDR με μήκος πάνω από 163.830 pt ανοίχτηκαν σε αυτό το μήκος και το γραφικό κοντά στα άκρα τους βρίσκεται έξω από τον πίνακα σχεδίασης
|
||||
@msg this CMX file can't be read ({why}) δεν είναι δυνατή η ανάγνωση αυτού του αρχείου CMX ({why})
|
||||
@msg CMX text, images, rectangles, ellipses, clipping paths and other objects VectorCraft doesn't read yet were left out παραλείφθηκαν κείμενα, εικόνες, ορθογώνια, ελλείψεις, διαδρομές αποκοπής και άλλα αντικείμενα του CMX που το VectorCraft δεν διαβάζει ακόμη
|
||||
@msg CMX fills other than uniform colors were left out παραλείφθηκαν τα γεμίσματα του CMX εκτός από τα ενιαία χρώματα
|
||||
@msg colors in CMX color models VectorCraft doesn't read were opened as black τα χρώματα σε χρωματικά μοντέλα του CMX που δεν διαβάζει το VectorCraft ανοίχτηκαν ως μαύρα
|
||||
@msg CMX library colors that the file stores only by number were opened as black spot colors τα χρώματα βιβλιοθήκης του CMX που το αρχείο αποθηκεύει μόνο με αριθμό ανοίχτηκαν ως μαύρα πλακάτα χρώματα
|
||||
@msg CMX outline arrowheads were left out παραλείφθηκαν οι αιχμές βελών των γραμμών περιγράμματος του CMX
|
||||
@msg CMX lenses were not applied δεν εφαρμόστηκαν οι φακοί του CMX
|
||||
@msg CMX pages longer than 163,830 pt were opened at that length, and art near their edges lies outside the artboard οι σελίδες του CMX με μήκος πάνω από 163.830 pt ανοίχτηκαν σε αυτό το μήκος και το γραφικό κοντά στα άκρα τους βρίσκεται έξω από τον πίνακα σχεδίασης
|
||||
@msg the PSD image is too large to read ({_1} × {_2} pixels) η εικόνα PSD είναι πολύ μεγάλη για ανάγνωση ({_1} × {_2} εικονοστοιχεία)
|
||||
@msg zipped 1-bit PSD image data with prediction can't be read τα συμπιεσμένα δεδομένα εικόνας PSD 1 bit με πρόβλεψη δεν διαβάζονται
|
||||
@msg the PSD file's layer data uses an unknown compression ({m}) τα δεδομένα επιπέδων του αρχείου PSD χρησιμοποιούν άγνωστη συμπίεση ({m})
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -5846,6 +5846,14 @@ variable-list-end {0}, {1} {0} y {1}
|
||||
@msg parts of the drawing nested too deeply, or past the import limits, were left out se omitieron partes del dibujo anidadas a demasiada profundidad o fuera de los límites de importación
|
||||
@msg damaged parts of the drawing were left out se omitieron partes dañadas del dibujo
|
||||
@msg CDR pages longer than 163,830 pt were opened at that length, and art near their edges lies outside the artboard las páginas de CDR de más de 163.830 pt se abrieron con esa longitud, y el arte cerca de sus bordes queda fuera de la mesa de trabajo
|
||||
@msg this CMX file can't be read ({why}) no se puede leer este archivo CMX ({why})
|
||||
@msg CMX text, images, rectangles, ellipses, clipping paths and other objects VectorCraft doesn't read yet were left out se omitieron textos, imágenes, rectángulos, elipses, trazados de recorte y otros objetos de CMX que VectorCraft aún no lee
|
||||
@msg CMX fills other than uniform colors were left out se omitieron los rellenos de CMX que no son colores uniformes
|
||||
@msg colors in CMX color models VectorCraft doesn't read were opened as black los colores en modelos de color de CMX que VectorCraft no lee se abrieron en negro
|
||||
@msg CMX library colors that the file stores only by number were opened as black spot colors los colores de biblioteca de CMX que el archivo guarda solo por número se abrieron como tintas planas negras
|
||||
@msg CMX outline arrowheads were left out se omitieron las puntas de flecha de los contornos de CMX
|
||||
@msg CMX lenses were not applied no se aplicaron las lentes de CMX
|
||||
@msg CMX pages longer than 163,830 pt were opened at that length, and art near their edges lies outside the artboard las páginas de CMX de más de 163.830 pt se abrieron con esa longitud, y el arte cerca de sus bordes queda fuera de la mesa de trabajo
|
||||
@msg the PSD image is too large to read ({_1} × {_2} pixels) la imagen PSD es demasiado grande para leerla ({_1} × {_2} píxeles)
|
||||
@msg zipped 1-bit PSD image data with prediction can't be read no se pueden leer datos de imagen PSD de 1 bit comprimidos en ZIP con predicción
|
||||
@msg the PSD file's layer data uses an unknown compression ({m}) los datos de capa del archivo PSD usan una compresión desconocida ({m})
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -6025,6 +6025,14 @@ variable-list-end {0}, {1} {0} ja {1}
|
||||
@msg parts of the drawing nested too deeply, or past the import limits, were left out liian syvälle sisäkkäiset tai tuontirajojen ylittävät piirroksen osat jätettiin pois
|
||||
@msg damaged parts of the drawing were left out piirroksen vahingoittuneet osat jätettiin pois
|
||||
@msg CDR pages longer than 163,830 pt were opened at that length, and art near their edges lies outside the artboard yli 163 830 pt pitkät CDR-sivut avattiin tämän pituisina, ja niiden reunojen lähellä oleva grafiikka on piirtoalustan ulkopuolella
|
||||
@msg this CMX file can't be read ({why}) tätä CMX-tiedostoa ei voi lukea ({why})
|
||||
@msg CMX text, images, rectangles, ellipses, clipping paths and other objects VectorCraft doesn't read yet were left out CMX-tekstit, kuvat, suorakulmiot, ellipsit, rajauspolut ja muut objektit, joita VectorCraft ei vielä lue, jätettiin pois
|
||||
@msg CMX fills other than uniform colors were left out CMX-täytöt, jotka eivät ole tasaisia värejä, jätettiin pois
|
||||
@msg colors in CMX color models VectorCraft doesn't read were opened as black värit CMX-värimalleissa, joita VectorCraft ei lue, avattiin mustina
|
||||
@msg CMX library colors that the file stores only by number were opened as black spot colors CMX-kirjastovärit, jotka tiedosto tallentaa vain numerona, avattiin mustina spottiväreinä
|
||||
@msg CMX outline arrowheads were left out CMX-ääriviivojen nuolenkärjet jätettiin pois
|
||||
@msg CMX lenses were not applied CMX-linssejä ei käytetty
|
||||
@msg CMX pages longer than 163,830 pt were opened at that length, and art near their edges lies outside the artboard yli 163 830 pt pitkät CMX-sivut avattiin tämän pituisina, ja niiden reunojen lähellä oleva grafiikka on piirtoalustan ulkopuolella
|
||||
@msg the PSD image is too large to read ({_1} × {_2} pixels) tämä PSD-kuva on liian suuri luettavaksi ({_1} × {_2} pikseliä)
|
||||
@msg zipped 1-bit PSD image data with prediction can't be read ennustusta käyttävää zip-pakattua 1-bittistä PSD-kuvadataa ei voi lukea
|
||||
@msg the PSD file's layer data uses an unknown compression ({m}) tämän PSD-tiedoston tasodata käyttää tuntematonta pakkausta ({m})
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -5823,6 +5823,14 @@ variable-list-end {0}, {1} {0} et {1}
|
||||
@msg parts of the drawing nested too deeply, or past the import limits, were left out les parties du dessin trop profondément imbriquées ou au-delà des limites d’importation ont été ignorées
|
||||
@msg damaged parts of the drawing were left out les parties endommagées du dessin ont été ignorées
|
||||
@msg CDR pages longer than 163,830 pt were opened at that length, and art near their edges lies outside the artboard les pages CDR de plus de 163 830 pt ont été ouvertes à cette longueur, et l’illustration proche de leurs bords se trouve hors du plan de travail
|
||||
@msg this CMX file can't be read ({why}) impossible de lire ce fichier CMX ({why})
|
||||
@msg CMX text, images, rectangles, ellipses, clipping paths and other objects VectorCraft doesn't read yet were left out les textes, images, rectangles, ellipses, tracés de détourage et autres objets CMX que VectorCraft ne lit pas encore ont été ignorés
|
||||
@msg CMX fills other than uniform colors were left out les remplissages CMX autres que les couleurs unies ont été ignorés
|
||||
@msg colors in CMX color models VectorCraft doesn't read were opened as black les couleurs des modèles colorimétriques CMX que VectorCraft ne lit pas ont été ouvertes en noir
|
||||
@msg CMX library colors that the file stores only by number were opened as black spot colors les couleurs de bibliothèque CMX que le fichier enregistre uniquement par numéro ont été ouvertes comme tons directs noirs
|
||||
@msg CMX outline arrowheads were left out les pointes de flèche des contours CMX ont été ignorées
|
||||
@msg CMX lenses were not applied les lentilles CMX n’ont pas été appliquées
|
||||
@msg CMX pages longer than 163,830 pt were opened at that length, and art near their edges lies outside the artboard les pages CMX de plus de 163 830 pt ont été ouvertes à cette longueur, et l’illustration proche de leurs bords se trouve hors du plan de travail
|
||||
@msg the PSD image is too large to read ({_1} × {_2} pixels) l’image PSD est trop grande pour être lue ({_1} × {_2} pixels)
|
||||
@msg zipped 1-bit PSD image data with prediction can't be read les données d’image PSD 1 bit compressées en ZIP avec prédiction ne peuvent pas être lues
|
||||
@msg the PSD file's layer data uses an unknown compression ({m}) les données de calque du fichier PSD utilisent une compression inconnue ({m})
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -9103,6 +9103,14 @@ liquify-list-end {0}, {1} {0} और {1}
|
||||
@msg parts of the drawing nested too deeply, or past the import limits, were left out ड्रॉइंग के बहुत गहराई तक नेस्ट किए गए या आयात सीमाओं से परे के हिस्से छोड़ दिए गए
|
||||
@msg damaged parts of the drawing were left out ड्रॉइंग के क्षतिग्रस्त हिस्से छोड़ दिए गए
|
||||
@msg CDR pages longer than 163,830 pt were opened at that length, and art near their edges lies outside the artboard 163,830 pt से लंबे CDR पेज उसी लंबाई पर खोले गए, और उनके किनारों के पास का आर्ट आर्टबोर्ड के बाहर है
|
||||
@msg this CMX file can't be read ({why}) इस CMX फ़ाइल को पढ़ा नहीं जा सकता ({why})
|
||||
@msg CMX text, images, rectangles, ellipses, clipping paths and other objects VectorCraft doesn't read yet were left out CMX के टेक्स्ट, इमेज, आयत, दीर्घवृत्त, क्लिपिंग पाथ और अन्य ऑब्जेक्ट, जिन्हें VectorCraft अभी नहीं पढ़ता, छोड़ दिए गए
|
||||
@msg CMX fills other than uniform colors were left out एकसमान रंगों के अलावा CMX के फ़िल छोड़ दिए गए
|
||||
@msg colors in CMX color models VectorCraft doesn't read were opened as black जिन CMX रंग मॉडलों को VectorCraft नहीं पढ़ता, उनके रंग काले के रूप में खोले गए
|
||||
@msg CMX library colors that the file stores only by number were opened as black spot colors CMX लाइब्रेरी के जिन रंगों को फ़ाइल केवल संख्या से सहेजती है, वे काले स्पॉट रंगों के रूप में खोले गए
|
||||
@msg CMX outline arrowheads were left out CMX आउटलाइन के तीर-शीर्ष छोड़ दिए गए
|
||||
@msg CMX lenses were not applied CMX लेंस लागू नहीं किए गए
|
||||
@msg CMX pages longer than 163,830 pt were opened at that length, and art near their edges lies outside the artboard 163,830 pt से लंबे CMX पेज उसी लंबाई पर खोले गए, और उनके किनारों के पास का आर्ट आर्टबोर्ड के बाहर है
|
||||
@msg the JPEG 2000 file has an unsupported color space or JPX content JPEG 2000 फ़ाइल में असमर्थित कलर स्पेस या JPX सामग्री है
|
||||
@msg The last start of VectorCraft ended on {name} before its window appeared, so it started on {summary}. To try that graphics processor again, change Preferences › Performance › Graphics Processor or start with WGPU_BACKEND set वेक्टर क्रेफ्ट की अंतिम शुरुआत अपनी विंडो दिखाई देने से पहले {name} पर समाप्त हुई, इसलिए यह {summary} पर शुरू हुआ। उस ग्राफिक्स प्रोसेसर को फिर से आज़माने के लिए, वरीयताओं को बदलें › प्रदर्शन › ग्राफिक्स प्रोसेसर या WGPU_BACKEND सेट के साथ शुरू होता है।
|
||||
@msg The last start of VectorCraft ended while it listed the graphics processors, so it started on {summary} with OpenGL alone. To try the other graphics backends again, change Preferences › Performance › Graphics Processor or start with WGPU_BACKEND set जब यह ग्राफिक्स प्रोसेसर को सूचीबद्ध करता है, तो यह केवल ओपनजीएल के साथ {summary} पर शुरू हुआ। फिर से अन्य ग्राफिक्स बैकेंड की कोशिश करने के लिए, वरीयताओं को बदलें › प्रदर्शन › ग्राफिक्स प्रोसेसर या WGPU_BACKEND सेट के साथ शुरू होता है।
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -6330,6 +6330,14 @@ liquify-list-end {0}, {1} {0} és {1}
|
||||
@msg parts of the drawing nested too deeply, or past the import limits, were left out kimaradtak a rajz túl mélyen egymásba ágyazott vagy az importálási korlátokon túli részei
|
||||
@msg damaged parts of the drawing were left out kimaradtak a rajz sérült részei
|
||||
@msg CDR pages longer than 163,830 pt were opened at that length, and art near their edges lies outside the artboard a 163 830 pt-nál hosszabb CDR-oldalak ekkora hosszal nyíltak meg, és a szélük közelében lévő grafika a rajztáblán kívül esik
|
||||
@msg this CMX file can't be read ({why}) ez a CMX-fájl nem olvasható ({why})
|
||||
@msg CMX text, images, rectangles, ellipses, clipping paths and other objects VectorCraft doesn't read yet were left out kimaradtak a CMX szövegei, képei, téglalapjai, ellipszisei, vágógörbéi és egyéb objektumai, amelyeket a VectorCraft még nem olvas
|
||||
@msg CMX fills other than uniform colors were left out kimaradtak a CMX kitöltései, amelyek nem egyszínűek
|
||||
@msg colors in CMX color models VectorCraft doesn't read were opened as black a CMX olyan színmodelljeiben megadott színek, amelyeket a VectorCraft nem olvas, feketeként nyíltak meg
|
||||
@msg CMX library colors that the file stores only by number were opened as black spot colors a CMX könyvtári színei, amelyeket a fájl csak számként tárol, fekete direktszínként nyíltak meg
|
||||
@msg CMX outline arrowheads were left out kimaradtak a CMX körvonalainak nyílhegyei
|
||||
@msg CMX lenses were not applied a CMX lencsék nem lettek alkalmazva
|
||||
@msg CMX pages longer than 163,830 pt were opened at that length, and art near their edges lies outside the artboard a 163 830 pt-nál hosszabb CMX-oldalak ekkora hosszal nyíltak meg, és a szélük közelében lévő grafika a rajztáblán kívül esik
|
||||
@msg the PSD image is too large to read ({_1} × {_2} pixels) a PSD-kép túl nagy a beolvasáshoz ({_1} × {_2} pixel)
|
||||
@msg the Save PDF dialog didn't open a PDF mentése párbeszédablak nem nyílt meg
|
||||
@msg the scale is not a usable number a méretarány nem használható szám
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -5868,6 +5868,14 @@ variable-list-end {0}, {1} {0} e {1}
|
||||
@msg parts of the drawing nested too deeply, or past the import limits, were left out le parti del disegno annidate troppo in profondità o oltre i limiti di importazione sono state omesse
|
||||
@msg damaged parts of the drawing were left out le parti danneggiate del disegno sono state omesse
|
||||
@msg CDR pages longer than 163,830 pt were opened at that length, and art near their edges lies outside the artboard le pagine di CDR più lunghe di 163.830 pt sono state aperte con quella lunghezza, e la grafica vicina ai loro bordi si trova fuori dalla tavola da disegno
|
||||
@msg this CMX file can't be read ({why}) impossibile leggere questo file CMX ({why})
|
||||
@msg CMX text, images, rectangles, ellipses, clipping paths and other objects VectorCraft doesn't read yet were left out testi, immagini, rettangoli, ellissi, tracciati di ritaglio e altri oggetti di CMX che VectorCraft non legge ancora sono stati omessi
|
||||
@msg CMX fills other than uniform colors were left out i riempimenti di CMX diversi dai colori uniformi sono stati omessi
|
||||
@msg colors in CMX color models VectorCraft doesn't read were opened as black i colori in modelli di colore di CMX che VectorCraft non legge sono stati aperti in nero
|
||||
@msg CMX library colors that the file stores only by number were opened as black spot colors i colori di libreria di CMX che il file salva solo per numero sono stati aperti come colori spot neri
|
||||
@msg CMX outline arrowheads were left out le punte di freccia dei contorni di CMX sono state omesse
|
||||
@msg CMX lenses were not applied le lenti di CMX non sono state applicate
|
||||
@msg CMX pages longer than 163,830 pt were opened at that length, and art near their edges lies outside the artboard le pagine di CMX più lunghe di 163.830 pt sono state aperte con quella lunghezza, e la grafica vicina ai loro bordi si trova fuori dalla tavola da disegno
|
||||
@msg the PSD image is too large to read ({_1} × {_2} pixels) l'immagine PSD è troppo grande per essere letta ({_1} × {_2} pixel)
|
||||
@msg zipped 1-bit PSD image data with prediction can't be read i dati immagine PSD a 1 bit compressi ZIP con previsione non possono essere letti
|
||||
@msg the PSD file's layer data uses an unknown compression ({m}) i dati dei livelli del file PSD usano una compressione sconosciuta ({m})
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -5916,6 +5916,14 @@ liquify-list-end {0}, {1} {0}、{1}
|
||||
@msg parts of the drawing nested too deeply, or past the import limits, were left out 入れ子が深すぎる図面の部分や読み込みの上限を超えた部分は除外されました
|
||||
@msg damaged parts of the drawing were left out 図面の破損した部分は除外されました
|
||||
@msg CDR pages longer than 163,830 pt were opened at that length, and art near their edges lies outside the artboard 163,830 pt より長い CDR のページはその長さで開いたため、端の近くのアートはアートボードの外にあります
|
||||
@msg this CMX file can't be read ({why}) この CMX ファイルは読み込めません ({why})
|
||||
@msg CMX text, images, rectangles, ellipses, clipping paths and other objects VectorCraft doesn't read yet were left out VectorCraft でまだ読み込めない CMX のテキスト、画像、長方形、楕円、クリッピングパス、その他のオブジェクトは除外されました
|
||||
@msg CMX fills other than uniform colors were left out 均一な色以外の CMX の塗りは除外されました
|
||||
@msg colors in CMX color models VectorCraft doesn't read were opened as black VectorCraft で読み込めない CMX のカラーモデルの色は黒として開きました
|
||||
@msg CMX library colors that the file stores only by number were opened as black spot colors ファイルが番号だけで保存している CMX のライブラリカラーは黒の特色として開きました
|
||||
@msg CMX outline arrowheads were left out CMX のアウトラインの矢印は除外されました
|
||||
@msg CMX lenses were not applied CMX のレンズは適用されませんでした
|
||||
@msg CMX pages longer than 163,830 pt were opened at that length, and art near their edges lies outside the artboard 163,830 pt より長い CMX のページはその長さで開いたため、端の近くのアートはアートボードの外にあります
|
||||
@msg the PSD image is too large to read ({_1} × {_2} pixels) PSD 画像が大きすぎて読み込めません({_1} × {_2} ピクセル)
|
||||
@msg zipped 1-bit PSD image data with prediction can't be read 予測付き ZIP 圧縮の 1 bit PSD 画像データは読み込めません
|
||||
@msg the PSD file's layer data uses an unknown compression ({m}) PSD ファイルのレイヤーデータの圧縮方式が不明です({m})
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -7512,6 +7512,14 @@ font-technology Variable ცვლადი
|
||||
@msg parts of the drawing nested too deeply, or past the import limits, were left out ნახაზის ზედმეტად ღრმად ჩადგმული ან იმპორტის ლიმიტებს მიღმა არსებული ნაწილები გამოტოვებულია
|
||||
@msg damaged parts of the drawing were left out ნახაზის დაზიანებული ნაწილები გამოტოვებულია
|
||||
@msg CDR pages longer than 163,830 pt were opened at that length, and art near their edges lies outside the artboard 163 830 pt-ზე გრძელი CDR-ის გვერდები ამ სიგრძით გაიხსნა და მათ კიდეებთან ახლოს მყოფი გრაფიკა სამუშაო დაფის გარეთაა
|
||||
@msg this CMX file can't be read ({why}) ამ CMX ფაილის წაკითხვა შეუძლებელია ({why})
|
||||
@msg CMX text, images, rectangles, ellipses, clipping paths and other objects VectorCraft doesn't read yet were left out CMX-ის ტექსტები, გამოსახულებები, მართკუთხედები, ელიფსები, ამოჭრის კონტურები და სხვა ობიექტები, რომლებსაც VectorCraft ჯერ ვერ კითხულობს, გამოტოვებულია
|
||||
@msg CMX fills other than uniform colors were left out CMX-ის შევსებები, გარდა ერთგვაროვანი ფერებისა, გამოტოვებულია
|
||||
@msg colors in CMX color models VectorCraft doesn't read were opened as black CMX-ის იმ ფერის მოდელების ფერები, რომლებსაც VectorCraft ვერ კითხულობს, შავად გაიხსნა
|
||||
@msg CMX library colors that the file stores only by number were opened as black spot colors CMX-ის ბიბლიოთეკის ფერები, რომლებსაც ფაილი მხოლოდ ნომრით ინახავს, შავ სპოტ-ფერებად გაიხსნა
|
||||
@msg CMX outline arrowheads were left out CMX-ის მოხაზულობების ისრისპირები გამოტოვებულია
|
||||
@msg CMX lenses were not applied CMX-ის ლინზები არ იქნა გამოყენებული
|
||||
@msg CMX pages longer than 163,830 pt were opened at that length, and art near their edges lies outside the artboard 163 830 pt-ზე გრძელი CMX-ის გვერდები ამ სიგრძით გაიხსნა და მათ კიდეებთან ახლოს მყოფი გრაფიკა სამუშაო დაფის გარეთაა
|
||||
@msg the PSD image is too large to read ({_1} × {_2} pixels) PSD გამოსახულება ზედმეტად დიდია წასაკითხად ({_1} × {_2} პიქსელი)
|
||||
@msg zipped 1-bit PSD image data with prediction can't be read zip-ით შეკუმშული 1-ბიტიანი PSD გამოსახულების მონაცემების წაკითხვა პროგნოზირებით ვერ ხერხდება
|
||||
@msg the PSD file's layer data uses an unknown compression ({m}) PSD ფაილის შრეების მონაცემები უცნობ შეკუმშვას იყენებს ({m})
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -5845,6 +5845,14 @@ liquify-list-end {0}, {1} {0} 및 {1}
|
||||
@msg parts of the drawing nested too deeply, or past the import limits, were left out 너무 깊이 중첩되었거나 가져오기 한도를 넘은 도면 부분은 제외했습니다
|
||||
@msg damaged parts of the drawing were left out 도면의 손상된 부분은 제외했습니다
|
||||
@msg CDR pages longer than 163,830 pt were opened at that length, and art near their edges lies outside the artboard 163,830pt보다 긴 CDR 페이지는 그 길이로 열었으며, 가장자리 근처의 아트는 아트보드 밖에 있습니다
|
||||
@msg this CMX file can't be read ({why}) 이 CMX 파일을 읽을 수 없습니다 ({why})
|
||||
@msg CMX text, images, rectangles, ellipses, clipping paths and other objects VectorCraft doesn't read yet were left out VectorCraft가 아직 읽지 못하는 CMX 텍스트, 이미지, 사각형, 타원, 클리핑 패스 및 기타 개체는 제외했습니다
|
||||
@msg CMX fills other than uniform colors were left out 균일한 색상이 아닌 CMX 칠은 제외했습니다
|
||||
@msg colors in CMX color models VectorCraft doesn't read were opened as black VectorCraft가 읽지 못하는 CMX 색상 모델의 색상은 검정으로 열었습니다
|
||||
@msg CMX library colors that the file stores only by number were opened as black spot colors 파일이 번호로만 저장한 CMX 라이브러리 색상은 검정 별색으로 열었습니다
|
||||
@msg CMX outline arrowheads were left out CMX 외곽선의 화살촉은 제외했습니다
|
||||
@msg CMX lenses were not applied CMX 렌즈는 적용하지 않았습니다
|
||||
@msg CMX pages longer than 163,830 pt were opened at that length, and art near their edges lies outside the artboard 163,830pt보다 긴 CMX 페이지는 그 길이로 열었으며, 가장자리 근처의 아트는 아트보드 밖에 있습니다
|
||||
@msg the PSD image is too large to read ({_1} × {_2} pixels) PSD 이미지가 너무 커서 읽을 수 없습니다({_1} × {_2}픽셀)
|
||||
@msg zipped 1-bit PSD image data with prediction can't be read 예측이 적용된 ZIP 압축 1비트 PSD 이미지 데이터는 읽을 수 없습니다
|
||||
@msg the PSD file's layer data uses an unknown compression ({m}) PSD 파일의 레이어 데이터가 알 수 없는 압축({m})을 사용합니다
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -331,6 +331,14 @@ liquify-list-end {0}, {1} {0} en {1}
|
||||
@msg parts of the drawing nested too deeply, or past the import limits, were left out delen van de tekening die te diep genest zijn of buiten de importlimieten vallen, zijn weggelaten
|
||||
@msg damaged parts of the drawing were left out beschadigde delen van de tekening zijn weggelaten
|
||||
@msg CDR pages longer than 163,830 pt were opened at that length, and art near their edges lies outside the artboard CDR-pagina’s langer dan 163.830 pt zijn op die lengte geopend, en illustraties bij de randen ervan liggen buiten het tekengebied
|
||||
@msg this CMX file can't be read ({why}) dit CMX-bestand kan niet worden gelezen ({why})
|
||||
@msg CMX text, images, rectangles, ellipses, clipping paths and other objects VectorCraft doesn't read yet were left out CMX-tekst, afbeeldingen, rechthoeken, ellipsen, uitknippaden en andere objecten die VectorCraft nog niet leest, zijn weggelaten
|
||||
@msg CMX fills other than uniform colors were left out CMX-vullingen die geen egale kleuren zijn, zijn weggelaten
|
||||
@msg colors in CMX color models VectorCraft doesn't read were opened as black kleuren in CMX-kleurmodellen die VectorCraft niet leest, zijn als zwart geopend
|
||||
@msg CMX library colors that the file stores only by number were opened as black spot colors CMX-bibliotheekkleuren die het bestand alleen als nummer opslaat, zijn als zwarte steunkleuren geopend
|
||||
@msg CMX outline arrowheads were left out pijlpunten van CMX-contouren zijn weggelaten
|
||||
@msg CMX lenses were not applied CMX-lenzen zijn niet toegepast
|
||||
@msg CMX pages longer than 163,830 pt were opened at that length, and art near their edges lies outside the artboard CMX-pagina’s langer dan 163.830 pt zijn op die lengte geopend, en illustraties bij de randen ervan liggen buiten het tekengebied
|
||||
@msg the JPEG XL file is cut short het JPEG XL-bestand is afgebroken
|
||||
@msg the JPEG XL container is too large to read de JPEG XL-container is te groot om te lezen
|
||||
@msg CMYK JPEG XL images can't be read CMYK-afbeeldingen in JPEG XL kunnen niet worden gelezen
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -5928,6 +5928,14 @@ variable-list-end {0}, {1} {0} i {1}
|
||||
@msg parts of the drawing nested too deeply, or past the import limits, were left out pominięto części rysunku zagnieżdżone zbyt głęboko lub wykraczające poza limity importu
|
||||
@msg damaged parts of the drawing were left out pominięto uszkodzone części rysunku
|
||||
@msg CDR pages longer than 163,830 pt were opened at that length, and art near their edges lies outside the artboard strony CDR dłuższe niż 163 830 pt otwarto z tą długością, a kompozycja przy ich krawędziach leży poza obszarem kompozycji
|
||||
@msg this CMX file can't be read ({why}) nie można odczytać tego pliku CMX ({why})
|
||||
@msg CMX text, images, rectangles, ellipses, clipping paths and other objects VectorCraft doesn't read yet were left out pominięto teksty, obrazy, prostokąty, elipsy, ścieżki przycinające i inne obiekty CMX, których VectorCraft jeszcze nie odczytuje
|
||||
@msg CMX fills other than uniform colors were left out pominięto wypełnienia CMX inne niż jednolite kolory
|
||||
@msg colors in CMX color models VectorCraft doesn't read were opened as black kolory w modelach kolorów CMX, których VectorCraft nie odczytuje, otwarto jako czarne
|
||||
@msg CMX library colors that the file stores only by number were opened as black spot colors kolory z bibliotek CMX, które plik zapisuje tylko jako numer, otwarto jako czarne kolory dodatkowe
|
||||
@msg CMX outline arrowheads were left out pominięto groty strzałek na obrysach CMX
|
||||
@msg CMX lenses were not applied soczewki CMX nie zostały zastosowane
|
||||
@msg CMX pages longer than 163,830 pt were opened at that length, and art near their edges lies outside the artboard strony CMX dłuższe niż 163 830 pt otwarto z tą długością, a kompozycja przy ich krawędziach leży poza obszarem kompozycji
|
||||
@msg the PSD image is too large to read ({_1} × {_2} pixels) obraz PSD jest zbyt duży, aby go odczytać ({_1} × {_2} pikseli)
|
||||
@msg zipped 1-bit PSD image data with prediction can't be read nie można odczytać spakowanych 1-bitowych danych obrazu PSD z predykcją
|
||||
@msg the PSD file's layer data uses an unknown compression ({m}) dane warstw pliku PSD używają nieznanej kompresji ({m})
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -5058,6 +5058,14 @@ variable-list-end {0}, {1} {0} e {1}
|
||||
@msg parts of the drawing nested too deeply, or past the import limits, were left out partes do desenho aninhadas profundamente demais ou além dos limites de importação foram omitidas
|
||||
@msg damaged parts of the drawing were left out partes danificadas do desenho foram omitidas
|
||||
@msg CDR pages longer than 163,830 pt were opened at that length, and art near their edges lies outside the artboard páginas do CDR com mais de 163.830 pt foram abertas com esse comprimento, e a arte perto das bordas fica fora da prancheta
|
||||
@msg this CMX file can't be read ({why}) não é possível ler este arquivo CMX ({why})
|
||||
@msg CMX text, images, rectangles, ellipses, clipping paths and other objects VectorCraft doesn't read yet were left out textos, imagens, retângulos, elipses, demarcadores de recorte e outros objetos do CMX que o VectorCraft ainda não lê foram omitidos
|
||||
@msg CMX fills other than uniform colors were left out os preenchimentos do CMX que não são cores uniformes foram omitidos
|
||||
@msg colors in CMX color models VectorCraft doesn't read were opened as black cores em modelos de cor do CMX que o VectorCraft não lê foram abertas em preto
|
||||
@msg CMX library colors that the file stores only by number were opened as black spot colors cores de biblioteca do CMX que o arquivo guarda apenas pelo número foram abertas como cores spot pretas
|
||||
@msg CMX outline arrowheads were left out as pontas de seta das linhas de contorno do CMX foram omitidas
|
||||
@msg CMX lenses were not applied as lentes do CMX não foram aplicadas
|
||||
@msg CMX pages longer than 163,830 pt were opened at that length, and art near their edges lies outside the artboard páginas do CMX com mais de 163.830 pt foram abertas com esse comprimento, e a arte perto das bordas fica fora da prancheta
|
||||
@msg the PSD image is too large to read ({_1} × {_2} pixels) a imagem PSD é grande demais para ser lida ({_1} × {_2} pixels)
|
||||
@msg zipped 1-bit PSD image data with prediction can't be read dados de imagem PSD de 1 bit compactados em zip com previsão não podem ser lidos
|
||||
@msg the PSD file's layer data uses an unknown compression ({m}) os dados de camada do arquivo PSD usam uma compactação desconhecida ({m})
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -5867,6 +5867,14 @@ variable-list-end {0}, {1} {0} и {1}
|
||||
@msg parts of the drawing nested too deeply, or past the import limits, were left out части рисунка со слишком глубокой вложенностью или за пределами ограничений импорта были пропущены
|
||||
@msg damaged parts of the drawing were left out поврежденные части рисунка были пропущены
|
||||
@msg CDR pages longer than 163,830 pt were opened at that length, and art near their edges lies outside the artboard страницы CDR длиннее 163 830 pt открыты с этой длиной, и графика у их краев находится за пределами монтажной области
|
||||
@msg this CMX file can't be read ({why}) не удается прочитать этот файл CMX ({why})
|
||||
@msg CMX text, images, rectangles, ellipses, clipping paths and other objects VectorCraft doesn't read yet were left out текст, изображения, прямоугольники, эллипсы, обтравочные контуры и другие объекты CMX, которые VectorCraft пока не читает, были пропущены
|
||||
@msg CMX fills other than uniform colors were left out заливки CMX, кроме однородных цветов, были пропущены
|
||||
@msg colors in CMX color models VectorCraft doesn't read were opened as black цвета в цветовых моделях CMX, которые VectorCraft не читает, открыты как черные
|
||||
@msg CMX library colors that the file stores only by number were opened as black spot colors библиотечные цвета CMX, которые файл хранит только по номеру, открыты как черные плашечные цвета
|
||||
@msg CMX outline arrowheads were left out наконечники стрелок абрисов CMX были пропущены
|
||||
@msg CMX lenses were not applied линзы CMX не были применены
|
||||
@msg CMX pages longer than 163,830 pt were opened at that length, and art near their edges lies outside the artboard страницы CMX длиннее 163 830 pt открыты с этой длиной, и графика у их краев находится за пределами монтажной области
|
||||
@msg the PSD image is too large to read ({_1} × {_2} pixels) изображение PSD слишком велико для чтения ({_1} × {_2} пикс.)
|
||||
@msg zipped 1-bit PSD image data with prediction can't be read 1-битные данные изображения PSD со сжатием ZIP с предсказанием не читаются
|
||||
@msg the PSD file's layer data uses an unknown compression ({m}) данные слоёв файла PSD используют неизвестное сжатие ({m})
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -5740,6 +5740,14 @@ variable-list-end {0}, {1} {0} och {1}
|
||||
@msg parts of the drawing nested too deeply, or past the import limits, were left out delar av teckningen som är för djupt nästlade eller ligger utanför importgränserna utelämnades
|
||||
@msg damaged parts of the drawing were left out skadade delar av teckningen utelämnades
|
||||
@msg CDR pages longer than 163,830 pt were opened at that length, and art near their edges lies outside the artboard CDR-sidor längre än 163 830 pt öppnades med den längden, och grafik nära deras kanter ligger utanför ritytan
|
||||
@msg this CMX file can't be read ({why}) den här CMX-filen kan inte läsas ({why})
|
||||
@msg CMX text, images, rectangles, ellipses, clipping paths and other objects VectorCraft doesn't read yet were left out text, bilder, rektanglar, ellipser, urklippsbanor och andra CMX-objekt som VectorCraft ännu inte läser utelämnades
|
||||
@msg CMX fills other than uniform colors were left out CMX-fyllningar som inte är enfärgade utelämnades
|
||||
@msg colors in CMX color models VectorCraft doesn't read were opened as black färger i CMX-färgmodeller som VectorCraft inte läser öppnades som svarta
|
||||
@msg CMX library colors that the file stores only by number were opened as black spot colors CMX-biblioteksfärger som filen bara lagrar som nummer öppnades som svarta dekorfärger
|
||||
@msg CMX outline arrowheads were left out pilspetsar på CMX-linjer utelämnades
|
||||
@msg CMX lenses were not applied CMX-linser tillämpades inte
|
||||
@msg CMX pages longer than 163,830 pt were opened at that length, and art near their edges lies outside the artboard CMX-sidor längre än 163 830 pt öppnades med den längden, och grafik nära deras kanter ligger utanför ritytan
|
||||
@msg the PSD image is too large to read ({_1} × {_2} pixels) PSD-bilden är för stor för att läsas ({_1} × {_2} pixlar)
|
||||
@msg zipped 1-bit PSD image data with prediction can't be read zippad 1-bitars PSD-bilddata med prediktion kan inte läsas
|
||||
@msg the PSD file's layer data uses an unknown compression ({m}) PSD-filens lagerdata använder en okänd komprimering ({m})
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -3607,6 +3607,26 @@ fn cdr_import_notes_are_translated() {
|
||||
}
|
||||
}
|
||||
|
||||
/// The notes a CMX import adds to its warnings are translated in every complete catalog.
|
||||
#[test]
|
||||
fn cmx_import_notes_are_translated() {
|
||||
let notes = [
|
||||
"CMX text, images, rectangles, ellipses, clipping paths and other objects VectorCraft doesn't read yet were left out",
|
||||
"CMX fills other than uniform colors were left out",
|
||||
"colors in CMX color models VectorCraft doesn't read were opened as black",
|
||||
"CMX library colors that the file stores only by number were opened as black spot colors",
|
||||
"CMX outline arrowheads were left out",
|
||||
"CMX lenses were not applied",
|
||||
"CMX pages longer than 163,830 pt were opened at that length, and art near their edges lies outside the artboard",
|
||||
];
|
||||
for code in COMPLETE_MESSAGES {
|
||||
let lang = Lang::from_code(code).expect("registered");
|
||||
for note in notes {
|
||||
assert_ne!(message(lang, note), note, "{code}: {note}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// The plug-in host's status and error messages (manifests, modules, runs and the output of
|
||||
/// importers, exporters and effects) have an `@msg` row in every complete-message catalog.
|
||||
#[test]
|
||||
|
||||
@@ -5568,6 +5568,14 @@ liquify-list-end {0}, {1} {0} ve {1}
|
||||
@msg parts of the drawing nested too deeply, or past the import limits, were left out çizimin fazla derin iç içe geçmiş veya içe aktarma sınırlarının ötesindeki kısımları dışarıda bırakıldı
|
||||
@msg damaged parts of the drawing were left out çizimin hasarlı kısımları dışarıda bırakıldı
|
||||
@msg CDR pages longer than 163,830 pt were opened at that length, and art near their edges lies outside the artboard 163.830 pt'den uzun CDR sayfaları bu uzunlukta açıldı ve kenarlarına yakın çizimler çalışma yüzeyinin dışında kalıyor
|
||||
@msg this CMX file can't be read ({why}) bu CMX dosyası okunamıyor ({why})
|
||||
@msg CMX text, images, rectangles, ellipses, clipping paths and other objects VectorCraft doesn't read yet were left out VectorCraft'ın henüz okumadığı CMX metinleri, görüntüleri, dikdörtgenleri, elipsleri, kırpma yolları ve diğer nesneleri dışarıda bırakıldı
|
||||
@msg CMX fills other than uniform colors were left out düz renkler dışındaki CMX dolguları dışarıda bırakıldı
|
||||
@msg colors in CMX color models VectorCraft doesn't read were opened as black VectorCraft'ın okumadığı CMX renk modellerindeki renkler siyah olarak açıldı
|
||||
@msg CMX library colors that the file stores only by number were opened as black spot colors dosyanın yalnızca numarayla sakladığı CMX kitaplık renkleri siyah nokta renkleri olarak açıldı
|
||||
@msg CMX outline arrowheads were left out CMX anahatlarının ok uçları dışarıda bırakıldı
|
||||
@msg CMX lenses were not applied CMX mercekleri uygulanmadı
|
||||
@msg CMX pages longer than 163,830 pt were opened at that length, and art near their edges lies outside the artboard 163.830 pt'den uzun CMX sayfaları bu uzunlukta açıldı ve kenarlarına yakın çizimler çalışma yüzeyinin dışında kalıyor
|
||||
@msg the PSD image is too large to read ({_1} × {_2} pixels) PSD görüntüsü okunamayacak kadar büyük ({_1} × {_2} piksel)
|
||||
@msg zipped 1-bit PSD image data with prediction can't be read Tahmin içeren sıkıştırılmış 1 bit PSD görüntü verileri okunamıyor
|
||||
@msg the PSD file's layer data uses an unknown compression ({m}) PSD dosyasının katman verileri bilinmeyen bir sıkıştırma kullanıyor ({m})
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -5852,6 +5852,14 @@ variable-list-end {0}, {1} {0} і {1}
|
||||
@msg parts of the drawing nested too deeply, or past the import limits, were left out частини малюнка із надто глибоким вкладенням або поза межами обмежень імпорту було пропущено
|
||||
@msg damaged parts of the drawing were left out пошкоджені частини малюнка було пропущено
|
||||
@msg CDR pages longer than 163,830 pt were opened at that length, and art near their edges lies outside the artboard сторінки CDR, довші за 163 830 pt, відкрито з цією довжиною, і графіка біля їхніх країв лежить поза монтажною областю
|
||||
@msg this CMX file can't be read ({why}) не вдається прочитати цей файл CMX ({why})
|
||||
@msg CMX text, images, rectangles, ellipses, clipping paths and other objects VectorCraft doesn't read yet were left out текст, зображення, прямокутники, еліпси, обтравлювальні контури та інші об’єкти CMX, які VectorCraft поки не читає, було пропущено
|
||||
@msg CMX fills other than uniform colors were left out заливки CMX, крім однорідних кольорів, було пропущено
|
||||
@msg colors in CMX color models VectorCraft doesn't read were opened as black кольори в колірних моделях CMX, які VectorCraft не читає, відкрито як чорні
|
||||
@msg CMX library colors that the file stores only by number were opened as black spot colors бібліотечні кольори CMX, які файл зберігає лише за номером, відкрито як чорні плашкові кольори
|
||||
@msg CMX outline arrowheads were left out наконечники стрілок абрисів CMX було пропущено
|
||||
@msg CMX lenses were not applied лінзи CMX не було застосовано
|
||||
@msg CMX pages longer than 163,830 pt were opened at that length, and art near their edges lies outside the artboard сторінки CMX, довші за 163 830 pt, відкрито з цією довжиною, і графіка біля їхніх країв лежить поза монтажною областю
|
||||
@msg the PSD image is too large to read ({_1} × {_2} pixels) зображення PSD завелике для читання ({_1} × {_2} пікс.)
|
||||
@msg zipped 1-bit PSD image data with prediction can't be read 1-бітні дані зображення PSD зі стисненням ZIP із передбаченням не читаються
|
||||
@msg the PSD file's layer data uses an unknown compression ({m}) дані шарів файлу PSD використовують невідоме стиснення ({m})
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -6118,6 +6118,14 @@ liquify-list-end {0}, {1} {0} và {1}
|
||||
@msg parts of the drawing nested too deeply, or past the import limits, were left out các phần của bản vẽ lồng nhau quá sâu hoặc vượt quá giới hạn nhập đã bị bỏ qua
|
||||
@msg damaged parts of the drawing were left out các phần bị hỏng của bản vẽ đã bị bỏ qua
|
||||
@msg CDR pages longer than 163,830 pt were opened at that length, and art near their edges lies outside the artboard các trang CDR dài hơn 163.830 pt đã được mở với độ dài đó, và hình vẽ gần mép trang nằm ngoài bảng vẽ
|
||||
@msg this CMX file can't be read ({why}) không thể đọc tệp CMX này ({why})
|
||||
@msg CMX text, images, rectangles, ellipses, clipping paths and other objects VectorCraft doesn't read yet were left out văn bản, hình ảnh, hình chữ nhật, hình elip, đường cắt xén và các đối tượng CMX khác mà VectorCraft chưa đọc được đã bị bỏ qua
|
||||
@msg CMX fills other than uniform colors were left out các kiểu tô CMX không phải màu đồng nhất đã bị bỏ qua
|
||||
@msg colors in CMX color models VectorCraft doesn't read were opened as black các màu trong mô hình màu CMX mà VectorCraft không đọc được đã được mở thành màu đen
|
||||
@msg CMX library colors that the file stores only by number were opened as black spot colors các màu thư viện CMX mà tệp chỉ lưu theo số đã được mở thành màu đặc biệt đen
|
||||
@msg CMX outline arrowheads were left out các đầu mũi tên của đường viền CMX đã bị bỏ qua
|
||||
@msg CMX lenses were not applied thấu kính CMX không được áp dụng
|
||||
@msg CMX pages longer than 163,830 pt were opened at that length, and art near their edges lies outside the artboard các trang CMX dài hơn 163.830 pt đã được mở với độ dài đó, và hình vẽ gần mép trang nằm ngoài bảng vẽ
|
||||
@msg the PSD image is too large to read ({_1} × {_2} pixels) ảnh PSD quá lớn để đọc ({_1} × {_2} pixel)
|
||||
@msg the Save PDF dialog didn't open hộp thoại Lưu PDF không mở
|
||||
@msg the scale is not a usable number tỷ lệ không phải là số dùng được
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -5579,6 +5579,14 @@ liquify-list-end {0}, {1} {0}和{1}
|
||||
@msg parts of the drawing nested too deeply, or past the import limits, were left out 已略去绘图中嵌套过深或超出导入限制的部分
|
||||
@msg damaged parts of the drawing were left out 已略去绘图中损坏的部分
|
||||
@msg CDR pages longer than 163,830 pt were opened at that length, and art near their edges lies outside the artboard 长度超过 163,830 pt 的 CDR 页面已按该长度打开,其边缘附近的图稿位于画板之外
|
||||
@msg this CMX file can't be read ({why}) 无法读取此 CMX 文件 ({why})
|
||||
@msg CMX text, images, rectangles, ellipses, clipping paths and other objects VectorCraft doesn't read yet were left out 已略去 VectorCraft 尚不能读取的 CMX 文本、图像、矩形、椭圆、剪切路径和其他对象
|
||||
@msg CMX fills other than uniform colors were left out 已略去 CMX 中均匀颜色以外的填充
|
||||
@msg colors in CMX color models VectorCraft doesn't read were opened as black VectorCraft 不能读取的 CMX 颜色模型中的颜色已作为黑色打开
|
||||
@msg CMX library colors that the file stores only by number were opened as black spot colors 文件仅按编号存储的 CMX 库颜色已作为黑色专色打开
|
||||
@msg CMX outline arrowheads were left out 已略去 CMX 轮廓线的箭头
|
||||
@msg CMX lenses were not applied 未应用 CMX 透镜
|
||||
@msg CMX pages longer than 163,830 pt were opened at that length, and art near their edges lies outside the artboard 长度超过 163,830 pt 的 CMX 页面已按该长度打开,其边缘附近的图稿位于画板之外
|
||||
@msg the PSD image is too large to read ({_1} × {_2} pixels) PSD 图像过大,无法读取 ({_1} × {_2} 像素)
|
||||
@msg zipped 1-bit PSD image data with prediction can't be read 无法读取带预测的 ZIP 压缩 1 位 PSD 图像数据
|
||||
@msg the PSD file's layer data uses an unknown compression ({m}) PSD 文件的图层数据使用了未知的压缩方式 ({m})
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -3034,6 +3034,14 @@ liquify-list-end {0}, {1} {0}和{1}
|
||||
@msg parts of the drawing nested too deeply, or past the import limits, were left out 已略過繪圖中巢狀過深或超出讀入限制的部分
|
||||
@msg damaged parts of the drawing were left out 已略過繪圖中損壞的部分
|
||||
@msg CDR pages longer than 163,830 pt were opened at that length, and art near their edges lies outside the artboard 長度超過 163,830 pt 的 CDR 頁面已以該長度開啟,其邊緣附近的圖稿位於工作區域之外
|
||||
@msg this CMX file can't be read ({why}) 無法讀取此 CMX 檔案 ({why})
|
||||
@msg CMX text, images, rectangles, ellipses, clipping paths and other objects VectorCraft doesn't read yet were left out 已略過 VectorCraft 尚無法讀取的 CMX 文字、影像、矩形、橢圓、剪裁路徑和其他物件
|
||||
@msg CMX fills other than uniform colors were left out 已略過 CMX 中均勻色彩以外的填色
|
||||
@msg colors in CMX color models VectorCraft doesn't read were opened as black VectorCraft 無法讀取的 CMX 色彩模式中的顏色已以黑色開啟
|
||||
@msg CMX library colors that the file stores only by number were opened as black spot colors 檔案僅以編號儲存的 CMX 色彩庫顏色已以黑色特別色開啟
|
||||
@msg CMX outline arrowheads were left out 已略過 CMX 外框線的箭頭
|
||||
@msg CMX lenses were not applied 未套用 CMX 透鏡
|
||||
@msg CMX pages longer than 163,830 pt were opened at that length, and art near their edges lies outside the artboard 長度超過 163,830 pt 的 CMX 頁面已以該長度開啟,其邊緣附近的圖稿位於工作區域之外
|
||||
@msg the PSD image is too large to read ({_1} × {_2} pixels) PSD 影像過大,無法讀取 ({_1} × {_2} 像素)
|
||||
@msg zipped 1-bit PSD image data with prediction can't be read 無法讀取使用預測的 ZIP 壓縮 1 位元 PSD 影像資料
|
||||
@msg the PSD file's layer data uses an unknown compression ({m}) PSD 檔案的圖層資料使用了不明的壓縮方式 ({m})
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -19,7 +19,7 @@ nothing below L6 depends on a UI toolkit (egui, eframe, winit, rfd). Table: `xta
|
||||
|
||||
| Layer | Crates | Role |
|
||||
|---|---|---|
|
||||
| L0 | `geom`, `color`; `affinity`, `cdr` (standalone, no workspace deps) | curves and transforms (on `kurbo`), colour models, ICC and conversions; the Affinity and `.cdr` readers |
|
||||
| L0 | `geom`, `color`; `affinity`, `cdr` (standalone, no workspace deps) | curves and transforms (on `kurbo`), colour models, ICC and conversions; the Affinity and `.cdr`/`.cmx` readers |
|
||||
| L1 | `doc` | the document model: artboards, layers, objects, appearance, text, symbols; pure data + serde, structural sharing |
|
||||
| L2 | `pathops`, `brush`, `trace`, `text`, `effects`, `plugins`, `three-d` | booleans/Shape Builder/offset/outline; brushes; Image Trace; fonts, shaping (HarfRust, skrifa), bidi and layout; live effects and the pixel-filter pipeline; sandboxed WebAssembly plug-ins (wasmi); 3D surfaces of revolution, projection and shading (`three-d`, on `geom` only) |
|
||||
| L3 | `render`, `svg`, `pdf`, `format`, `eps`, `cad`, `metafile` | document to pixels (`vello_cpu`, multithreaded); SVG, PDF, native JSON, EPS/PostScript (with its own interpreter), DXF, EMF/WMF readers and writers |
|
||||
|
||||
@@ -21,7 +21,7 @@ Ordinary File > Save offers Save As when its own location refuses writes with a
|
||||
|
||||
| | Illustrator | VectorCraft | Notes |
|
||||
|---|---:|---:|---|
|
||||
| Formats opened or placed | ~30 | 33 | missing: FreeHand, DWG |
|
||||
| Formats opened or placed | ~30 | 34 | missing: FreeHand, DWG; extra: `.cmx` |
|
||||
| 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, text wrap options) 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 |
|
||||
@@ -336,6 +336,7 @@ Gradient meshes in the editing data keep each point's own color where a patch's
|
||||
| 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, clipping containers, curves, paths, rectangles, ellipses, arcs, polygons, uniform fills and outlines, from the object's style where it has none of its own; hidden and locked layers, groups and objects; the winding flag as the nonzero fill rule; uniform transparency of version 13 on as opacity and blend mode; text, bitmaps, blends, contours, brush strokes, fountain, pattern, texture and PostScript fills and arrowheads are left out with a warning, and lenses, other transparency and merge modes without a blend mode 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; after an open with a warning, an export or Save As to the drawing's own path needs `acknowledgeLoss: true`; 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` |
|
||||
| `.cmx` exchange files | no (not in the [supported formats](https://helpx.adobe.com/illustrator/desktop/get-started/learn-the-basics/supported-file-formats-in-illustrator.html) list) | yes (files with 32-bit coordinates: pages, layers, groups, curves, uniform fills and outlines with their width, color, caps, joins and dashes; text, images, rectangles, ellipses, clipping paths, other fills and arrowheads are left out with a warning, and lenses are not applied, with a warning; big-endian files and files with 16-bit coordinates are refused) | no | File › Place reads them too; after an open with a warning, an export or Save As to the file's own path needs `acknowledgeLoss: true`; layouts and their sources in `crates/cdr/PROVENANCE.md` (R53 to R63); synthetic test files only; tests in `crates/cdr/tests/it/cmx.rs`, `crates/engine/src/cmd/fileio/tests_cmx.rs` and `crates/engine/tests/import_fuzz.rs` |
|
||||
| Text `.txt` | place, export | place (Text Import Options) | yes | place reads Unicode and ANSI, and Shift JIS, GB2312, Chinese Big 5, Cyrillic, GB18030, Greek, Turkish, Baltic and Central European through the WHATWG Encoding Standard's decoders (VectorCraft's own mapping); `tests/textimport.rs`, `place/text.rs`; fuzzed (`text_import_fuzz.rs`) |
|
||||
| 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 |
|
||||
|
||||
+16
-1
@@ -724,7 +724,7 @@ ends the wait, so the sampler can be shown again. The BSDs and headless sessions
|
||||
| `invoke_menu` | `{command, params?}` | Invokes a menu item by command id. UI commands such as `view.*` and `window.*` are in `command_list` with `ui: true`; running them needs the desktop app (`--connect`). |
|
||||
| `open_panel` | `{panel}` | Remote only. `panel` is a panel id (`layers`, `swatches`, `colorGuide`, …, as `window.panel` takes) or its display label (`"Color Guide"`), in any case. |
|
||||
| `screenshot` | `{path?, scale?, artboard?, window?, max_side?, traceViews?}` | Returns MCP image content (`image/png`, base64) plus a text block. Renders the artboard with the pixels of a PNG `export` with `background: "white"` at the same scale; `traceViews:true` draws Image Trace objects in the view set with `imageTrace.setView`, as in the app's window; `window:true` captures the app window (remote only), as `ui_screenshot` does, and `max_side` (1–4096, window captures only) scales the returned image down as described for `ui_screenshot`. With `path` the backend (the headless session or the app) writes the PNG there too; a window capture written there keeps its full size with `max_side`. An app that does not send the image back writes a window capture without `path` to a file in a new folder inside the system's temporary folder (on Unix only the user can open it); the server reads the file and then removes the folder, also when the capture or the read fails. |
|
||||
| `open_file` | `{path, importer?, params?}` | Opens any readable file as a new active document: `.vectorcraft`/`.drawcraft`, `.vctemplate`, `.svg`/`.svgz`, `.pdf`/`.ai`, `.ait`, `.eps`/`.epsf`, `.ps`, `.dxf`, `.emf`, `.wmf`, PICT (`.pct`/`.pic`/`.pict`, and a version 2 picture of any extension), HP-GL (`.plt`/`.hpgl`/`.hgl`/`.hpg`, and a file of an extension no other format reads that starts with plotter instructions), PNG (`.png`/`.pns`), JPEG, GIF, WebP, TIFF, BMP (`.bmp`/`.dib`/`.rle`), Targa (`.tga`/`.vda`/`.icb`/`.vst`), PCX, Pixar (`.pxr`), JPEG 2000 (`.jpf`/`.jpx`/`.jp2`/`.j2k`/`.j2c`/`.jpc`), HEIC/HEIF (`.heic`/`.heif`), JPEG XL (`.jxl`), PSD (`.psd`/`.pdd`)/PSB (an image opens as a document of its pixel size; a PSD or PSB file with its layers as layers, or as its merged image through `run_command document.open` with `layers: false`; a JPEG XL file as its first frame), CDR drawings of versions 1 to 27 (`.cdr`, `.cdt`). Templates (`.vctemplate`, `.ait`, `.cdt`) open as a new untitled document. PDF, `.ai` and SVG files saved with Preserve Editing reopen as the document they carry. The reply is `document.open`'s: its `warnings` say what didn't come in as it was (an EPS whose PostScript can't be read opens as its preview, and the warning names the PostScript error, the operator and the procedure). A file of an extension only an installed importer plug-in lists opens with that importer ([Plug-ins](#plug-ins)); `importer: "plugin.<id>"` opens the file with the importer it names, which must list the file's extension, also one a built-in format reads (in the app, as File › Open With does), and `params` gives that importer's parameters (their defaults when omitted). `run_command document.formats` lists the formats. |
|
||||
| `open_file` | `{path, importer?, params?}` | Opens any readable file as a new active document: `.vectorcraft`/`.drawcraft`, `.vctemplate`, `.svg`/`.svgz`, `.pdf`/`.ai`, `.ait`, `.eps`/`.epsf`, `.ps`, `.dxf`, `.emf`, `.wmf`, PICT (`.pct`/`.pic`/`.pict`, and a version 2 picture of any extension), HP-GL (`.plt`/`.hpgl`/`.hgl`/`.hpg`, and a file of an extension no other format reads that starts with plotter instructions), PNG (`.png`/`.pns`), JPEG, GIF, WebP, TIFF, BMP (`.bmp`/`.dib`/`.rle`), Targa (`.tga`/`.vda`/`.icb`/`.vst`), PCX, Pixar (`.pxr`), JPEG 2000 (`.jpf`/`.jpx`/`.jp2`/`.j2k`/`.j2c`/`.jpc`), HEIC/HEIF (`.heic`/`.heif`), JPEG XL (`.jxl`), PSD (`.psd`/`.pdd`)/PSB (an image opens as a document of its pixel size; a PSD or PSB file with its layers as layers, or as its merged image through `run_command document.open` with `layers: false`; a JPEG XL file as its first frame), CDR drawings of versions 1 to 27 (`.cdr`, `.cdt`), CMX files with 32-bit coordinates (`.cmx`). Templates (`.vctemplate`, `.ait`, `.cdt`) open as a new untitled document. PDF, `.ai` and SVG files saved with Preserve Editing reopen as the document they carry. The reply is `document.open`'s: its `warnings` say what didn't come in as it was (an EPS whose PostScript can't be read opens as its preview, and the warning names the PostScript error, the operator and the procedure). A file of an extension only an installed importer plug-in lists opens with that importer ([Plug-ins](#plug-ins)); `importer: "plugin.<id>"` opens the file with the importer it names, which must list the file's extension, also one a built-in format reads (in the app, as File › Open With does), and `params` gives that importer's parameters (their defaults when omitted). `run_command document.formats` lists the formats. |
|
||||
| `save_file` | `{path?, compress?, version?, preview?, precision?, options?}` | Runs `document.save`: the document's own file in its own format (native `.vectorcraft` unless it was opened from or saved as SVG, PDF or a restorable `.ai`; then `warnings` say what that format loses). A path's extension picks the format (`.vectorcraft`, `.vctemplate`, `.pdf`, `.svg`, `.svgz`, `.ai`: a PDF carrying the native document, which reopens editable; `.eps`: by default one file whose bounding box fits the visible art, the first artboard when no art shows; `options.useArtboards: true` makes the chosen artboard the page and, with two or more chosen, the file at the path is the central file of the visible art and each artboard is also written to `<name>_<artboard>.eps` beside it, listed in the reply's `files`). For a native file, `compress: true` gzips it (default: the `useCompression` preference, Preferences › File Handling › Use Compression), `version` (1 to 4) writes it for an older VectorCraft (1 and 2 are never compressed, and `version: 2` with `compress: true` is an error), `preview: true` embeds a PNG of the first artboard, and `precision` (0 to 9) rounds path anchors and handles to that many decimal places for that save only (colors, transforms and type stay exact). `options` passes the format's save options as `run_command document.formats` lists them. When `compress`, `version`, `preview` or `precision` is given both at the top level and in `options` with different values, the call is an error (`` `compress: true` and `options.compress: false` disagree: give the option once ``) and nothing is written. A key in `options` that no save format takes is an error, and nothing is written (see Parameter keys). The save drops each option the written format doesn't read. The reply's `warnings` then name each such option given (for example `` `compress` was not used: SVG files don't read it `` for an `.svg` path, and `` `options.preview` was not used: … `` for a key in `options`; a PDF-compatible `.ai` file reads `compress` but not `version`, `preview`, `precision`, `outlineText`, `hiddenObjects`, `transparentImages` or `preserveEditing`, and a legacy `.ai` file reads only its own options). For a `.ai` file, these warnings name the kind of `.ai` written: a legacy .ai (version 7) for `aiVersion: "7"`, a non-PDF-compatible .ai for `pdfCompatible: false`, and a PDF-compatible .ai otherwise, including a save that reuses the options the document was last saved with. `run_command document.save` and the other save commands refuse any option given beside the path and in `options` with different values, and give the same warnings for each key given beside the path or in `options` that the file doesn't read. The headless session and the app receive the same `app.save` params, and the app is also sent `wait: true`: the call returns once the file is written, or with the error (such as a path outside the write root), even with Background Save on. When the save asks first (the question before replacing a file that opened with losses, or on macOS and Linux the file dialog for an untitled document without `path`), the reply is `{pending}` or `"cancelled"` as before, and the save that runs after the answer uses the Background Save preference. Location refusals return `READ_ONLY_LOCATION: <reason>` without a fallback panel for automation; see [Save location errors](#save-location-errors). In the desktop app, a save that runs in the background shows in the progress window after 0.4 s with a moving bar. `file.cancelSave` stops every such save before it replaces its file → `{cancelled: n}`: the file stays as it was, and the document keeps its file and format and stays modified. A save whose file was already being replaced finishes and is reported as saved. `file.saveInBackground` closes the window while the saves go on → `{hidden: n}`. |
|
||||
| `export` | `{path?, format?, scale?, artboard?, range?, selection?, outlineText?, options?}` | `svg`, `svgz`, `pdf`, `ai` (the PDF-compatible `.ai` that Save writes, which carries the document when every artboard is written in order), `eps`, `dxf`, `emf`, `wmf`, `hpgl` (a `.plt` plot file for plotters and cutters), `png`, `jpg`, `webp`, `gif`, `png8` (an indexed `.png`), `tiff`, `bmp`, `tga`, `psd` (layered), `txt` (the document's text), `vectorcraft` or `template` (a native template). The tool's `format` enum and `document.formats` list them, generated from the engine's format table. When `format` is omitted, it comes from the path's extension. PDF and `.ai` write one page per artboard: all of them, or `artboard` (0-based) / `range` (`"1-3, 5"`, 1-based). SVG and SVGZ write one file per chosen artboard. EPS writes one file of the visible art; with `artboard`, `range`, `options.artboards` or `options: {"useArtboards": true}` it writes one file per chosen artboard, after a central file of the visible art when there are two or more, and `useArtboards: false` keeps the one file. Rasters, DXF, EMF, WMF and HP-GL write one artboard, or one file per chosen artboard with `options: {"useArtboards": true}`. Rasters also take `options: {"rect": [x, y, width, height]}` (page points, y down): that area of the page at the given `ppi`/`scale`, without an artboard and without changing the document; it is refused with `artboard`, `artboards`, `range` or `useArtboards`, with a non-positive or non-finite size, and for non-raster formats. `options` carries more format options (e.g. `{"quality": 80}` for JPEG). `selection: true` exports the selected objects cropped to their bounds (the reply adds their `bounds`, and reports `format` and the encoder's `warnings` as a whole-document export does); `outlineText: true` writes SVG text as paths. Template layers are left out, live effects are kept, and exporting `vectorcraft` never changes the document's path. Without `path` the bytes come back as `dataBase64`. Both backends run the same `document.export` call. |
|
||||
| `add_text` | `{text, x?, y?, width?, height?, fit?, fitMinPercent?, path?, mode?, pathEffect?, size?, font?, color?, justify?, vertical?}` | Point type at (x, y) (`justify`: `left`, `center` or `right` starts, centres or ends each line on x); area type with `width`/`height` (`fit`: `none`, `autoHeight`, `shrinkText`, as `text.areaOptions`); or `path` + `mode` (`area`/`onPath`) to flow text in or along a path, with `pathEffect` for type on a path (`rainbow`, `skew`, `3dRibbon`, `stairStep`, `gravity`; SVG export writes type on a path with any effect other than `rainbow` as outlines, with a warning). An invalid effect is rejected before editing. `justify` (also `auto`, `justifyAll`) aligns the paragraphs of every kind, as `text.setStyle` does later. `vertical: true` uses the existing vertical writing mode for every kind (default `false`, horizontal). Returns `{id}`, with `overflow: true` when the text doesn't fit its frame or path. |
|
||||
@@ -10193,6 +10193,21 @@ an envelope is not applied, so an object or a group under one keeps its outline,
|
||||
version 4 opens as one of version 5 does. A file is taken for version 1 or 2 by its content only when the offsets in
|
||||
its header fit the file. A RIFF file that names a version before 3 is refused with a message.
|
||||
|
||||
## CMX import
|
||||
|
||||
`.cmx` exchange files with 32-bit coordinates open and place as editable art, found by their content whatever their
|
||||
extension. Each page becomes an artboard, side by side, at the size the page gives. A page that gives no size takes
|
||||
the size of the drawing's bounds stored with it, centered on the art, or 612 × 792 pt when it stores none either.
|
||||
Layers keep their names, and a layer that holds nothing is left out. Groups stay groups, and curves become paths with
|
||||
their uniform fills and outlines: colors in CMYK or RGB, and library colors stored with their names as spot swatches;
|
||||
outline widths, caps, joins, dashes, an outline behind the fill and an outline scaled with the object. Text, images,
|
||||
rectangles, ellipses, clipping paths and other objects the reader doesn't read yet, fills other than uniform ones and
|
||||
outline arrowheads are left out, and lenses are not applied. The objects a clipping path clips come in without it. The
|
||||
`warnings` of `document.open` name each of these kinds the file had, and say when damaged parts or parts past the
|
||||
import limits were left out. Files in big-endian byte order and files with 16-bit coordinates are refused with a
|
||||
message. VectorCraft doesn't write `.cmx` files. After a file opens with warnings, an export or Save As to its own path
|
||||
needs `acknowledgeLoss: true`.
|
||||
|
||||
## Printing
|
||||
|
||||
`print.setup {settings?}` keeps print settings with the document (one undo step; without `settings` it answers the
|
||||
|
||||
@@ -881,7 +881,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur
|
||||
- **Artboard deletion keys:** Delete/Backspace delete selected boards in one Undo step, retaining the original first board in the current order when all are selected, as in the public [Delete artboards guide](https://helpx.adobe.com/illustrator/desktop/create-manage-artboards/add-edit-artboards/delete-artboards.html). The last board and active drags stay protected; neither key clears selected artwork. Headless shortcut regressions in `tests/distortkeys.rs` cover reordered boards, artwork, saved state and Undo/Redo.
|
||||
- **Locked artboards:** a click in the Artboards panel's lock column locks or unlocks an artboard in one undo step (`artboard.setProps {index, locked}`), and the native format saves the lock. The Artboard tool doesn't move, copy, resize or delete a locked artboard, Rearrange and Fit to Artwork Bounds leave it as it is, and its name isn't edited on the canvas. The art on it (each object whose bounds overlap it, a group as one object) acts as locked art until it is unlocked: clicks, marquees, `select.set`, `select.all` and the tools pass over it, and commands that act on the selection leave it; art drawn or pasted onto it stays selected and editable until the selection leaves it out. Tests in `crates/doc/src/lib.rs`, `tests/panelcmds.rs`, `xform/artboard.rs`, `panels/artboards.rs` and `canvas.rs` cover them. Public references: [Lock artboards](https://helpx.adobe.com/illustrator/desktop/create-manage-artboards/organize-manage-artboards/lock-artboards.html) and [Managing Artboards in Illustrator](https://creativepro.com/managing-artboards-in-illustrator/).
|
||||
- **Linux RPM packaging:** 64-bit runtime capabilities replace Fedora-specific required package names (#1275); glibc 2.35, libm and libgcc_s are declared alongside dynamically loaded xkbcommon and Vulkan/EGL. Generated x86_64/aarch64 metadata and isolated synthetic-provider resolution checked; real-distro install/start-up QA remains pending.
|
||||
- **Linux file associations:** the desktop entry lists the MIME type of every format File › Open reads but PSD, PSB, `.ps` PostScript, Targa, PCX, Pixar, JPEG 2000, HEIC/HEIF, JPEG XL, HP-GL and `.cdr`, `.ai`, `.ait` and EPS included, and the MIME package declares the types shared-mime-info lacks (VectorCraft documents and templates, `.ait`, Affinity), so file managers list VectorCraft under Open With for them, as Finder does on macOS. `the_linux_desktop_entry_opens_every_readable_format` in `apps/vectorcraft/src/tests.rs` checks both files against `OPEN_EXTS`. On Debian 13, Ubuntu 24.04 and Fedora 42, `desktop-file-validate` accepts the desktop entry, `update-mime-database` accepts the MIME package, and `gio` registers the app for every one of these types.
|
||||
- **Linux file associations:** the desktop entry lists the MIME type of every format File › Open reads but PSD, PSB, `.ps` PostScript, Targa, PCX, Pixar, JPEG 2000, HEIC/HEIF, JPEG XL, HP-GL, `.cdr` and `.cmx`, `.ai`, `.ait` and EPS included, and the MIME package declares the types shared-mime-info lacks (VectorCraft documents and templates, `.ait`, Affinity), so file managers list VectorCraft under Open With for them, as Finder does on macOS. `the_linux_desktop_entry_opens_every_readable_format` in `apps/vectorcraft/src/tests.rs` checks both files against `OPEN_EXTS`. On Debian 13, Ubuntu 24.04 and Fedora 42, `desktop-file-validate` accepts the desktop entry, `update-mime-database` accepts the MIME package, and `gio` registers the app for every one of these types.
|
||||
|
||||
- **Architecture:** 19+ crates with enforced layering (`cargo xtask layers`). Every action is a command (~400 engine + ~50 UI). Undo is unlimited via structural sharing. `command.batch` runs several commands as one transaction.
|
||||
- **Parameter schemas:** a command can carry a machine-readable parameter schema (the new `vectorcraft-apischema` crate): each parameter's type, range, unit, whether it is required, its default, whether null counts as left out, and the API levels it was added and deprecated at. `engine.commands` lists the schema in the shape of a JSON Schema 2020-12 object schema, a test keeps the command's `params` text equal to the text the schema writes, and a new call has the params checked against it before the command runs (batch steps before the first step), with an error naming the parameter and no change to the document (a value nested past the schema's 16 levels is such a parameter error, and only a schema that is wrong in itself is an internal error); saved steps keep a key the schema does not name, and their values are checked. The View commands `view.capsLock`, `view.saved.new`, `view.saved.edit`, `view.saved.list`, `view.transparencyGrid` and `view.snapToGlyph.options` have schemas. The schemas belong to API level 1 (`vectorcraft_engine::schemas::API_VERSION`), and a test fails when a schema changes without a new level. Tests: `crates/apischema/src/tests.rs` (with `conformance.rs`, a separate check of the JSON form against the JSON Schema 2020-12 rules), `schemas::tests` and `cmd::views::tests::each_view_command_refuses_a_bad_value_naming_the_parameter` in `vectorcraft-engine`.
|
||||
@@ -2234,6 +2234,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur
|
||||
- DXF export with Use Artboards applies live effects and places symbols' art once for all the artboards' drawings instead of once for each drawing; each drawing's bytes, linked images, warnings and notes are the same as before (`drawings_apply_the_live_effects_once_and_match_drawings_written_alone`, `each_artboard_s_drawing_is_the_drawing_of_that_artboard_alone`).
|
||||
- Affinity documents in (AF.1–AF.4): `.af` (Affinity 3) and `.afdesign`/`.afphoto`/`.afpub` (Affinity 1 and 2, container versions 8–12) open and place as editable art: layers and sublayers, groups (pass-through or isolated), artboards (with their names and backgrounds) and Publisher pages side by side, curves with live corners, parametric shapes (rectangles with corner radii, ellipses, polygons, stars, pies, triangles, trapezoids), compound shapes, solid/linear/elliptical gradient fills and strokes (weight, dashes, alignment, scale-with-object), clipping by nesting, vector and pixel masks, artistic and frame text with fonts, sizes, tracking, leading and alignment, placed images (their original JPEG/PNG) and pixel layers (8/16-bit RGB, CMYK), opacity, visibility, locking and blend modes, at the document's resolution in points. Effects, adjustments, brushes and pressure profiles, transparency gradients, master pages, symbol instances (imported as their cached picture), special shapes (cloud, heart, cog…, imported as ellipses) and Affinity-only blend modes are named in the import warning. A file whose native data can't be read opens as its embedded preview with the reason, and that preview can't be placed. Save never writes back over the Affinity file and there is no Affinity export. AF.5 (from DesignCraft's import, storytold/designcraft#291) adds master pages (on a locked layer behind the pages that show them), tables (area type per cell and a line per edge), each paragraph's alignment, indents, spacing and leading, horizontal text scale, outlined text, frame text sized by its text scale, drop shadows and outer glows as live effects (inner shadows as inner glows), outline effects as strokes, colour and gradient overlays baked into the paint, embedded Affinity documents as editable content (their artboards don't become artboards), pixel layers over 64 MP at a reduced resolution and HEIC photos from their stored pixels; automatic leading (size plus the font's line gap) fitted on thumbnails; underlines and strikethrough; strokes whose style is None (every shape stores one) left out, which also brings 6 public files closer to their thumbnails; line breaks inside a paragraph; table cell text centred as Affinity centres it, also where it is taller than its cell; CMYK pixel layers converted through the document's embedded CMYK profile (relative colorimetric with black-point compensation, as each layer's colour settings name), or kept as CMYK images when there is none; outline effects on stroked shapes around their stroke; artistic text whose paragraphs align differently aligned within its longest line, a frame's first baseline at cap height, and frames whose last lines' descenders hang out made tall enough to show them (all measured on a local document's own PDF export: baselines match to 0.1 pt); a local 56-artboard document's mean thumbnail difference went from 16.2 to 11.4, and its pages' mean difference from the owner's PDF export from 12.9 to 9.3. AF.4 adds Affinity 3 artboard recognition and actual-outline clipping, source-backed JPEG/PNG raster tiles, Unicode text-run recovery, stored fallback/exact installed fonts, OpenType feature flags and compound-geometry limits. 51 public CC0/MIT/Apache-2.0 files (33 current `.af`), pinned and sha256-verified (`cargo xtask corpus --affinity`), test native retention and every-board native/SVG/PDF/PSD output for current files; selected files compare their saved thumbnails. No Affinity reopen or independent paired PSD oracle was available; [source audit and complex-font gaps](affinity-validation.md); [scope, provenance and limits](../crates/affinity/README.md).
|
||||
- `.cdr` drawings of versions 1 to 27 open and place, and `.cdt` templates open as new untitled documents. `vectorcraft-cdr` reads the `WL` files of versions 1 and 2 (one page and one layer of rectangles, whole ellipses and curves with uniform fills and outlines), the RIFF chunk tree of versions 3 on and its compressed lists, and the ZIP packages of versions 14 on with the data streams of versions 16 on, and the importer maps pages to artboards side by side, layers by name, the master page's guidelines to guides on every page, groups, clipping containers (as clipping groups), curves and paths, rectangles (live, with each corner's radius), ellipses (live), arcs and polygons, uniform fills in CMYK, CMY, RGB, gray and registration, and outlines with their width (0.25 pt for a width of 0), caps, joins and dashes (behind the fill, or scaled with the object's matrix, where the file says so), an object without a fill or outline of its own taking its style's, hidden and locked layers, groups and objects, the winding flag as the nonzero fill rule, and a uniform transparency of version 13 and later as the object's opacity and blend mode. A library color stored with its name and values (version 13 and later, in a fill or an outline) becomes a spot swatch with its tint; one stored only by its number opens as a black spot color named by its palette and number, with a warning. Text, bitmaps, blends, contours, brush strokes, fountain, pattern, texture and PostScript fills, arrowheads, lenses, other transparency and the envelopes of version 3 are left out with a warning, and encrypted, ZIP64 and split packages are refused with a message. Every record layout has a source in `crates/cdr/PROVENANCE.md`. Reading is bounded by limits on input size, inflated size, package members, nesting, chunks, objects, coordinates and dashes, where an outline's dashes count for every shape that uses it (`crates/cdr/tests/it/read.rs`, `crates/engine/src/cmd/fileio/tests_cdr.rs`, `crates/engine/tests/import_fuzz.rs`).
|
||||
- `.cmx` exchange files with 32-bit coordinates open and place: `vectorcraft-cdr` reads their color, pen, line type, dash and outline tables and each page's instructions, and the importer maps pages, layers (a layer that holds nothing is left out), groups and curves, with uniform fills and outlines, as it maps a `.cdr` drawing's. Text, images, rectangles, ellipses, clipping paths, other fills, arrowheads and lenses are named in the warnings, and big-endian files and files with 16-bit coordinates are refused with a message (`crates/cdr/tests/it/cmx.rs`, `crates/engine/src/cmd/fileio/tests_cmx.rs`, `crates/engine/tests/import_fuzz.rs`).
|
||||
- Placed documents: File › Place of a `.vectorcraft` file links to it by default (`file.place`'s `link`): one locked object showing an artboard of the document (or its art's bounds), read the way placing it without Link reads it, its symbols, patterns and images kept apart from the document's; without Link (or from bytes, not a file) it is an editable copy as before. It stays vectors in every output (SVG, PDF, EPS, EMF, DXF), and so do placed documents inside it, read from their own files up to 8 levels deep (documents that place each other stop there). On screen they draw from bitmaps cached per file and zoom step, shared by every copy and made in the background (a placeholder until ready), so a sheet of them redraws in about a millisecond; exports and prints draw them exactly. Like linked images, a save keeps only a preview of each (JPEG when opaque) unless Include Linked Files; output, and zooming past the preview, read the file again, falling back to the preview with a warning when it is gone or changed. Saves for older versions write them as plain art. Links check, update, relink, Update Links on open, Link Info (the artboard's size), Placement Options, Break Link (also Embed, Object › Expand: the editable copy placing without Link gives, its resources joining the document), Edit Original (the document in a new tab) and the Links panel cover them; saving a document updates the open documents that place it. The native format (v4) keeps data of 8 KB or more after the JSON instead of base64 in it.
|
||||
- Placed documents' bitmaps on screen: when a bitmap made in the background is ready, the desktop app renders the canvas again only where the objects that show its file are, when the frame shown was rendered on the UI thread and that part is at most half the canvas. Bitmaps drawn or made since a frame began are kept for that frame past the 512 MiB budget, up to 2 GiB, so a view showing more than the budget does not make them again in every frame. A bitmap that would take them past 2 GiB is not kept, and its file draws exactly at that zoom. A bitmap that can't be made (the file can't be read and there is no preview) shows the light placeholder and is not asked for again. Each ready bitmap used to render the whole canvas again, and bitmaps past the budget and bitmaps that could not be made were asked for again in every frame (`crates/render/src/tests/placed_document.rs`).
|
||||
- Linked PDF and `.ai` pages: File › Place with Link (the default) places a page of a PDF, `.ai` or `.ait` file read as PDF pages as a placed document, as it links an image, the page and its box (`crop`) kept with the link: Links check, update and relink it, Break Link and Object › Expand give the group placing it without Link gives, every output draws the page's vectors, and Package copies the file. Without Link, or with a password or `textAs: "outlines"`, the page is embedded. An EPS file, a PostScript file or a PostScript `.ai` placed from a file with Link is a placed document the same way, showing the art placing it without Link gives (clipped to its bounding box, or its art's bounds with `crop: "bounding"`); Links lists it as `EPS` or `PostScript`, and a save, Package, Break Link and Object › Expand treat it as they treat a placed PDF page. Package also copies the files that the native document of an EPS file written by VectorCraft links, beside the EPS file's copy, which finds them there by name. Placing one keeps the file linked rather than embedding it, as [the help page](https://helpx.adobe.com/illustrator/desktop/add-and-import-files/import-other-file-types/eps-and-dcs-file-import-in-illustrator.html) describes; a DCS file stays a linked image (`crates/engine/src/tests/placed_document.rs`, `crates/engine/src/tests/package.rs`).
|
||||
|
||||
Reference in New Issue
Block a user