Plot: JIS B4/B5/B6 and Japanese paper sizes (はがき・封筒・四六判) (#1810)

* Plot: JIS B4/B5/B6 and Japanese paper sizes

Japanese drafting uses the JIS B series: B4 257×364 mm, B5 182×257 mm and
B6 128×182 mm. The paper table only had the ISO sizes, so a JIS B5 drawing
plotted about 7 mm short in each direction. B4/B5/B6 are now the JIS sizes (the
names Japanese Excel and drawings use) and the ISO ones stay reachable as
`B4 (ISO)`/`B5 (ISO)`; a drawing that stored the ISO sheet keeps its stored
size, and a caller that means ISO B5 says so.

Adds the Japanese papers the table lacked: Japanese Postcard (はがき,
100×148 mm), Japanese Double Postcard (往復はがき, 148×200 mm), Japanese
Envelope #3 (長形3号, 120×235 mm), Japanese Envelope Kaku #2 (角形2号,
240×332 mm) and 四六判 (127×188 mm). A6 was already an ISO sheet.

Paper names resolve case-insensitively and ignore spaces, hyphens, underscores
and parentheses (`B5 (JIS)`, `b5-jis`, `b5jis`), with the Japanese spellings as
aliases too (`はがき`, `往復はがき`, `長形3号`, `角形2号`, `四六判`). The
built-in plotters and the Page Setup/Plot paper combo pick the new sizes up
from PAPER_SIZES, and the PDF plot's MediaBox and the plot preview use them.

Tests: the render paper test pins every new size and alias, the ISO sizes keep
their values and the unknown-name fallback is unchanged; a new io test pins the
PDF MediaBox for each new paper (JIS B5 515.91×728.50 pt, はがき 283.46×419.53 pt,
ISO B4/B5 and the rest), and the plot-preview test checks that `B5` resolves to
JIS B5 and `B5 (ISO)` to ISO B5.

Docs: docs/plotters.md standard sizes and the `pagesetup`/PDFBOOK parameter
notes, and ROADMAP.md progress log + revision history, dated 2026-10-21.

* Plot: B4/B5/B6 stay ISO; JIS sizes by explicit name

Review follow-up: making the bare names mean JIS changed the ISO sizes for
every user. `B4`/`B5` are the ISO sizes again, an ISO B6 row (125×176 mm)
completes the bare series, and the JIS sheets (JIS P 0138, 257×364,
182×257 and 128×182 mm) are reachable only as `B4 (JIS)`/`JIS B4`,
`B5 (JIS)`/`JIS B5` and `B6 (JIS)`/`JIS B6`.

Drop the ambiguous bare `Postcard` and `Double Postcard` aliases; the name
and はがき/往復はがき say which postcard is meant. Drop the ROADMAP.md edit
(ROADMAP.md stays at origin/main's content).

The render and io paper tests, the plot-preview test and docs/plotters.md
follow the new mapping; the Japanese stationery sizes and their はがき/
往復はがき/長形3号/角形2号/四六判 spellings are unchanged.

Still safe for stored papers: a page setup keeps the canonical paper name
with its width/height, DXF groups 44/45 round-trip those sizes, and the ISO
canonical names (and the JIS rows by name) did not change.

* Plot: full-width paper names resolve like their ASCII forms

A Japanese keyboard or IME gives B5 (JIS); fold U+FF01..U+FF5E to ASCII (and the
ideographic space to a space) before the existing normalisation, with a test.

---------

Co-authored-by: midasdf <midasdf@tutamail.com>
This commit is contained in:
midasdf
2026-11-30 03:40:20 +01:00
committed by GitHub
co-authored by midasdf
parent cb12bc7984
commit 758dc4e805
6 changed files with 194 additions and 12 deletions
+14 -3
View File
@@ -16,12 +16,23 @@ The built-in devices come first:
They offer the standard sizes:
- ISO 216 A0–A6 and B0–B5
- ISO 216 A0–A6 and B0–B6
- JIS B4–B6 (JIS P 0138) by explicit name: `B4 (JIS)`/`JIS B4`, `B5 (JIS)`/`JIS B5` and
`B6 (JIS)`/`JIS B6` (257×364, 182×257 and 128×182 mm). The bare `B4`/`B5`/`B6` stay the ISO
sizes (250×353, 176×250 and 125×176 mm)
- Japanese stationery: Japanese Postcard (はがき, 100×148 mm), Japanese Double Postcard (往復はがき,
148×200 mm), Japanese Envelope #3 (長形3号, 120×235 mm), Japanese Envelope Kaku #2 (角形2号,
240×332 mm) and 四六判 (127×188 mm)
- ANSI A–E and Legal
- ARCH A–E and E1
ISO sheets have 5 mm margins. Inch sheets have quarter-inch (6.35 mm) margins. A page setup
with the device `None` plots to PDF on the page setup's paper, as before.
Metric sheets (ISO and JIS) have 5 mm margins, inch sheets have quarter-inch (6.35 mm) margins.
A page setup with the device `None` plots to PDF on the page setup's paper, as before. Paper names
resolve case-insensitively and ignore spaces, hyphens and parentheses (`B5 (JIS)`, `b5-jis`,
`はがき`).
`B4`/`B5` keep meaning the ISO sizes, so a drawing or caller that used them doesn't change; a plot
that means JIS B4/B5 says `B4 (JIS)`/`B5 (JIS)`. A drawing keeps the sheet size it stored.
User devices are files in our own format, kept in the `plotters` folder of the CADCraft
settings directory: