1 | /* |
---|
2 | * TransFig: Facility for Translating Fig code |
---|
3 | * Copyright (c) 1985 Supoj Sutantavibul |
---|
4 | * Copyright (c) 1991 Micah Beck |
---|
5 | * |
---|
6 | * Permission to use, copy, modify, distribute, and sell this software and its |
---|
7 | * documentation for any purpose is hereby granted without fee, provided that |
---|
8 | * the above copyright notice appear in all copies and that both that |
---|
9 | * copyright notice and this permission notice appear in supporting |
---|
10 | * documentation. The authors make no representations about the suitability |
---|
11 | * of this software for any purpose. It is provided "as is" without express |
---|
12 | * or implied warranty. |
---|
13 | * |
---|
14 | * THE AUTHORS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, |
---|
15 | * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO |
---|
16 | * EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR |
---|
17 | * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, |
---|
18 | * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
---|
19 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
---|
20 | * PERFORMANCE OF THIS SOFTWARE. |
---|
21 | * |
---|
22 | */ |
---|
23 | |
---|
24 | static char *texfontnames[] = { |
---|
25 | "rm", /* default */ |
---|
26 | "rm", /* roman */ |
---|
27 | "bf", /* bold */ |
---|
28 | "it", /* italic */ |
---|
29 | "sf", /* sans serif */ |
---|
30 | "sl", /* slanted */ |
---|
31 | "tt", /* typewriter */ |
---|
32 | /* Virtual fonts from here on */ |
---|
33 | "avant", |
---|
34 | "avantcsc", |
---|
35 | "avantd", |
---|
36 | "avantdi", |
---|
37 | "avanti", |
---|
38 | "bookd", |
---|
39 | "bookdi", |
---|
40 | "bookl", |
---|
41 | "booklcsc", |
---|
42 | "bookli", |
---|
43 | "chanc", |
---|
44 | "cour", |
---|
45 | "courb", |
---|
46 | "courbi", |
---|
47 | "couri", |
---|
48 | "helv", |
---|
49 | "helvb", |
---|
50 | "helvbi", |
---|
51 | "helvc", |
---|
52 | "helvcb", |
---|
53 | "helvcbi", |
---|
54 | "helvci", |
---|
55 | "helvcsc", |
---|
56 | "helvi", |
---|
57 | "pal", |
---|
58 | "palb", |
---|
59 | "palbi", |
---|
60 | "palbu", |
---|
61 | "palc", |
---|
62 | "palcsc", |
---|
63 | "pali", |
---|
64 | "palsl", |
---|
65 | "palu", |
---|
66 | "palx", |
---|
67 | "times", |
---|
68 | "timesb", |
---|
69 | "timesbi", |
---|
70 | "timesc", |
---|
71 | "timescsc", |
---|
72 | "timesi", |
---|
73 | "timessl", |
---|
74 | "timesx" |
---|
75 | }; |
---|
76 | |
---|
77 | #define MAX_TPICFONT 48 |
---|
78 | |
---|
79 | /* The selection of font names may be site dependent. |
---|
80 | * Not all fonts are preloaded at all sizes. |
---|
81 | */ |
---|
82 | |
---|
83 | static char *texfontsizes[] = { |
---|
84 | "ten", /* default */ |
---|
85 | "fiv", "fiv", "fiv", "fiv", /* small fonts */ |
---|
86 | "fiv", /* five point font */ |
---|
87 | "six", "sev", "egt", /* etc */ |
---|
88 | "nin", "ten", "elv", |
---|
89 | "twl", "twl", "frtn", |
---|
90 | "frtn", "frtn", "svtn", |
---|
91 | "svtn", "svtn", "twty", |
---|
92 | "twty", "twty", "twty", "twty", "twfv" |
---|
93 | }; |
---|
94 | |
---|
95 | static int TeXfontsizes[] = { |
---|
96 | 10, /* default */ |
---|
97 | 5, 5, 5, 5, /* small fonts */ |
---|
98 | 5, /* five point font */ |
---|
99 | 6, 7, 8, /* etc */ |
---|
100 | 9, 10, 11, |
---|
101 | 12, 12, 14, |
---|
102 | 14, 14, 17, |
---|
103 | 17, 17, 20, |
---|
104 | 20, 20, 20, 20, 25 |
---|
105 | }; |
---|
106 | |
---|
107 | |
---|
108 | #define MAXFONTSIZE 25 |
---|
109 | |
---|
110 | #define TEXFONT(F) (texfontnames[((F) <= MAX_TPICFONT) ? (F) : MAX_TPICFONT]) |
---|
111 | #define TEXFONTSIZE(S) (texfontsizes[((S) <= MAXFONTSIZE) ? (S) : MAXFONTSIZE]) |
---|
112 | #define TEXFONTMAG(T) TEXFONTSIZE((int)(T->size*(rigid_text(T) ? 1.0 : mag))) |
---|
113 | #define TEXFONTSIZEINT(S) (TeXfontsizes[((S) <= MAXFONTSIZE) ? (S) : MAXFONTSIZE]) |
---|
114 | #define TEXFONTMAGINT(T) TEXFONTSIZEINT((int)(T->size*(rigid_text(T) ? 1.0 : mag))) |
---|
115 | |
---|
116 | static char *texture_patterns[] = { |
---|
117 | "8 0 8 0 4 1 3 e 0 8 0 8 1 4 e 3", /* scales */ |
---|
118 | "f f 8 0 8 0 8 0 f f 0 8 0 8 0 8", /* bricks */ |
---|
119 | "8 1 4 2 2 4 1 8 8 1 4 2 2 4 1 8", /* waves */ |
---|
120 | "8 0 4 0 2 0 1 0 0 8 0 4 0 2 0 1", /* light backslash alternating */ |
---|
121 | "e 0 7 0 3 8 1 c 0 e 0 7 8 3 c 1", /* heavy backslash alternating */ |
---|
122 | "7 7 b b d d e e 7 7 b b d d e e", /* heavy backslash */ |
---|
123 | "8 8 4 4 2 2 1 1 8 8 4 4 2 2 1 1", /* light backslash */ |
---|
124 | "9 9 c c 6 6 3 3 9 9 c c 6 6 3 3", /* medium backslash */ |
---|
125 | "2 0 4 0 8 0 0 0 0 8 0 4 0 2 0 0", /* light hash */ |
---|
126 | "f f 0 0 f f 0 0 f f 0 0 f f 0 0", /* horizontal lines */ |
---|
127 | "f f 0 0 0 0 0 0 f f 0 0 0 0 0 0", /* spaced horizontal lines */ |
---|
128 | "c c 0 0 0 0 0 0 3 3 0 0 0 0 0 0", /* spaced horizontal dashed lines */ |
---|
129 | "f 0 f 0 f 0 f 0 0 f 0 f 0 f 0 f", /* chessboard */ |
---|
130 | "f f 8 8 8 8 8 8 f f 8 8 8 8 8 8", /* light meshed lines */ |
---|
131 | "a a 4 4 a a 1 1 a a 4 4 a a 1 1", /* hashed dotted lines */ |
---|
132 | "0 1 0 2 0 4 0 8 1 0 2 0 4 0 8 0", /* spaced light frontslash */ |
---|
133 | "8 3 0 7 0 e 1 c 3 8 7 0 e 0 c 1", /* spaced heavy frontslash */ |
---|
134 | "e e d d b b 7 7 e e d d b b 7 7", /* heavy frontslash */ |
---|
135 | "1 1 2 2 4 4 8 8 1 1 2 2 4 4 8 8", /* light frontslash */ |
---|
136 | "3 3 6 6 c c 9 9 3 3 6 6 c c 9 9", /* medium frontslash */ |
---|
137 | "4 0 a 0 0 0 0 0 0 4 0 a 0 0 0 0", /* wallpaper - birds */ |
---|
138 | "a a a a a a a a a a a a a a a a", /* vertical lines */ |
---|
139 | "8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8", /* spaced vertical lines */ |
---|
140 | "0 1 0 1 1 0 1 0 0 1 0 1 1 0 1 0", /* vertical dashed lines */ |
---|
141 | "0 0 0 8 1 4 2 a 5 5 2 a 1 4 0 8", /* hashed diamonds */ |
---|
142 | "f f 8 0 8 0 8 0 8 0 8 0 8 0 8 0", /* spaced meshed lines */ |
---|
143 | "8 2 4 4 2 8 1 0 2 8 4 4 8 2 0 1" /* hashed dotted lines */ |
---|
144 | }; |
---|
145 | |
---|
146 | #define MAXPATTERNS 27 |
---|