Debian Codegraph @

texk/dvipdfm-x/dpxconf.c

raw
1 /* This is DVIPDFMx, an eXtended version of DVIPDFM by Mark A. Wicks.
2
3 Copyright (C) 2002-2020 by Jin-Hwan Cho and Shunsaku Hirata,
4 the dvipdfmx project team.
5
6 Copyright (C) 1998, 1999 by Mark A. Wicks <[email protected]>
7
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
21 */
22
23 #ifdef HAVE_CONFIG_H
24 #include <config.h>
25 #endif
26
27 #include "system.h"
28 #include "error.h"
29 #include "mem.h"
30
31 #include "dpxconf.h"
32
33 struct _dpx_conf dpx_conf = {0, 0, dpx_mode_normal_mode, 0, 0, {0}};
34
35 #ifndef HAVE_LIBPAPER
36 const struct paper paperspecs[] = {
37 {"letter", 612.00, 792.00},
38 {"legal" , 612.00, 1008.00},
39 {"ledger", 1224.00, 792.00},
40 {"tabloid", 792.00, 1224.00},
41 {"a6", 297.638, 419.528},
42 {"a5", 419.528, 595.276},
43 {"a4", 595.276, 841.890},
44 {"a3", 841.890, 1190.550},
45 /*
46 * The B series paper formats were first introduced in Japanese
47 * patch (jpatch). The size of b6, ..., b5var paper is JIS paper
48 * size for this reason. Please modify the following line or use
49 * libpaper if you need ISO paper sizes.
50 */
51 #if defined(USE_ISO_PAPERSIZE) || defined(ISO_PAPERSIZE)
52 {"b6", 354.331, 498.898},
53 {"b5", 498.898, 708.661},
54 {"b4", 708.661, 1000.630},
55 {"b3", 1000.630, 1417.320},
56 #else
57 {"b6", 364.25, 515.91},
58 {"b5", 515.91, 728.50},
59 {"b4", 728.50, 1031.81},
60 {"b3", 1031.81, 1457.00},
61 {"b5var", 515.91, 651.97},
62 #endif /* USE_ISO_PAPERSIZE */
63 /* Alias for JIS and ISO */
64 {"jisb6", 364.25, 515.91},
65 {"jisb5", 515.91, 728.50},
66 {"jisb4", 728.50, 1031.81},
67 {"jisb3", 1031.81, 1457.00},
68 {"isob6", 354.331, 498.898},
69 {"isob5", 498.898, 708.661},
70 {"isob4", 708.661, 1000.630},
71 {"isob3", 1000.630, 1417.320},
72 /* -- */
73 {NULL, 0, 0},
74 };
75
76 const struct paper *
77 paperinfo (const char *ppformat)
78 {
79 const struct paper *ppinfo;
80
81 if (!ppformat)
82 return NULL;
83
84 ppinfo = paperfirst();
85 while (ppinfo && papername(ppinfo)) {
86 if (!strcmp(ppformat, ppinfo->name))
87 /* ppinfo->name == papername(ppinfo), but gcc doesn't like the latter */
88 break;
89 ppinfo = papernext(ppinfo);
90 }
91
92 return ((ppinfo && papername(ppinfo)) ? ppinfo : NULL);
93 }
94
95 #endif /* HAVE_LIBPAPER */
96
97 void
98 dumppaperinfo (void)
99 {
100 const struct paper *ppinfo;
101 ppinfo = paperfirst();
102 while (ppinfo && papername(ppinfo)) {
103 double wd, ht;
104 wd = paperpswidth (ppinfo);
105 ht = paperpsheight(ppinfo);
106 fprintf(stdout, "%s: %.2f %.2f (%.2fmm %.2fmm)\n",
107 papername(ppinfo), wd, ht, 25.4 * wd / 72.0, 25.4 * ht / 72.0);
108 ppinfo = papernext(ppinfo);
109 }
110 }