Print: Japanese paper sizes (JIS B4/B5/B6, はがき・封筒・四六判)

The Print dialog's Media list only had Letter/Legal/Tabloid and the ISO A
and B papers, so Japanese papers had to be entered as a custom size, and
"B4"/"B5" were ISO 216 (250 × 353 and 176 × 250 mm) although Japanese
printing uses the JIS sizes (257 × 364 and 182 × 257 mm, JIS X 6310).

Media gains JIS B4, B5 and B6 next to the ISO ones, and はがき
(japanese postcard, 100 × 148 mm), 往復はがき (japanese double postcard,
148 × 200 mm), 封筒 長形3号/長形4号 (japanese envelope #3/#4, 120 × 235
and 90 × 225 mm), 角形2号/角形3号 (kaku #2/#3, 240 × 332 and 216 × 277 mm),
四六判 (yonroku-ban, 127 × 188 mm) and A6, all in millimetres at 72/25.4.
b4 and b5 keep their ISO 216 dimensions so print settings and presets
saved before the Japanese papers existed keep their paper; the dialog
labels say "B4 (ISO)"/"B5 (ISO)" beside "B4 (JIS)"/"B5 (JIS)".

A paper is named by its JSON id or by its dialog label, any case and
spacing ("b5 (jis)", "B5 (JIS)" and "b5jis" all mean the JIS B5), so
agents and the control channel need not know the id spelling; an unknown
name is still refused. Media is written out instead of through the
choice! macro to carry that lookup.

The print.setup/file.print parameter docs and docs/mcp.md list the new
papers; the Print dialog picks them up from Choice::ALL with no UI code
change, and the Japanese labels are translated in ja.tsv (はがき,
往復はがき, 長形3号, 長形4号, 角形2号, 角形3号, 四六判).

Tests: japanese_paper_sizes checks every added size in points, that the
ISO B4/B5 values did not change, name resolution and id/label round
trips, and that each paper prints a PDF page with its own MediaBox size.

Validation: cargo fmt --all -- --check clean; cargo clippy
-p vectorcraft-pdf --all-targets -- -D warnings clean; cargo test
-p vectorcraft-pdf -> 330 passed, 0 failed (328 lib + 2 integration).
This commit is contained in:
Midasdf
2026-10-21 23:32:26 +07:00
committed by bflatastic
parent 84d5d8797f
commit 32d012f6cc
8 changed files with 244 additions and 22 deletions
+3 -1
View File
@@ -9,7 +9,7 @@
**Stage: alpha** · next: beta, ~13 points (ready for real work ~62% → ~75%, and reliable `.ai` exchange) and ~170–270 h away
> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-19 · **Change:** minor (about 90 community PRs of 2026-10-19: Objects on Path, the Simplify slider, Pencil Edit Selected Paths in the middle of a path, Georgian, and more; Background Export progress dialog with Cancel, #2564; about 85 community PRs of 2026-10-18: Justification…, Word .docx placed as area type, CCITT Group 3 TIFF, Roman Hanging Punctuation, blend spines edited with the Anchor Point tool, shadows and glows in stack order, coloured 3D lights, a Dutch catalog completed; 3D lighting: one to ten colored lights, smooth colored Inflate, legacy white-light appearance preserved; surface batching and restored seam minimum; scores and estimates unchanged; about 145 community PRs of 2026-10-17: image-decode overflow guards, opaque floating panels, MCP export cancel and progress, editable Illustrator EPS import, scoped `doc_inspect`, Dutch, Danish and Indonesian, Simplified Chinese messages, screen-reader names; headline numbers unchanged; about 160 community PRs of 2026-10-15/16: PDF import crash fixes, Dimension tool, legacy `.ai` save, Intertwine, web pen input, Image Trace fixes, `.ai`/EPS/PDF import fidelity, Bulgarian, Greek, Swedish and Finnish catalogs; headline numbers unchanged) · **Target:** Adobe Illustrator 2026 (30.x)
> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-21 · **Change:** minor (Print: Japanese paper sizes in the Print dialog's Media list — JIS B4 257 × 364 mm, JIS B5 182 × 257 mm and JIS B6 128 × 182 mm beside the ISO B4/B5 (which keep their ISO 216 sizes), はがき, 往復はがき, 封筒 長形3号/長形4号/角形2号/角形3号 and 四六判; about 90 community PRs of 2026-10-19: Objects on Path, the Simplify slider, Pencil Edit Selected Paths in the middle of a path, Georgian, and more; Background Export progress dialog with Cancel, #2564; about 85 community PRs of 2026-10-18: Justification…, Word .docx placed as area type, CCITT Group 3 TIFF, Roman Hanging Punctuation, blend spines edited with the Anchor Point tool, shadows and glows in stack order, coloured 3D lights, a Dutch catalog completed; 3D lighting: one to ten colored lights, smooth colored Inflate, legacy white-light appearance preserved; surface batching and restored seam minimum; scores and estimates unchanged; about 145 community PRs of 2026-10-17: image-decode overflow guards, opaque floating panels, MCP export cancel and progress, editable Illustrator EPS import, scoped `doc_inspect`, Dutch, Danish and Indonesian, Simplified Chinese messages, screen-reader names; headline numbers unchanged; about 160 community PRs of 2026-10-15/16: PDF import crash fixes, Dimension tool, legacy `.ai` save, Intertwine, web pen input, Image Trace fixes, `.ai`/EPS/PDF import fidelity, Bulgarian, Greek, Swedish and Finnish catalogs; headline numbers unchanged) · **Target:** Adobe Illustrator 2026 (30.x)
VectorCraft is a clean-room, open-source, pure-Rust reimplementation of the Adobe Illustrator workflow. It runs
on macOS, Windows, Linux, FreeBSD and the web (WASM), and agents can drive all of it over MCP, the CLI and a JSON
@@ -134,6 +134,7 @@ Ranked; detail in [docs/roadmap.md](docs/roadmap.md) and [docs/gaps.md](docs/gap
| Date | What landed |
|---|---|
| 2026-10-21 | Print: the Print dialog's Media list has the Japanese papers — JIS B4 (257 × 364 mm), JIS B5 (182 × 257 mm) and JIS B6 next to the ISO B4/B5 (which keep their ISO 216 dimensions for settings saved before them), はがき 100 × 148 mm, 往復はがき 148 × 200 mm, 封筒 長形3号 120 × 235 mm / 長形4号 90 × 225 mm / 角形2号 240 × 332 mm / 角形3号 216 × 277 mm and 四六判 127 × 188 mm. A paper is named by its JSON id or its dialog label, any case and spacing (`B5 (JIS)` or `b5jis`), and every added size prints as its own PDF page size. Headline numbers unchanged. |
| 2026-10-18 | Inch rulers divide the inch in half, not in ten. Zooming in stepped an inch ruler through 0.2, 0.1 and 0.05 of an inch, marks an inch ruler does not carry; below an inch the steps are binary fractions now, 1/2 down to 1/16, with the unlabelled ticks between them binary too (down to 1/128, so the 32nds, 64ths and 128ths appear as the report expects), while the metric units, points, pixels and picas keep their tenths. A label carries the decimals its step needs, so a sixteenth reads 0.0625 rather than the rounded 0.06, with trailing zeros dropped (#2827). Headline numbers unchanged. |
| 2026-10-18 | Exported and saved files can repeat their bytes: PNG, PDF, EPS, legacy `.ai`, packaged zips and `.vectorcraft` saves recorded the wall-clock time they were made in, so the same commands run twice gave different bytes though the pixels matched. `SOURCE_DATE_EPOCH` now stands in for the clock in everything a file records, as the reproducible-builds specification defines it; a date a command is given still wins, and a malformed value is ignored rather than refusing the export. The recovery heartbeat and the seed PDF encryption draws on keep the real clock, so a password-protected PDF still differs between runs (#2880). Headline numbers unchanged. |
| 2026-10-18 | About 85 community PRs landed in two batches through the full gate, with our fixes on top. New: Word `.docx` files place as area type with their formatting (#2766), CCITT Group 3 TIFF files open (#2770), Paragraph panel menu › Roman Hanging Punctuation (#2775), the Anchor Point tool edits blend spine points and handles (#2643, fixes #2544), shadows and glows each draw from the art with the effects before them, without the old exponential cost (#2395), one to ten coloured lights in 3D effects (#2706), Artboard Options X and Y with a reference point (#2739), more Contextual Task Bar actions (#2471), Optical Margin Alignment for a whole thread (#2773), History panel Step Backward/Forward and Set History Limit (#2764), Edit › Undo and Redo name the step as the History panel does (#2774), bounding-box handles snap to the grid, pixels and guides (#2715), Ctrl/Cmd+A in the Artboards panel (#2761), Tabs panel menu items (#2742), Import Data Sets defines variables from header cells (#2736), a Linux option to use X11 when a pen is attached (#2717). Fidelity and robustness: variable fonts named by their default weight and fallback glyphs keep bold and italic (#2733, #2732), legacy `.ai` layer names in Windows Latin-1 (#2722), WMF window mapping (#2721), Magic Wand inside isolation (#2720), type values out of range in files are clamped (#2728, #2757), raster effects stay responsive in drags (#2745), exports and Save for Web report undecodable images (#2762, #2737, #2684), Windows-safe exported file names (#2738), a marquee skips a Shaper Group's originals (#2772). Second batch: an export progress dialog with Cancel on the shared cancel token (#2564), CMYK gradient meshes drawn several times faster within a 16 MB cap (#2802), Paragraph panel menu › Justification… with file values clamped (#2771), Edit › Clear History (#2843), SVG image links keep their spelling (#2837, fixes main's Windows test failures), the Linux save dialog through the XDG portal (#2783), RGB input stored as CMYK in CMYK documents (#2812), legacy `.ai` export of images and radial highlights (#2801, #2807), `.ai` import notes for damaged editing data, page sizes and variable libraries (#2799, #2800, #2842), PDF and `.ai` keep their creation date (#2838), undecodable images left out of PDF exports with a note (#2790), MCP input waits for queue room (#2776), slice, snapping, selection, type and accessibility fixes (#2794–#2797, #2805, #2806, #2809, #2815, #2844–#2846), dropdowns close after a keyboard pick (#2824), plug-in dialogs scroll (#2840). Languages: the Dutch catalog completed (#2730). Headline numbers unchanged (estimated). |
@@ -185,6 +186,7 @@ The full pre-standard record of what landed is kept in [docs/roadmap.md](docs/ro
| Date | Change | Summary |
|---|---|---|
| 2026-10-21 | minor | Print: Japanese paper sizes in the Print dialog's Media list (JIS B4/B5/B6, はがき, 往復はがき, 封筒 長形3号/長形4号/角形2号/角形3号, 四六判); ISO B4/B5 keep their sizes, and a paper is named by id or label, any case and spacing. Headline numbers unchanged. |
| 2026-10-17 | minor | Colored Inflate: shared membrane normals and smooth RGB vector ramps replace flat polygon bands; channel groups are batched per solid-fill surface. White-light Inflate retains its original polygons, paint composition and seam joins; the 0.05 seam minimum is restored. Scores and hour estimates unchanged. |
| 2026-10-16 | minor | 3D lighting: one to ten directional lights, a selectable light list, Add Light and Delete Light, independent settings and artboard gestures; ambient applied once and smooth RGB vector export; scores and hour estimates unchanged |
| 2026-10-16 | minor | 3D lighting: opaque RGB Color for the shared directional light, with neutral ambient, preview/reset controls and smooth vector Revolve shading; scores and hour estimates unchanged |
+1 -1
View File
@@ -22,7 +22,7 @@ pub fn specs() -> Vec<CommandSpec> {
"Print Setup",
[],
None,
"{preset?: name ([Default] or a saved print preset, any case: print.presets.list; its settings replace the document's, as choosing it in the Print dialog does), settings?: {copies: 1 (1–999), collate: true, reverse, artboards: all|range|ignore (all the art as one page), range: \"1-3, 5\" (1-based, with artboards: range), skipBlank (leave out artboards with no art that prints), media: letter|legal|tabloid|a3|a4|a5|b4|b5|custom, width, height (custom paper, 72–14400 pt), orientation: portrait|landscape|portraitFlipped|landscapeFlipped, autoRotate: true (turn the paper to each artboard; orientation ignored), transverse (the page a quarter turn on the paper), printLayers: visiblePrintable|visible|all (template layers never print), placement: {origin: topLeft|top|topRight|left|center|right|bottomLeft|bottom|bottomRight (the point of the printed area, the artboard with its bleed and marks, on the same point of the imageable area), x, y (pt, right and down)}, scaling: none|fit|custom|tileFull|tileImageable, scale: {width: 100, height: 100} (% with custom and tiling), overlap: 0 (pt between tiles), tileRange: \"\" (1-based tiles across then down; empty: all), margin: 0 (pt the device can't print around the paper: the imageable area is inside it), marks: {trim, registration, colorBars, pageInfo, kind: roman|japanese, weight: 0.25, offset: 6} (as document.exportPdf, at the paper's scale; page information adds the tile and the ink), bleed: {useDocument: true (the document's bleed, document.setup), top, bottom, left, right} (pt), output: {mode: composite|separations (one grey page per ink that prints), emulsion: up|down (down mirrors), image: positive|negative, spotsToProcess, inks: [{name: \"Cyan\"|…|a spot swatch, print: true, frequency (lpi, default 60), angle (default C 15, M 75, Y 0, K 45, spots 45)}]}, graphics: {autoFlatness: true, flatness: 1 (0.2–100), fonts: none|subset|complete}, color: {intent: perceptual|relativeColorimetric|saturation|absoluteColorimetric, preserveNumbers: true (CMYK colours keep their values), profile: \"\" (the printer profile, an RGB or CMYK one: composite PDF colours are converted to it with the intent, separations separate with a CMYK one; empty: as they are)}, advanced: {printAsBitmap (composite pages print as one image each, at the document's raster effects resolution), overprints: preserve|discard|simulate (composite output; preserve writes them to overprint (/OP), simulate prints them as Overprint Preview shows them; separations always keep them), flattenerPreset: \"\" (a flattener preset, built-in or saved: transparency is flattened before printing; empty: it prints live; PostScript defaults to medium)}, tileOrigin: {placed: false, x, y} (where the Print Tiling tool put the pages: print.tiling.set)}} store the print settings with the document, over the ones it has or the preset's (null keeps a value), as one undo step; no settings or preset → {settings} (the current ones, defaults if never set up)",
"{preset?: name ([Default] or a saved print preset, any case: print.presets.list; its settings replace the document's, as choosing it in the Print dialog does), settings?: {copies: 1 (1–999), collate: true, reverse, artboards: all|range|ignore (all the art as one page), range: \"1-3, 5\" (1-based, with artboards: range), skipBlank (leave out artboards with no art that prints), media: letter|legal|tabloid|a3|a4|a5|a6|b4|b5|b4 (jis)|b5 (jis)|b6 (jis)|japanese postcard|japanese double postcard|japanese envelope #3|japanese envelope #4|kaku #2|kaku #3|yonroku-ban|custom (a paper is named by its id or its dialog label, any case and spacing, so `B5 (JIS)` works; b4 and b5 stay the ISO 216 sizes, 250 × 353 and 176 × 250 mm, and the JIS sizes are b4 (jis) 257 × 364 mm, b5 (jis) 182 × 257 mm and b6 (jis) 128 × 182 mm), width, height (custom paper, 72–14400 pt), orientation: portrait|landscape|portraitFlipped|landscapeFlipped, autoRotate: true (turn the paper to each artboard; orientation ignored), transverse (the page a quarter turn on the paper), printLayers: visiblePrintable|visible|all (template layers never print), placement: {origin: topLeft|top|topRight|left|center|right|bottomLeft|bottom|bottomRight (the point of the printed area, the artboard with its bleed and marks, on the same point of the imageable area), x, y (pt, right and down)}, scaling: none|fit|custom|tileFull|tileImageable, scale: {width: 100, height: 100} (% with custom and tiling), overlap: 0 (pt between tiles), tileRange: \"\" (1-based tiles across then down; empty: all), margin: 0 (pt the device can't print around the paper: the imageable area is inside it), marks: {trim, registration, colorBars, pageInfo, kind: roman|japanese, weight: 0.25, offset: 6} (as document.exportPdf, at the paper's scale; page information adds the tile and the ink), bleed: {useDocument: true (the document's bleed, document.setup), top, bottom, left, right} (pt), output: {mode: composite|separations (one grey page per ink that prints), emulsion: up|down (down mirrors), image: positive|negative, spotsToProcess, inks: [{name: \"Cyan\"|…|a spot swatch, print: true, frequency (lpi, default 60), angle (default C 15, M 75, Y 0, K 45, spots 45)}]}, graphics: {autoFlatness: true, flatness: 1 (0.2–100), fonts: none|subset|complete}, color: {intent: perceptual|relativeColorimetric|saturation|absoluteColorimetric, preserveNumbers: true (CMYK colours keep their values), profile: \"\" (the printer profile, an RGB or CMYK one: composite PDF colours are converted to it with the intent, separations separate with a CMYK one; empty: as they are)}, advanced: {printAsBitmap (composite pages print as one image each, at the document's raster effects resolution), overprints: preserve|discard|simulate (composite output; preserve writes them to overprint (/OP), simulate prints them as Overprint Preview shows them; separations always keep them), flattenerPreset: \"\" (a flattener preset, built-in or saved: transparency is flattened before printing; empty: it prints live; PostScript defaults to medium)}, tileOrigin: {placed: false, x, y} (where the Print Tiling tool put the pages: print.tiling.set)}} store the print settings with the document, over the ones it has or the preset's (null keeps a value), as one undo step; no settings or preset → {settings} (the current ones, defaults if never set up)",
has_doc,
setup
),
+158 -15
View File
@@ -5,7 +5,7 @@
use serde::{Deserialize, Serialize};
use vectorcraft_color::cms::{self, Intent, ProfileKind};
use crate::settings::{choice, within};
use crate::settings::{Choice, choice, within};
use crate::{BleedSettings, MarkSettings, PdfError};
choice! {
@@ -19,20 +19,41 @@ choice! {
} default All
}
choice! {
/// The paper (portrait sizes; [`Media::Custom`] is [`PrintSettings::width`] ×
/// [`PrintSettings::height`]).
Media {
Letter = "letter", "Letter";
Legal = "legal", "Legal";
Tabloid = "tabloid", "Tabloid";
A3 = "a3", "A3";
A4 = "a4", "A4";
A5 = "a5", "A5";
B4 = "b4", "B4";
B5 = "b5", "B5";
Custom = "custom", "Custom";
} default Letter
/// The paper (portrait sizes; [`Media::Custom`] is [`PrintSettings::width`] ×
/// [`PrintSettings::height`]).
///
/// `B4` and `B5` keep their ISO 216 dimensions (250 × 353 mm and 176 × 250 mm) so settings saved
/// before the Japanese papers existed keep their paper, and their dialogs say "(ISO)". Japanese
/// printing uses the JIS sizes, which are separate choices: `b4 (jis)` 257 × 364 mm, `b5 (jis)`
/// 182 × 257 mm and `b6 (jis)` 128 × 182 mm. The other Japanese papers are はがき
/// (`japanese postcard`, 100 × 148 mm), 往復はがき (`japanese double postcard`, 148 × 200 mm),
/// 封筒 長形3号/長形4号/角形2号/角形3号 and 四六判 (`yonroku-ban`, 127 × 188 mm).
///
/// Written out rather than through the `choice!` macro because a paper also comes from a person:
/// [`Media::from_name`] accepts a JSON id or a dialog label, any case and spacing.
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
pub enum Media {
#[default]
Letter,
Legal,
Tabloid,
A3,
A4,
A5,
B4,
B5,
A6,
B4Jis,
B5Jis,
B6Jis,
JapanesePostcard,
JapaneseDoublePostcard,
JapaneseEnvelope3,
JapaneseEnvelope4,
Kaku2,
Kaku3,
YonrokuBan,
Custom,
}
impl Media {
@@ -46,11 +67,133 @@ impl Media {
Self::A3 => mm(297.0, 420.0),
Self::A4 => mm(210.0, 297.0),
Self::A5 => mm(148.0, 210.0),
Self::A6 => mm(105.0, 148.0),
// ISO 216.
Self::B4 => mm(250.0, 353.0),
Self::B5 => mm(176.0, 250.0),
// JIS B (JIS X 6310): the Japanese B sizes print a little larger than ISO's.
Self::B4Jis => mm(257.0, 364.0),
Self::B5Jis => mm(182.0, 257.0),
Self::B6Jis => mm(128.0, 182.0),
// はがき, 往復はがき, 封筒 長形3号/長形4号, 角形2号/角形3号, 四六判.
Self::JapanesePostcard => mm(100.0, 148.0),
Self::JapaneseDoublePostcard => mm(148.0, 200.0),
Self::JapaneseEnvelope3 => mm(120.0, 235.0),
Self::JapaneseEnvelope4 => mm(90.0, 225.0),
Self::Kaku2 => mm(240.0, 332.0),
Self::Kaku3 => mm(216.0, 277.0),
Self::YonrokuBan => mm(127.0, 188.0),
Self::Custom => None,
}
}
/// The paper an id or a dialog label names, ignoring case and anything but letters and digits:
/// `"b5 (jis)"`, `"B5 (JIS)"` and `"b5jis"` all mean [`Media::B5Jis`], and `"b5"` stays the ISO
/// size that settings and presets already use. `None` for a name that is no paper.
pub fn from_name(name: &str) -> Option<Self> {
let norm = |s: &str| s.chars().filter(char::is_ascii_alphanumeric).map(|c| c.to_ascii_lowercase()).collect::<String>();
let n = norm(name);
if n.is_empty() {
return None;
}
let at = |names: &'static [&'static str]| names.iter().position(|name| norm(name) == n);
at(Self::IDS).or_else(|| at(Self::LABELS)).and_then(|i| Self::ALL.get(i).copied())
}
}
impl Choice for Media {
const ALL: &'static [Self] = &[
Self::Letter,
Self::Legal,
Self::Tabloid,
Self::A3,
Self::A4,
Self::A5,
Self::B4,
Self::B5,
Self::A6,
Self::B4Jis,
Self::B5Jis,
Self::B6Jis,
Self::JapanesePostcard,
Self::JapaneseDoublePostcard,
Self::JapaneseEnvelope3,
Self::JapaneseEnvelope4,
Self::Kaku2,
Self::Kaku3,
Self::YonrokuBan,
Self::Custom,
];
const IDS: &'static [&'static str] = &[
"letter",
"legal",
"tabloid",
"a3",
"a4",
"a5",
"b4",
"b5",
"a6",
"b4 (jis)",
"b5 (jis)",
"b6 (jis)",
"japanese postcard",
"japanese double postcard",
"japanese envelope #3",
"japanese envelope #4",
"kaku #2",
"kaku #3",
"yonroku-ban",
"custom",
];
const LABELS: &'static [&'static str] = &[
"Letter",
"Legal",
"Tabloid",
"A3",
"A4",
"A5",
"B4 (ISO)",
"B5 (ISO)",
"A6",
"B4 (JIS)",
"B5 (JIS)",
"B6 (JIS)",
"Japanese Postcard",
"Japanese Double Postcard",
"Japanese Envelope #3",
"Japanese Envelope #4",
"Kaku #2",
"Kaku #3",
"Yonroku-ban",
"Custom",
];
}
impl Media {
/// The label shown in the Print dialogs.
pub fn label(self) -> &'static str {
Self::ALL.iter().position(|m| *m == self).and_then(|i| Self::LABELS.get(i)).copied().unwrap_or_default()
}
/// The JSON id.
pub fn id(self) -> &'static str {
Self::ALL.iter().position(|m| *m == self).and_then(|i| Self::IDS.get(i)).copied().unwrap_or_default()
}
}
impl Serialize for Media {
fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
serializer.serialize_str(self.id())
}
}
impl<'de> Deserialize<'de> for Media {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use serde::de::Error as _;
let name = String::deserialize(deserializer)?;
Self::from_name(&name).ok_or_else(|| D::Error::custom(format!("unknown paper `{name}` ({})", Self::IDS.join("|"))))
}
}
choice! {
+69
View File
@@ -101,6 +101,75 @@ fn defaults_and_json() {
assert_eq!(Media::A4.size().map(|(w, h)| (w.round(), h.round())), Some((595.0, 842.0)));
}
#[test]
fn japanese_paper_sizes() {
// The Japanese papers: JIS B4, B5 and B6 are the sizes Japanese printing uses (JIS X 6310),
// a little larger than ISO's; the others are はがき, 往復はがき, 封筒 and 四六判.
let near = |m: Media, w: f64, h: f64| {
let (mw, mh) = m.size().unwrap();
assert!((mw - w).abs() < 0.01 && (mh - h).abs() < 0.01, "{m:?} is {mw} × {mh}, not {w} × {h}");
};
near(Media::B4Jis, 728.50, 1031.81);
near(Media::B5Jis, 515.91, 728.50);
near(Media::B6Jis, 362.83, 515.91);
near(Media::A6, 297.64, 419.53);
near(Media::JapanesePostcard, 283.46, 419.53);
near(Media::JapaneseDoublePostcard, 419.53, 566.93);
near(Media::JapaneseEnvelope3, 340.16, 666.14);
near(Media::JapaneseEnvelope4, 255.12, 637.80);
near(Media::Kaku2, 680.31, 941.10);
near(Media::Kaku3, 612.28, 785.20);
near(Media::YonrokuBan, 360.0, 532.91);
// The ISO B sizes keep the dimensions settings and presets saved before the Japanese papers
// existed: they are not the JIS sizes.
near(Media::B4, 708.66, 1000.63);
near(Media::B5, 498.90, 708.66);
// A paper is named by its JSON id or its dialog label, any case and spacing.
for (name, want) in [
("b4 (jis)", Media::B4Jis),
("B4 (JIS)", Media::B4Jis),
("b4jis", Media::B4Jis),
("b5", Media::B5),
("B5 (ISO)", Media::B5),
("b5 (jis)", Media::B5Jis),
("japanese postcard", Media::JapanesePostcard),
("Japanese Postcard", Media::JapanesePostcard),
("Japanese Envelope #3", Media::JapaneseEnvelope3),
("kaku #2", Media::Kaku2),
("yonroku-ban", Media::YonrokuBan),
] {
assert_eq!(Media::from_name(name), Some(want), "{name}");
}
assert_eq!(Media::from_name("b7"), None);
assert_eq!(Media::from_name(" "), None);
for m in Media::ALL {
assert_eq!(Media::from_name(m.id()), Some(*m), "id {:?}", m.id());
assert_eq!(Media::from_name(m.label()), Some(*m), "label {:?}", m.label());
assert_eq!(serde_json::to_value(m).unwrap(), json!(m.id()));
assert_eq!(serde_json::from_value::<Media>(json!(m.id())).unwrap(), *m);
}
assert!(serde_json::from_value::<Media>(json!("b7")).is_err(), "an unknown paper is refused");
// Every paper prints as a page of its own size, the added ones included.
let d = doc(50.0, 50.0, &[(Rect::new(0.0, 0.0, 50.0, 50.0), rgb(0.0, 0.0, 0.0))]);
for (media, w, h) in [
("japanese postcard", 283.46, 419.53),
("japanese double postcard", 419.53, 566.93),
("B5 (JIS)", 515.91, 728.50),
("kaku #2", 680.31, 941.10),
("yonroku-ban", 360.0, 532.91),
// The ISO B sizes keep their page size.
("b5", 498.90, 708.66),
] {
let r = job(&d, json!({"media": media, "autoRotate": false}));
assert_eq!(r.pages, 1, "{media}");
let p = pages(&r.bytes);
assert_eq!(p.len(), 1, "{media}");
assert!((p[0].0.0 - w).abs() < 0.01 && (p[0].0.1 - h).abs() < 0.01, "{media}: {:?}, not {w} × {h}", p[0].0);
}
}
#[test]
fn fit_to_letter_scales_the_artboard_into_the_paper() {
// Twice Letter, landscape, a red square in its top-left quarter.
+7
View File
@@ -4987,3 +4987,10 @@ lighting Light ライト
Note Paper ノート用紙
Water Paper… ぬれた紙…
Water Paper ぬれた紙
Japanese Postcard はがき
Japanese Double Postcard 往復はがき
Japanese Envelope #3 長形3号
Japanese Envelope #4 長形4号
Kaku #2 角形2号
Kaku #3 角形3号
Yonroku-ban 四六判
Can't render this file because it contains an unexpected character in line 2 and column 73.
+1 -1
View File
@@ -3266,7 +3266,7 @@ a value). `list_commands` with filter `print.setup`
documents every field:
- General: `copies` (1–999), `collate`, `reverse`; `artboards: all|range|ignore` with `range: "1-3, 5"` (ignore: all
the art as one page), `skipBlank`; `media: letter|legal|tabloid|a3|a4|a5|b4|b5|custom` (`width`, `height` in pt),
the art as one page), `skipBlank`; `media: letter|legal|tabloid|a3|a4|a5|a6|b4|b5|b4 (jis)|b5 (jis)|b6 (jis)|japanese postcard|japanese double postcard|japanese envelope #3|japanese envelope #4|kaku #2|kaku #3|yonroku-ban|custom` (`width`, `height` in pt; a paper is named by its id or its dialog label, any case and spacing, so `B5 (JIS)` works; `b4` and `b5` stay ISO 216 and the JIS sizes are `b4 (jis)`, `b5 (jis)` and `b6 (jis)`),
`orientation`, `autoRotate` (on by default: the paper turns to each artboard), `transverse`; `printLayers:
visiblePrintable|visible|all` (template layers never print); `placement: {origin, x, y}` places the printed area
(artboard, bleed and marks) on the imageable area (the paper inside `margin`); `scaling: none|fit|custom|tileFull|
+1 -1
View File
@@ -15,7 +15,7 @@ Overlap repeats part of the drawing on adjacent sheets to help you align them af
3. In **General**, under **Artboards**, choose **All** or **Range:** to select the artboards to print.
For example, use **Range:** `1` for the first artboard. Choose **Ignore Artboards (all the art as
one page)** only if you want to tile the bounds of all the artwork instead of individual artboards.
4. Under **Media**, set **Size** to the paper loaded in the printer, such as **A4** or **Letter**.
4. Under **Media**, set **Size** to the paper loaded in the printer, such as **A4**, **Letter** or a Japanese paper (**B5 (JIS)**, **Japanese Postcard**, **Japanese Envelope #3**).
Choose **Custom** to enter **Width** and **Height**. **Auto-Rotate (turn the paper to each artboard)**
is on by default; turn it off to choose a fixed **Orientation**, such as **Portrait** or **Landscape**.
5. In **Advanced**, set **Unprintable margin** to allow for the edges your printer cannot print.
File diff suppressed because one or more lines are too long