w3c / csswg-drafts

CSS Working Group Editor Drafts
https://drafts.csswg.org/
Other
4.42k stars 647 forks source link

[css-page] Additional Standard Paper Keywords for (page-)size #4722

Open Crissov opened 4 years ago

Crissov commented 4 years ago

This is a consolidated and updated revision of #328 from mid-2016. When @fantasai closed that issue by editor discretion, she said:

I agree with [@frivoal] that unless there is specific demand for certain keywords, we should not add them pre-emptively.

I shall show that there is specific demand for certain keywords, in the fist section below.

Moreover, although not recorded explicitly and lacking a WG decision, there appears to have been somewhat of a consensus back then that keywords should be added to CSS for
commonly used sizes with
standardized identifiers and
hard to remember dimensions.
I shall document those as well, in the second section below.

Interoperability for International Sheet and Envelope Sizes

TL;DR: Add all missing keywords for standard paper sizes in the ISO 216 A and B series, the ISO 269 C series and the JIS P 0138 B series:

While web browser developers may seem less than keen to invest more resources in css-page than absolutely necessary, there are several applications specializing in CSS-driven PDF creation which strongly rely on this particular Module and may wish to extend its capabilities. The W3C should care about harmonizing their use of CSS to ease interchange and thereby making manuscripts more universal.

WeasyPrint and Vivliostyle support all currently standardized keywords for size (or page-size in the future) standardized by CSS in level 3: A3, A4, A5, B4, B5, JIS-B4, JIS-B5 (and American Letter, Legal, Ledger). Their open source code shows that it would be ridiculously simple to add more named sizes. wkhtmltopdf uses plain headless Qt Webkit and relies on its capabilities. Addendum: paged.js seems to add all of the A series (although A8 and A9 are undocumented).

Existing implementations from PDF Reactor, Prince and Antenna House support more than those specified keywords, but they use partially incompatible custom keywords for the same physical sizes. In one case, there are three different custom keywords for the same size: ANSI-C, C and Broadsheet for 17in 22in. This hinders stylesheet interchange – avoiding this is prime motivation for standardization.

However, at least two existing implementations agree on keywords and definitions of all ISO 216 formats. Since ISO paper sizes result from an irrational aspect ratio of √2:1 and an integer base area, A(A0) = 1 m², their odd edge lengths are hard to remember exactly. Their popularity, stability, ease of implementation and the difficulty of using their numeric values, makes them ideal candidates to add.

In the following table, the custom keywords already supported by implementations are highlighted if they are identical to the proposed keyword. In particular, the ISO- prefix supported by Antenna House in aliases shall not be adopted.

Proposal Size CSS Prince, PDF Reactor Antenna House
A10 26mm 37mm A10
C10 28mm 40mm C10
B10 31mm 44mm B10
A9 37mm 52mm A9
C9 40mm 57mm C9
B9 44mm 62mm B9
A8 52mm 74mm A8
C8 57mm 81mm C8
B8 62mm 88mm B8
A7 74mm 105mm A7
C7 81mm 114mm C7
B7 88mm 125mm B7
A6 105mm 148mm A6 A6
C6 114mm 162mm C6 ISO-C6
B6 125mm 176mm B6 ISO-B6, B6
A5 148mm 210mm A5 A5 A5
C5 162mm 229mm C5 ISO-C5
B5 176mm 250mm B5 B5 ISO-B5, B5
A4 210mm 297mm A4 A4 A4
C4 229mm 324mm C4 ISO-C4
B4 250mm 353mm B4 B4 ISO-B4, B4
A3 297mm 420mm A3 A3 A3
C3 324mm 458mm C3 ISO-C3
B3 353mm 500mm B3
A2 420mm 594mm A2
C2 458mm 648mm C2
B2 500mm 707mm B2
A1 594mm 841mm A1
C1 648mm 917mm C1
B1 707mm 1000mm B1
A0 841mm 1189mm A0
C0 917mm 1297mm C0
B0 1000mm 1414mm B0

Usability for common, standardized, odd-valued Page Sizes

TL;DR: Optionally, add keywords for the standard paper sizes in ISO 217 (raw oversizes) and ISO 5457 (untrimmed drawing paper sizes).

If the interoperability argument in the first section above was not convincing enough to add keywords for the missing sizes from ISO 216 and all of ISO 269, they should also qualify due to having standardized identifiers and odd length values, and even if some were not commonly used, it would be beneficial to add the complete series nevertheless, for consistency, so authors do not have to remember which sizes do not have a keyword in CSS.

The international standard paper sizes – series A and B defined in ISO 216 and series C in ISO 269, which has been withdrawn in 2009 but still exists in local norms like DIN 476-2 – have been adopted by many national standardization bodies. Some have extended definitions for special purposes, e.g. the RA and SRA series from ISO 217, German 2A0 from DIN 476 or the now-withdrawn Swedish DG series from SIS 014711 and, of course, the Japanese B series from JIS P 0138 that is already recognized partially by CSS. For envelopes in particular, there are also some sizes with an 2:1 aspect ratio that combine the non-common edges of two adjacent sizes, e.g. C5/C4. The respective Wikipedia article for paper size is quite comprehensive.

However, most of these sizes are of limited interest to most CSS authors, at least with consumer printers, but those who need any of them would certainly welcome their addition to the standard.

Since CSS introduced the JIS- prefix to distinguish Japanese B sizes from international ones defined by ISO, it is not surprising that ISO-, US- and ANSI- also appear as prefixes for short size codes in existing implementations.

Proposed side rule:

All (new) page size keywords that use an alphanumeric code instead of a proper name, shall employ a prefix for the (original) issuing standardization body, e.g. JIS-, DIN-, SIS-, GOST-, BS-, ANSI-, ASME-, unless the code has been adopted by ISO (even if it has been deprecated since).

I do not propose any of those local sizes here, although some are apparently used frequently. The only local sizes I am proposing are the rest of the JIS P 0138 series. Keywords for B4 and B5 are already specified and an analogous one for B6 is already supported in at least one implementation.

Proposal Size CSS Antenna House
JIS-B12 16mm 22mm
JIS-B11 22mm 32mm
JIS-B10 32mm 45mm
JIS-B9 45mm 64mm
JIS-B8 64mm 91mm
JIS-B7 91mm 128mm
JIS-B6 128mm 182mm JIS-B6
JIS-B5 182mm 257mm JIS-B5 JIS-B5
JIS-B4 257mm 364mm JIS-B4 JIS-B4
JIS-B3 364mm 515mm
JIS-B2 515mm 728mm
JIS-B1 728mm 1030mm
JIS-B0 1030mm 1456mm

Furthermore, I propose to add all sizes from two international standards, which are not covered by the interoperability argument (as of early 2020).

ISO 217 specifies two A-based series for raw, uncut, untrimmed sheets, adding an R (for primary range) and SR (supplementary range) prefix, respectively. PDF Reactor does support systematic keywords for all of them. The actual standard seems to only require the recognition of (S)RA0, (S)RA1 and (S)RA2, but othe oversizes to the sizes of the ISO 216 A series are encountered in practice. I think it makes sense to support at least as many sizes as the following standard for drawing paper.

ISO 5457 specifies drawing paper sizes, where the trimmed sizes with a T suffix are identical to the respective A series sizes, whereas the sides of untrimmed U sizes are 3 to 4 centimeters larger. The standard also specifies a fixed area for the drawing space resulting from 20mm and 30mm page margins, but does not assign monikers.

Proposal Size PDF Reactor
SRA0 900mm 1280mm SRA0
A0U 880mm 1230mm
RA0 860mm 1220mm RA0
SRA1 640mm 900mm SRA1
A1U 625mm 880mm
RA1 610mm 860mm RA1
SRA2 450mm 900mm SRA2
A2U 450mm 625mm
RA2 430mm 610mm RA2
A3U 330mm 450mm
(SRA3) 320mm 450mm SRA3
(RA3) 305mm 430mm RA3
A4U 240mm 330mm
(SRA4) 225mm 320mm SRA4
(RA4) 215mm 305mm RA4
160mm 225mm SRA5
152mm 215mm RA5
112mm 160mm SRA6
107mm 152mm RA6
80mm 112mm SRA7
76mm 107mm RA7
56mm 80mm SRA8
53mm 76mm RA8

All American sizes, which have not already been specified in CSS, fail at least one of the three stated criteria, because their edges measure a simple number of half inches and are even often known only by those numbers (which are generally assumed to be exact).

The only popular metric sizes that are known by integer numbers are photographic prints (i.e. traditionally 9×13, 10×15, 13×18, 20×30), which, apparently, are rather approximate in fact, because they are really based on rounded inch-based specifications in ISO 1008 (see Wikipedia).

Crissov commented 4 years ago

PS: For consistence, I should probably also be proposing standard envelope sizes besides the generic C (and B) series, but I'm still researching this matter, e.g. which 2:1 combined formats, like C6/C5, should be considered.

Format Size
Invite 220mm 220mm
ISO DL 220mm 110mm
DL+ 225mm 112mm
DL Max, Compact 235mm 125mm
Italian 230mm 110mm
C7/C6 162mm 81mm
ISO C6/C5, Postfix, DL+ 229mm 114mm
B6/C4 324mm 125mm
E4 400mm 280mm
SetTrend commented 4 years ago

I'd like to chime in on this suggestion. Doctors' prescriptions and postcards are often printed on A6 sized paper, for instance.

Crissov commented 3 years ago

For what it’s worth, Ghostscript supports keywords for ISO A0–A10, B0–B6, C0–C6, JIS B0–B6, ANSI A–F (incl. aliases for Letter, Tabloid/Ledger), Legal, Half-Letter, Foolscap (8.5in 13in), Architecture A–E, CAN PA4, Hagaki. They are specified as integer amounts of PS points.

Crissov commented 2 years ago

Docraptor

ISO

US

ANSI

Architecture

Legacy

paged.js

Basically the current standard W3C set, but also some more: a0 through a7 and a10, whereas no JIS variants.

BFO Publisher

pre-defined page sizes: A3, A4, A5, B4, B5, JIS-B4, JIS-B5, letter, legal, or ledger.

New sizes are added with an environment variable, e.g. set bfo-sys-page-size-a6 to 105mm 148mm

typeset.sh

Only standard size keywords.

PDF Reactor