Slim down and organize paper sizes

Co-Authored-By: Martin <mhaug@live.de>
This commit is contained in:
Laurenz 2021-10-07 14:10:36 +02:00
parent 61fdc85b13
commit c0f5cd011f
4 changed files with 135 additions and 173 deletions

View File

@ -6,7 +6,7 @@ use crate::font::{
};
use crate::geom::*;
use crate::layout::Paint;
use crate::paper::{PaperClass, PAPER_A4};
use crate::paper::{PaperClass, ISO_A4};
/// Defines an set of properties a template can be instantiated with.
#[derive(Debug, Clone, Eq, PartialEq, Hash)]
@ -89,7 +89,7 @@ impl PageState {
impl Default for PageState {
fn default() -> Self {
let paper = PAPER_A4;
let paper = ISO_A4;
Self {
class: paper.class(),
size: paper.size(),

View File

@ -80,194 +80,156 @@ macro_rules! papers {
}
// All paper sizes in mm.
//
// Resources:
// - https://papersizes.io/
// - https://en.wikipedia.org/wiki/Paper_size
// - https://www.theedkins.co.uk/jo/units/oldunits/print.htm
// - https://vintagepaper.co/blogs/news/traditional-paper-sizes
papers! {
// ---------------------------------------------------------------------- //
// ISO 216
// ISO 216 A Series
(ISO_A0: Base, 841.0, 1189.0, "iso-a0")
(ISO_A1: Base, 594.0, 841.0, "iso-a1")
(ISO_A2: Base, 420.0, 594.0, "iso-a2")
(ISO_A3: Base, 297.0, 420.0, "iso-a3")
(ISO_A4: Base, 210.0, 297.0, "iso-a4")
(ISO_A5: Base, 148.0, 210.0, "iso-a5")
(ISO_A6: Book, 105.0, 148.0, "iso-a6")
(ISO_A7: Base, 74.0, 105.0, "iso-a7")
(ISO_A8: Base, 52.0, 74.0, "iso-a8")
(ISO_A9: Base, 37.0, 52.0, "iso-a9")
(ISO_A10: Base, 26.0, 37.0, "iso-a10")
(ISO_A11: Base, 18.0, 26.0, "iso-a11")
// A Series
(PAPER_A0: Base, 841.0, 1189.0, "a0" | "poster")
(PAPER_A1: Base, 594.0, 841.0, "a1")
(PAPER_A2: Base, 420.0, 594.0, "a2")
(PAPER_A3: Base, 297.0, 420.0, "a3")
(PAPER_A4: Base, 210.0, 297.0, "a4")
(PAPER_A5: Base, 148.0, 210.0, "a5")
(PAPER_A6: Book, 105.0, 148.0, "a6")
(PAPER_A7: Base, 74.0, 105.0, "a7" | "iso-7810-id-2" | "id-2" | "visa" | "flyer")
(PAPER_A8: Base, 52.0, 74.0, "a8")
(PAPER_A9: Base, 37.0, 52.0, "a9")
(PAPER_A10: Base, 26.0, 37.0, "a10")
(PAPER_A11: Base, 18.0, 26.0, "a11")
// ISO 216 B Series
(ISO_B1: Base, 707.0, 1000.0, "iso-b1")
(ISO_B2: Base, 500.0, 707.0, "iso-b2")
(ISO_B3: Base, 353.0, 500.0, "iso-b3")
(ISO_B4: Base, 250.0, 353.0, "iso-b4")
(ISO_B5: Book, 176.0, 250.0, "iso-b5")
(ISO_B6: Book, 125.0, 176.0, "iso-b6")
(ISO_B7: Base, 88.0, 125.0, "iso-b7")
(ISO_B8: Base, 62.0, 88.0, "iso-b8")
// B Series
(PAPER_B1: Base, 707.0, 1000.0, "b1" | "flipchart")
(PAPER_B2: Base, 500.0, 707.0, "b2")
(PAPER_B3: Base, 353.0, 500.0, "b3")
(PAPER_B4: Base, 250.0, 353.0, "b4" | "sheet-music")
(PAPER_B5: Book, 176.0, 250.0, "b5")
(PAPER_B6: Book, 125.0, 176.0, "b6" | "book")
(PAPER_B7: Base, 88.0, 125.0, "b7" | "passport" | "iso-7810-id-3" | "id-3")
(PAPER_B8: Base, 62.0, 88.0, "b8")
// ISO 216 C Series
(ISO_C3: Base, 324.0, 458.0, "iso-c3")
(ISO_C4: Base, 229.0, 324.0, "iso-c4")
(ISO_C5: Base, 162.0, 229.0, "iso-c5")
(ISO_C6: Base, 114.0, 162.0, "iso-c6")
(ISO_C7: Base, 81.0, 114.0, "iso-c7")
(ISO_C8: Base, 57.0, 81.0, "iso-c8")
// C Series
(PAPER_C3: Base, 324.0, 458.0, "c3")
(PAPER_C4: Base, 229.0, 324.0, "c4")
(PAPER_C5: Base, 162.0, 229.0, "c5")
(PAPER_C6: Base, 114.0, 162.0, "c6")
(PAPER_C7: Base, 81.0, 114.0, "c7")
(PAPER_C8: Base, 57.0, 81.0, "c8")
// DIN D Series (extension to ISO)
(DIN_D3: Base, 272.0, 385.0, "din-d3")
(DIN_D4: Base, 192.0, 272.0, "din-d4")
(DIN_D5: Base, 136.0, 192.0, "din-d5")
(DIN_D6: Base, 96.0, 136.0, "din-d6")
(DIN_D7: Base, 68.0, 96.0, "din-d7")
(DIN_D8: Base, 48.0, 68.0, "din-d8")
// D Series (DIN extension to ISO)
(PAPER_D3: Base, 272.0, 385.0, "din-d3")
(PAPER_D4: Base, 192.0, 272.0, "din-d4")
(PAPER_D5: Base, 136.0, 192.0, "din-d5" | "dvd")
(PAPER_D6: Base, 96.0, 136.0, "din-d6")
(PAPER_D7: Base, 68.0, 96.0, "din-d7")
(PAPER_D8: Base, 48.0, 68.0, "din-d8")
// Academically relevant SIS extensions
(PAPER_G5: Base, 169.0, 239.0, "sis-g5")
(PAPER_E5: Base, 115.0, 220.0, "sis-e5")
// ---------------------------------------------------------------------- //
// Unites States
// Customary
(PAPER_FOLIO: US, 210.0, 330.0, "folio" | "us-folio" | "us-f4")
(PAPER_LETTER: US, 216.0, 279.0, "letter" | "ansi-a" |
"american-quarto" | "carta")
(PAPER_LEGAL: US, 216.0, 356.0, "legal")
(PAPER_TABLOID: Newspaper, 279.0, 432.0, "tabloid" | "ansi-b")
(PAPER_LEDGER: Base, 432.0, 279.0, "ledger")
(PAPER_JUNIOR_LEGAL: US, 127.0, 203.0, "junior-legal" | "index-card")
(PAPER_HALF_LETTER: Base, 140.0, 216.0, "half-letter")
(PAPER_GOVERNMENT_LETTER: US, 203.0, 267.0, "government-letter")
(PAPER_GOVERNMENT_LEGAL: US, 216.0, 330.0, "government-legal" | "officio")
// SIS (used in academia)
(SIS_G5: Base, 169.0, 239.0, "sis-g5")
(SIS_E5: Base, 115.0, 220.0, "sis-e5")
// ANSI Extensions
(PAPER_ANSI_C: Base, 432.0, 559.0, "ansi-c")
(PAPER_ANSI_D: Base, 559.0, 864.0, "ansi-d")
(PAPER_ANSI_E: Base, 864.0, 1118.0, "ansi-e")
(PAPER_ENGINEERING_F: Base, 711.0, 1016.0, "engineering-f" | "engineering" |
"navfac" | "aerospace")
(ANSI_A: Base, 216.0, 279.0, "ansi-a")
(ANSI_B: Base, 279.0, 432.0, "ansi-b")
(ANSI_C: Base, 432.0, 559.0, "ansi-c")
(ANSI_D: Base, 559.0, 864.0, "ansi-d")
(ANSI_E: Base, 864.0, 1118.0, "ansi-e")
// Architectural Paper
(PAPER_ARCH_A: Base, 229.0, 305.0, "arch-a" | "arch-1")
(PAPER_ARCH_B: Base, 305.0, 457.0, "arch-b" | "arch-2" | "extra-tabloide")
(PAPER_ARCH_C: Base, 457.0, 610.0, "arch-c" | "arch-3")
(PAPER_ARCH_D: Base, 610.0, 914.0, "arch-d" | "arch-4")
(PAPER_ARCH_E1: Base, 762.0, 1067.0, "arch-e1" | "arch-5")
(PAPER_ARCH_E: Base, 914.0, 1219.0, "arch-e" | "arch-6")
// ---------------------------------------------------------------------- //
// Japan
// ANSI Architectural Paper
(ARCH_A: Base, 229.0, 305.0, "arch-a")
(ARCH_B: Base, 305.0, 457.0, "arch-b")
(ARCH_C: Base, 457.0, 610.0, "arch-c")
(ARCH_D: Base, 610.0, 914.0, "arch-d")
(ARCH_E1: Base, 762.0, 1067.0, "arch-e1")
(ARCH_E: Base, 914.0, 1219.0, "arch-e")
// JIS B Series
(PAPER_JIS_B0: Base, 1030.0, 1456.0, "jis-b0" | "jb0")
(PAPER_JIS_B1: Base, 728.0, 1030.0, "jis-b1" | "jb1")
(PAPER_JIS_B2: Base, 515.0, 728.0, "jis-b2" | "jb2")
(PAPER_JIS_B3: Base, 364.0, 515.0, "jis-b3" | "jb3")
(PAPER_JIS_B4: Base, 257.0, 364.0, "jis-b4" | "jb4")
(PAPER_JIS_B5: Base, 182.0, 257.0, "jis-b5" | "jb5")
(PAPER_JIS_B6: Base, 128.0, 182.0, "jis-b6" | "jb6")
(PAPER_JIS_B7: Base, 91.0, 128.0, "jis-b7" | "jb7")
(PAPER_JIS_B8: Base, 64.0, 91.0, "jis-b8" | "jb8")
(PAPER_JIS_B9: Base, 45.0, 64.0, "jis-b9" | "jb9")
(PAPER_JIS_B10: Base, 32.0, 45.0, "jis-b10" | "jb10")
(PAPER_JIS_B11: Base, 22.0, 32.0, "jis-b11" | "jb11")
(JIS_B0: Base, 1030.0, 1456.0, "jis-b0")
(JIS_B1: Base, 728.0, 1030.0, "jis-b1")
(JIS_B2: Base, 515.0, 728.0, "jis-b2")
(JIS_B3: Base, 364.0, 515.0, "jis-b3")
(JIS_B4: Base, 257.0, 364.0, "jis-b4")
(JIS_B5: Base, 182.0, 257.0, "jis-b5")
(JIS_B6: Base, 128.0, 182.0, "jis-b6")
(JIS_B7: Base, 91.0, 128.0, "jis-b7")
(JIS_B8: Base, 64.0, 91.0, "jis-b8")
(JIS_B9: Base, 45.0, 64.0, "jis-b9")
(JIS_B10: Base, 32.0, 45.0, "jis-b10")
(JIS_B11: Base, 22.0, 32.0, "jis-b11")
// Traditional
(PAPER_SHIROKU_BAN_4: Base, 264.0, 379.0, "shiroku-ban-4")
(PAPER_SHIROKU_BAN_5: Base, 189.0, 262.0, "shiroku-ban-5")
(PAPER_SHIROKU_BAN_6: Base, 127.0, 188.0, "shiroku-ban-6")
(PAPER_KIKU_4: Base, 227.0, 306.0, "kiku-4")
(PAPER_KIKU_5: Base, 151.0, 227.0, "kiku-5")
// SAC D Series
(SAC_D0: Base, 764.0, 1064.0, "sac-d0")
(SAC_D1: Base, 532.0, 760.0, "sac-d1")
(SAC_D2: Base, 380.0, 528.0, "sac-d2")
(SAC_D3: Base, 264.0, 376.0, "sac-d3")
(SAC_D4: Base, 188.0, 260.0, "sac-d4")
(SAC_D5: Base, 130.0, 184.0, "sac-d5")
(SAC_D6: Base, 92.0, 126.0, "sac-d6")
// ISO 7810 ID
(ISO_ID_1: Base, 85.6, 53.98, "iso-id-1")
(ISO_ID_2: Base, 74.0, 105.0, "iso-id-2")
(ISO_ID_3: Base, 88.0, 125.0, "iso-id-3")
// ---------------------------------------------------------------------- //
// Asia
(ASIA_F4: Base, 210.0, 330.0, "asia-f4")
// Japan
(JP_SHIROKU_BAN_4: Base, 264.0, 379.0, "jp-shiroku-ban-4")
(JP_SHIROKU_BAN_5: Base, 189.0, 262.0, "jp-shiroku-ban-5")
(JP_SHIROKU_BAN_6: Base, 127.0, 188.0, "jp-shiroku-ban-6")
(JP_KIKU_4: Base, 227.0, 306.0, "jp-kiku-4")
(JP_KIKU_5: Base, 151.0, 227.0, "jp-kiku-5")
(JP_BUSINESS_CARD: Base, 91.0, 55.0, "jp-business-card")
// China
(CN_BUSINESS_CARD: Base, 90.0, 54.0, "cn-business-card")
// Chinese D Series
(PAPER_SAC_D0: Base, 764.0, 1064.0, "sac-d0" | "cn-d0")
(PAPER_SAC_D1: Base, 532.0, 760.0, "sac-d1" | "cn-d1")
(PAPER_SAC_D2: Base, 380.0, 528.0, "sac-d2" | "cn-d2")
(PAPER_SAC_D3: Base, 264.0, 376.0, "sac-d3" | "cn-d3")
(PAPER_SAC_D4: Base, 188.0, 260.0, "sac-d4" | "cn-d4")
(PAPER_SAC_D5: Base, 130.0, 184.0, "sac-d5" | "cn-d5")
(PAPER_SAC_D6: Base, 92.0, 126.0, "sac-d6" | "cn-d6")
// Europe
(EU_BUSINESS_CARD: Base, 85.0, 55.0, "eu-business-card")
// ---------------------------------------------------------------------- //
// United Kingdom Imperial (Assortment)
(PAPER_MONARCH: Base, 184.0, 267.0, "monarch")
(PAPER_QUARTO: Base, 229.0, 279.0, "quarto" | "us-quarto")
(PAPER_UK_QUARTO: Base, 203.0, 254.0, "uk-quarto" | "imperial-quarto")
(PAPER_UK_FOOLSCAP: Base, 343.0, 432.0, "foolscap" | "us-foolscap")
(PAPER_FOOLSCAP: Base, 203.0, 330.0, "imperial-foolscap" | "uk-foolscap")
(PAPER_POTT: Base, 318.0, 381.0, "pott")
(PAPER_CROWN: Base, 318.0, 508.0, "crown")
(PAPER_PINCHED_POST: Base, 375.0, 470.0, "pinched-post")
(PAPER_POST: Base, 394.0, 489.0, "post")
(PAPER_LARGE_POST: Base, 419.0, 533.0, "large-post")
(PAPER_DEMY: Base, 445.0, 572.0, "demy")
(PAPER_ROYAL: Base, 508.0, 635.0, "royal")
(PAPER_DOUBLE_CROWN: Base, 508.0, 762.0, "double-crown" | "theatre")
(PAPER_ELEPHANT: Base, 584.0, 711.0, "elephant")
(PAPER_DOUBLE_ROYAL: Base, 635.0, 1016.0, "double-royal" | "rail")
(PAPER_QUAD_CROWN: Base, 762.0, 1016.0, "quad-crown" | "cinema")
// ---------------------------------------------------------------------- //
// French Traditional (AFNOR)
(FR_TELLIERE: Base, 340.0, 440.0, "fr-tellière")
(FR_COURONNE_ECRITURE: Base, 360.0, 460.0, "fr-couronne-écriture")
(FR_COURONNE_EDITION: Base, 370.0, 470.0, "fr-couronne-édition")
(FR_RAISIN: Base, 500.0, 650.0, "fr-raisin")
(FR_CARRE: Base, 450.0, 560.0, "fr-carré")
(FR_JESUS: Base, 560.0, 760.0, "fr-jésus")
(PAPER_CLOCHE: Base, 300.0, 400.0, "cloche")
(PAPER_POT: Base, 310.0, 400.0, "pot" | "ecolier" | "écolier")
(PAPER_TELLIERE: Base, 340.0, 440.0, "telliere" | "tellière")
(PAPER_COURONNE_ECRITURE: Base, 360.0, 460.0, "couronne-ecriture" |
"couronne" | "couronne-écriture")
(PAPER_COURONNE_EDITION: Base, 370.0, 470.0, "couronne-edition" |
"couronne-édition")
(PAPER_ROBERTO: Base, 390.0, 500.0, "roberto")
(PAPER_ECU: Base, 400.0, 520.0, "ecu" | "écu")
(PAPER_COQUILLE: Base, 440.0, 560.0, "coquille")
(PAPER_CARRE: Base, 450.0, 560.0, "carre" | "carré")
(PAPER_CAVALIER: Base, 460.0, 620.0, "cavalier")
(PAPER_DEMI_RAISIN: Base, 325.0, 500.0, "demi-raisin")
(PAPER_RAISIN: Base, 500.0, 650.0, "raisin" | "dessin")
(PAPER_DOUBLE_RAISIN: Base, 650.0, 1000.0, "double-raisin")
(PAPER_JESUS: Base, 560.0, 760.0, "jesus" | "jésus")
(PAPER_SOLEIL: Base, 600.0, 800.0, "soleil")
(PAPER_COLOMBIER_AFFICHE: Base, 600.0, 800.0, "colombier-affiche" | "affiche")
(PAPER_COLOMBIER_COMMERCIAL: Base, 630.0, 900.0, "colombier-commercial")
(PAPER_PETIT_AIGLE: Base, 700.0, 940.0, "petit-aigle")
(PAPER_GRAND_AIGLE: Base, 750.0, 1060.0, "grand-aigle" | "napoleon")
(PAPER_GRAND_MONDE: Base, 900.0, 1260.0, "grand-monde")
(PAPER_UNIVERS: Base, 1000.0, 1300.0, "univers" | "universe")
// United Kingdom Imperial
(UK_BRIEF: Base, 406.4, 342.9, "uk-brief")
(UK_DRAFT: Base, 254.0, 406.4, "uk-draft")
(UK_FOOLSCAP: Base, 203.2, 330.2, "uk-foolscap")
(UK_QUARTO: Base, 203.2, 254.0, "uk-quarto")
(UK_CROWN: Base, 508.0, 381.0, "uk-crown")
(UK_BOOK_A: Book, 111.0, 178.0, "uk-book-a")
(UK_BOOK_B: Book, 129.0, 198.0, "uk-book-b")
// Unites States
(US_LETTER: US, 215.9, 279.4, "us-letter")
(US_LEGAL: US, 215.9, 355.6, "us-legal")
(US_TABLOID: US, 279.4, 431.8, "us-tabloid")
(US_EXECUTIVE: US, 184.15, 266.7, "us-executive")
(US_FOOLSCAP_FOLIO: US, 215.9, 342.9, "us-foolscap-folio")
(US_STATEMENT: US, 139.7, 215.9, "us-statement")
(US_LEDGER: US, 431.8, 279.4, "us-ledger")
(US_OFICIO: US, 215.9, 340.36, "us-oficio")
(US_GOV_LETTER: US, 203.2, 266.7, "us-gov-letter")
(US_GOV_LEGAL: US, 215.9, 330.2, "us-gov-legal")
(US_BUSINESS_CARD: Base, 88.9, 50.8, "us-business-card")
(US_DIGEST: Book, 139.7, 215.9, "us-digest")
(US_TRADE: Book, 152.4, 228.6, "us-trade")
// ---------------------------------------------------------------------- //
// Newspaper
(PAPER_COMPACT: Newspaper, 280.0, 430.0, "compact")
(PAPER_BERLINER: Newspaper, 315.0, 470.0, "berliner" | "midi")
(PAPER_RHENISH: Newspaper, 350.0, 520.0, "rhenish")
(PAPER_BROADSHEET: Newspaper, 381.0, 578.0, "broadsheet" | "newspaper")
(PAPER_NEW_YORK_TIMES: Newspaper, 305.0, 559.0, "new-york-times" | "times")
// ---------------------------------------------------------------------- //
// Books
(PAPER_FOLIO_BOOK: Book, 304.8, 482.6, "book-folio")
(PAPER_QUARTO_BOOK: Book, 241.3, 304.8, "book-quarto")
(PAPER_OCTAVO_BOOK: Book, 152.4, 228.6, "book-octavo")
(PAPER_16_MO_BOOK: Book, 101.6, 171.45, "book-16mo")
(PAPER_32_MO_BOOK: Book, 88.9, 139.7, "book-32mo")
// ---------------------------------------------------------------------- //
// Various
(PAPER_ID_1: Base, 85.6, 53.98, "id-card" | "id-1" | "iso-7810-id-1" |
"eu-business-card" | "business-card")
(PAPER_US_BUSINESS_CARD: Base, 88.9, 50.8, "us-business-card")
(PAPER_JP_BUSINESS_CARD: Base, 91.0, 55.0, "jp-business-card")
(PAPER_CN_BUSINESS_CARD: Base, 90.0, 54.0, "cn-business-card")
(PAPER_A4_16_9: Base, 297.0, 167.0625, "presentation-16-9" | "presentation")
(PAPER_A4_4_3: Base, 280.0, 210.0, "presentation-4-3")
(PAPER_POSTCARD: Base, 152.4, 101.6, "postcard")
// Other
(NEWSPAPER_COMPACT: Newspaper, 280.0, 430.0, "newspaper-compact")
(NEWSPAPER_BERLINER: Newspaper, 315.0, 470.0, "newspaper-berliner")
(NEWSPAPER_BROADSHEET: Newspaper, 381.0, 578.0, "newspaper-broadsheet")
(PRESENTATION_16_9: Base, 297.0, 167.0625, "presentation-16-9")
(PRESENTATION_4_3: Base, 280.0, 210.0, "presentation-4-3")
}

View File

@ -24,7 +24,7 @@
[#page(margins: 0pt, left: 20pt) Overriden]
// Flipped predefined paper.
[#page(paper: "a11", flip: true) Flipped A11]
[#page(paper: "iso-a11", flip: true) Flipped A11]
// Flipped custom page size.
#page(width: 40pt, height: 120pt)

View File

@ -11,7 +11,7 @@ A
#box[
B
#pagebreak()
#page("a4")
#page("iso-a4")
]
C