4 /* Copyright (C) 2002, 2003, 2004
5 Free Software Foundation, Inc.
6 Written by Werner Lemberg (wl@gnu.org)
8 This file is part of groff.
10 groff is free software; you can redistribute it and/or modify it under
11 the terms of the GNU General Public License as published by the Free
12 Software Foundation; either version 2, or (at your option) any later
15 groff is distributed in the hope that it will be useful, but WITHOUT ANY
16 WARRANTY; without even the implied warranty of MERCHANTABILITY or
17 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
20 You should have received a copy of the GNU General Public License along
21 with groff; see the file COPYING. If not, write to the Free Software
22 Foundation, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, USA. */
27 paper papersizes
[NUM_PAPERSIZES
];
29 // length and width in mm
30 static void add_iso_paper(char series
, int offset
,
31 int start_length
, int start_width
)
33 int length
= start_length
;
34 int width
= start_width
;
35 for (int i
= 0; i
< 8; i
++)
37 char *p
= new char[3];
41 papersizes
[offset
+ i
].name
= p
;
43 papersizes
[offset
+ i
].length
= (double)length
/ 25.4;
44 papersizes
[offset
+ i
].width
= (double)width
/ 25.4;
45 // after division by two, values must be rounded down to the next
46 // integer (as specified by ISO)
53 // length and width in inch
54 static void add_american_paper(const char *name
, int idx
,
55 double length
, double width
)
57 char *p
= new char[strlen(name
) + 1];
59 papersizes
[idx
].name
= p
;
60 papersizes
[idx
].length
= length
;
61 papersizes
[idx
].width
= width
;
64 int papersize_init::initialised
= 0;
66 papersize_init::papersize_init()
71 add_iso_paper('a', 0, 1189, 841);
72 add_iso_paper('b', 8, 1414, 1000);
73 add_iso_paper('c', 16, 1297, 917);
74 add_iso_paper('d', 24, 1090, 771);
75 add_american_paper("letter", 32, 11, 8.5);
76 add_american_paper("legal", 33, 14, 8.5);
77 add_american_paper("tabloid", 34, 17, 11);
78 add_american_paper("ledger", 35, 11, 17);
79 add_american_paper("statement", 36, 8.5, 5.5);
80 add_american_paper("executive", 37, 10, 7.5);
81 // the next three entries are for grolj4
82 add_american_paper("com10", 38, 9.5, 4.125);
83 add_american_paper("monarch", 39, 7.5, 3.875);
84 // this is an ISO format, but it easier to use add_american_paper
85 add_american_paper("dl", 40, 220/25.4, 110/25.4);