Skip to content

[css-page] <page-size> Keywords #328

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Crissov opened this issue Jul 18, 2016 · 14 comments
Closed

[css-page] <page-size> Keywords #328

Crissov opened this issue Jul 18, 2016 · 14 comments

Comments

@Crissov
Copy link
Contributor

Crissov commented Jul 18, 2016

TL;DR: Change JIS-B5 and JIS-B4 to JIS B5 and JIS B4.

In November 2015 it has been discussed whether to include several additional page size keywords into CSS Page. Subsequently, Japanese JIS-B4 and JIS-B5 have been added. They had already been supported by Antenna House Formatter due to strong local demand.

Prince and Antenna House actually both support additional keywords, but with inconsistencies. I didn’t find relevant documentation for Weasyprint and Vivliostyle. I quote the tables below, but I actually wonder if CSS can learn from these and do better.

size: <length>{1,2} | auto | [ <page-size> || [ portrait | landscape ] ]

auto is currently UA-dependent, but maybe it could be specified as defaulting to – if included – PA4, the (rounded) intersection of ISO A4 and ANSI A (better known as US Letter): 210mm × 280mm.

Most paper sizes for printers are specified with default portrait orientation, i.e. smaller size first, and <length>{1,2} has width first and optional height second. Some sizes are primarily used in landscape orientation and therefore they have been implemented with large size first: id-1, id-2, id-3 and ledger. Except for the first one, which is the common size of plastic cards (at 2.125in 3.37in), they are landscape aliases of other sizes: A7, A6 and tabloid, respectively. Since ledger (not tabloid) is currently specified as a portrait format, it should be clarified whether the implementations (intentionally) are non-comformant there and if it’s a bug in the spec.

International paper sizes

The ISO sizes – series A and B defined in ISO 216 and series C in ISO 269 – have been adopted by many national standardization bodies. Some have extended definitions for special purposes, e.g. the RA series from ISO 217, German DIN 2A0 or the Swedish SIS D–G series and, of course, the Japanese B series (JIS P 0138). Most of them are of limited interest to CSS authors, at least with consumer printers.

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

I believe it could be beneficial to have <paper-size> accept two keywords, an optional one for the system (e.g. JIS) and a mandatory one for the size (e.g. B4).

  • standard | auto (default, depends on the size)
  • iso | international
  • local
    • jis | japan | japanese
    • ansi | us | america | american | arch

One question is whether iso legal and international letter would compute to A4 and US A4 to letter.
Another question is whether UAs with local settings for Japan should equal standard B4 to JIS B4.

Other metric paper sizes

Size CSS Prince Antenna House elsewhere
53.98mm × 85.6mm ID-1 creditcard
100mm × 148mm Hagaki postcard
110mm × 220mm ISO-DL DL, DLE
210mm × 280mm PA4, L4
210mm × 330mm Folio  F4
215mm × 280mm P4
215mm × 305mm RA4
  • ID-1 is actually metricated 2⅛in × 3.37in.
  • DL is an envelope-only size, fitting folded A4, but Wikipedia calls it “DLE” to distinguish it from ⅓ A4 “DL” (99mm × 210mm).
  • PA4 or L4 is A4 cut to letter height or letter cut to A4 width (if letter equalled P4 instead of ANSI-A).
  • Folio is US-Folio cut to A4 width and Wikipedia has it under the lemma F4. ISO 217 RA4 is, probably by coincidence, roughly 8.5in × 12in, i.e. between letter and legal or folio/us-folio.
  • Canadian standards P1–P6 have US sizes rounded to the closest half-centimeter; CAN P4 is rounded letter or ANSI A.
  • There are some inofficial ‘plus’ sizes, e.g. ‘A4+’, mostly for photo printing.

American standard paper sizes

Size CSS Prince Antenna House
5.5in × 8.5in US-Statement Statement
7.25in × 10.5in US-Executive Executive
8in × 11in US-Government Government-Letter
8.5in × 11in letter US-Letter, ansi-a Letter
8.5in × 13in US-Folio
8.5in × 14in legal US-Legal Legal
9in × 12in arch-a
11in × 17in ledger US-Ledger, ansi-b Ledger
US-Tabloid Tabloid
12in × 18in arch-b
17in × 22in ansi-c C
18in × 24in arch-c
22in × 34in ansi-d D
24in × 36in arch-d
30in × 42in arch-e1
34in × 44in ansi-e E
36in × 48in arch-e

arch() could be defined as rounding up both sides to the next multiple of 6in, or of 3in for measures smaller than, say, 10in.

Other American paper sizes

The sizes foolscap, crown, demy, royal, imperial come in three variants each: octavo has the longer side of quarto halved and folio has its shorter side doubled. Two of these could be implemented as functions or modifier keywords for all paper sizes, so that either quarto(A4) would equal A5 or that octavo A5 was A7. half and quarter should work equally well (with a respective note on traditional terminology) and then double or quad/quadruple would also be possible, but maybe that’s not worth the hassle at all.

I’m not sure I like the alternative idea of folio(A4, 0.5) = A3, folio(A4, 2) = A5 and either folio(A4, 3) or folio(A4, 4) = A6. (Without the comma if you want and could be called fold() instead.)

Size CSS Prince Antenna House
4.25in × 6.75in foolscap-octavo
6.75in × 8.5in foolscap-quarto
8.5in × 13.5in foolscap-folio
5in × 7.5in crown-octavo
7.5in × 10in crown-quarto
10in × 15in crown-folio
5.625in × 8.75in demy-octavo
8.75in × 11.25in demy-quarto
11.25in × 17.5in
5.75in × 9in
9in × 11.5in medium-quarto
11.5in × 18in
6.25in × 10in royal-octavo
10in × 12.5in royal-quarto
12.5in × 20in royal-folio
7.5in × 11in imperial-octavo
11in × 15in imperial-quarto
15in × 22in imperial-folio
@frivoal
Copy link
Collaborator

frivoal commented Jul 19, 2016

I didn’t find relevant documentation for [...] Vivliostyle

As for version 2016.7, Vivliostyle supports all the page sizes specified in the spec (and only these):
https://github.com/vivliostyle/vivliostyle.js/blob/64c0766361f87ac9c8c8ddf6aef83a60931da715/resources/validation.txt#L297 : a5 | a4 | a3 | b5 | b4 | jis-b5 | jis-b4 | letter | legal | ledger. The dimensions match those specified in https://drafts.csswg.org/css-page/#typedef-page-size-page-size

Since ledger (not tabloid) is currently specified as a portrait format, it should be clarified whether the implementations (intentionally) are non-comformant there and if it’s a bug in the spec.

I believe the spec is clear that all formats are defined in portrait orientation, and Vivliostyle's implementation conforms to that.

I believe it could be beneficial to have accept two keywords, an optional one for the system (e.g. JIS) and a mandatory one for the size (e.g. B4).

I don't think I'd be in favor of this approach. It makes it possible to specify paper sizes that don't actually exist (jis ledger?), and while we could certainly define them, I don't see the benefit.

As for including more paper sizes in the spec, it is very cheap to implemented and there may be occasional demand, so we wouldn't be opposed to it, but it is also very easy for authors to work with actual dimensions if they don't have the keywords, so the need isn't that pressing either. We have yet to feel market pressure in supporting these other sizes, but if/when we do, we'll be sure to report back to the CSSWG.

It was different for JIS-B5 and JIS-B4, since there's more demand for these than for the unprefixed (implying ISO) B5 and B4, so adding there helped alleviate some confusion.

@dauwhe
Copy link
Contributor

dauwhe commented Jul 19, 2016

We produce many hundreds of books per year using Prince. Essentially none of them use any of the page sizes listed in any comment above. It's so very easy to type size: 6in 9.25in that I don't see a strong need for having lots of keywords.

@Crissov
Copy link
Contributor Author

Crissov commented Jul 19, 2016

Correct me if I’m wrong, @dauwhe, but book sizes are much less standardized than loose sizes and they tend to use round values (or vulgar fractions with inches). The ISO (and JIS) sizes, on the other hand, have awful numbers to remember, because they’re designed to keep the same, irrational aspect ratio, so keywords are very useful for them.

@dauwhe
Copy link
Contributor

dauwhe commented Jul 19, 2016

@Crissov agreed that keywords for ISO/JIS are important; I think they're less important for foolscap-quarto and friends :)

@Crissov
Copy link
Contributor Author

Crissov commented Jul 20, 2016

I agree that Prince’s keywords in the last table should not be included in the specification.

I’m somewhat growing fond of the fold or folio (function) syntax I mentioned, though, because it’s cleaner than using calc(), can help avoid decimal representations of 8th or 16th fractions and it would instantly cover the complete ISO, JIS, ANSI and arch series as soon as one size keyword is supported.

Personally, I don’t care whether foolscap, crown, demy, royal and imperial (without hard-coded suffix) were included.

@fantasai
Copy link
Collaborator

fantasai commented Aug 8, 2016

Based on the discussion here, it seems like nothing is urgent to add other than JIS-B4 and JIS-B5, which have been added already. I agree with Florian that unless there is specific demand for certain keywords, we should not add them pre-emptively. Therefore closing this issue.

@fantasai fantasai closed this as completed Aug 8, 2016
@fantasai
Copy link
Collaborator

fantasai commented Aug 8, 2016

For the record, Shinyu Murakami writes:

My opinion is same as Dave Cramer and Florian, we should keep the list minimum.
We need jis-b5 and jis-b4 only because (ISO) b5 and b4 are already defined and those would confuse Japanese users.

And I'm inclined to defer to his position.

@Crissov
Copy link
Contributor Author

Crissov commented Aug 8, 2016

I can live with jis-b4 being kept instead of my suggested jis b4, i.e. my original proposal being rejected.

However, @frivoal and @frivoal actually (also) wrote: “it is very cheap to implemented and there may be occasional demand” and “keywords for ISO/JIS are important”. The dimensions of an ID-1 business card or an A6 postcard are not easier to remember than of either of the B4s. It’s actually hard to remember which standard sizes out of the ISO series do have a keyword, although they are of course the most frequent physical sheet formats used for office printing. It’s different for inch-based sizes without √2 aspect ratio.

Why should authors be bothered with looking up or remembering the dimensions of standardized sizes? CSS code also becomes more readable to future editors with keywords.

As shown in the tables, there are interoperable implementations of additional keywords a6 and b6, but keywords for ISO sizes C6, C5, C4 and C3 (as well as ANSI sizes C, D and E) differ among vendors. Standardization makes sense in both cases.

@Crissov
Copy link
Contributor Author

Crissov commented Sep 5, 2017

This is your annual reminder that keywords for the international standard sizes with an aspect ratio of the square root of two make absolute sense, i.e. everything from A0 through C10, including JIS-B0 through JIS-B10. There seems to have been a consensus about that above.

@frivoal
Copy link
Collaborator

frivoal commented Sep 7, 2017

I think that there's a demand problem. While this not particularly hard to add, it still needs to be specified, tested, implemented across the board, etc. So that's still a non zero effort across for many different groups.

I expect that people printing outside of the A3 - A5 range actually know how big their paper is, usually, and that the pain may be very limited for them.

If browsers add support for these, adding them to the specification will be fairly trivial. But the hard part is convincing browsers individually that this is worth doing, and putting it in the spec does very little to that end, especially since what these should do is fully obvious.

I suggest you go open bugs on individual browsers, rally around developers wanting these to vote these up, and generally work at making the demand for this feature more visible. That will have a much better chance at making it happen than pinging this group.

@Crissov
Copy link
Contributor Author

Crissov commented Sep 7, 2017

I always considered CSS to be driven by specifications not by implementations, i.e. W3C invents something, then asks vendors to implement it and if they don't, drops it.

My general experience with asking vendors to implement something that is consistent with a standard but goes beyond its actual prose has been that they simply reject it because it is not required or recommended by the standard.

Standardization can be the act of documenting and harmonizing common practices to ensure interoperability, but this descriptive approach usually doesn't work well for web standards (although it has to be done like that frequently).

@tabatkins
Copy link
Member

I always considered CSS to be driven by specifications not by implementations, i.e. W3C invents something, then asks vendors to implement it and if they don't, drops it.

Nope, the W3C is vendors (plus some subject-matter experts). While ideas can come from many sources (sometimes coming from browsers, sometimes from experts, sometimes from the community), ultimately a healthy standard is one that proceeds with vendor support thru its entire lifecycle. The "spec first, hope that someone implements it someday" model doesn't work very well, as we've rediscovered repeatedly thruout history. (This is why I keep my own "hopefully somebody wants to implement it someday" specs on my own GH repo; they don't get put into the CSSWG repo until someone wants to implement it and the group approves of it.)

My general experience with asking vendors to implement something that is consistent with a standard but goes beyond its actual prose has been that they simply reject it because it is not required or recommended by the standard.

Florian wasn't saying you should ask browser vendors to implement these new values unilaterally, but rather to get someone there interested in the feature, so that they'd be willing to implement it if it were standardized. Browsers are generally, rightfully, loathe to just unilaterally implement something.

Standardization can be the act of documenting and harmonizing common practices to ensure interoperability, but this descriptive approach usually doesn't work well for web standards (although it has to be done like that frequently).

Correct, "cleaning up afterwards" is a useful thing for standards to do, but not the only thing. But forging too far ahead is a different failure mode, one which is way too easy to fall into. Thus our general policy these days of getting as least some interest from browser vendors in a topic before pursuing it.

@Crissov
Copy link
Contributor Author

Crissov commented Sep 8, 2017

I have documented interest in keywords for ISO paper sizes by some vendors in the initial message of this thread. Naturally, the interest is much stronger in print-centric products like Prince and AHF, while the large browser vendors with their screen-centric products do not care as much. Why does that not proof enough demand already?

Since even browsers already support the limited set of standardized keywords, I believe that the cost of implementing the rest of the set would actually be negligible compared to the cost of arguing over their inclusion in the standard. 😉

@Crissov
Copy link
Contributor Author

Crissov commented Mar 30, 2021

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants