| 1 | /* |
| 2 | Copyright (c) 1992 - 1994 Heinz W. Werntges. All rights reserved. |
| 3 | Parts Copyright (c) 1999 Martin Kroeker All rights reserved. |
| 4 | |
| 5 | Distributed by Free Software Foundation, Inc. |
| 6 | |
| 7 | This file is part of HP2xx. |
| 8 | |
| 9 | HP2xx is distributed in the hope that it will be useful, but |
| 10 | WITHOUT ANY WARRANTY. No author or distributor accepts responsibility |
| 11 | to anyone for the consequences of using it or for whether it serves any |
| 12 | particular purpose or works at all, unless he says so in writing. Refer |
| 13 | to the GNU General Public License, Version 2 or later, for full details. |
| 14 | |
| 15 | Everyone is granted permission to copy, modify and redistribute |
| 16 | HP2xx, but only under the conditions described in the GNU General Public |
| 17 | License. A copy of this license is supposed to have been |
| 18 | given to you along with HP2xx so you can know your rights and |
| 19 | responsibilities. It should be in a file named COPYING. Among other |
| 20 | things, the copyright notice and this notice must be preserved on all |
| 21 | copies. |
| 22 | |
| 23 | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
| 24 | */ |
| 25 | |
| 26 | /** |
| 27 | ** This file defines a standard character set by elementary |
| 28 | ** "draw" & "move" commands. The format is a very compact one from |
| 29 | ** the old days where every byte was still appreciated. |
| 30 | ** |
| 31 | ** A font or character set is an array of strings. Each character |
| 32 | ** corresponds to one of these strings, which is addressed by its ASCII code. |
| 33 | ** |
| 34 | ** A character is a (NULL-terminated) string of bytes. Each byte |
| 35 | ** codes for a draw or move action according to the code below: |
| 36 | ** |
| 37 | ** Bit: 7 6 5 4 3 2 1 0 |
| 38 | ** p x x x y y y y |
| 39 | ** |
| 40 | ** p: Plot flag. If set, "draw to" new point, else "move to" it. |
| 41 | ** xxx: 3-bit unsigned integer (0...7). X coordinate of new point. |
| 42 | ** yyyy: 4-bit unsigned integer (0..15). Y coordinate of new point. |
| 43 | ** |
| 44 | ** The baseline is y = 4 instead of y = 0, so characters with parts |
| 45 | ** below it can be drawn properly without a need for sign bits. |
| 46 | ** Function "code_to_ucoord()" transforms these coordinates into |
| 47 | ** actual user coordinates. |
| 48 | ** |
| 49 | ** Example: code for character 'L': "\032\224\324" translates to: |
| 50 | ** moveto(1,10); drawto(1,4); drawto(5,4); |
| 51 | ** |
| 52 | ** From the example you can conclude that the font below essentially is |
| 53 | ** defined on a 5x7 grid: |
| 54 | ** |
| 55 | ** 0 1 2 3 4 5 6 7 |
| 56 | ** 15 . . . . . . . . . : unused |
| 57 | ** 14 . . . . . . . . * : always used |
| 58 | ** 13 . . . . . . . . o : sometimes used |
| 59 | ** 12 . . . . . . . . |
| 60 | ** 11 . . . . . . . . |
| 61 | ** 10 o * * * * * . . |
| 62 | ** 9 o * * * * * . . |
| 63 | ** 8 o * * * * * . . |
| 64 | ** 7 o * * * * * . . |
| 65 | ** 6 o * * * * * . . |
| 66 | ** 5 o * * * * * . . |
| 67 | ** 4 o * * * * * . . |
| 68 | ** 3 o o o o o o . . |
| 69 | ** 2 o o o o o o . . |
| 70 | ** 1 o o o o o o . . |
| 71 | ** 0 o o o o o o . . |
| 72 | **/ |
| 73 | |
| 74 | |
| 75 | /** |
| 76 | ** The following array of strings contains the ps math font (173), |
| 77 | ** which differs from ventura math (205) only in the sequence of |
| 78 | ** characters in the upper half of the font |
| 79 | **/ |
| 80 | |
| 81 | char *charset173[256] = { |
| 82 | /* 0x00 ... 0x1f */ |
| 83 | |
| 84 | /** |
| 85 | ** Some control codes are valid in HPGL. These are handled elsewhere |
| 86 | ** in a font-independent manner, so following codes are dummies: |
| 87 | **/ |
| 88 | "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", |
| 89 | "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", |
| 90 | |
| 91 | /** |
| 92 | ** Unfortunately, some compilers do not process \xNN properly, |
| 93 | ** so I changed all hex codes (\xNN) into octal codes (\NNN), |
| 94 | ** thereby losing readability but gaining portability. |
| 95 | **/ |
| 96 | /* 0x20 ... 0x2f */ |
| 97 | "", /*space */ |
| 98 | "\064\265\066\272", /*exclam */ |
| 99 | "\031\264\331\047\307", /*forall */ |
| 100 | "\044\252\104\312\026\326\030\330", /*hash */ |
| 101 | "\031\271\265\225\067\227", /*exists */ |
| 102 | "\024\332\051\250\270\271\251\066\265\305\306\266", /* percent */ |
| 103 | "\124\230\231\252\271\270\226\225\244\264\326", /*ampersand */ |
| 104 | "\031\251\270\267\266\225\067\227", /*ni */ |
| 105 | "\132\270\266\324", /* opening brace */ |
| 106 | "\024\266\270\232", /* closing brace */ |
| 107 | "\005\351\145\211\072\264", /* asterisk */ |
| 108 | "\065\271\027\327", /* plus */ |
| 109 | "\064\244\245\265\263\242", /* comma */ |
| 110 | "\027\327", /* minus */ |
| 111 | "\064\244\245\265\264", /* dot */ |
| 112 | "\352", /* slash */ |
| 113 | |
| 114 | /* 0x30 ... 0x3f */ |
| 115 | "\025\244\304\325\331\312\252\231\225", |
| 116 | "\044\304\064\272\251", |
| 117 | "\031\252\312\331\330\225\224\324", |
| 118 | "\025\244\304\325\326\307\267\332\232", |
| 119 | "\112\227\226\326\107\304", |
| 120 | "\132\232\230\310\327\325\304\244\225", |
| 121 | "\132\272\230\225\244\304\325\326\307\227", |
| 122 | "\032\332\331\226\224", |
| 123 | "\107\330\331\312\252\231\230\247\307\326\325\304\244\225\226\247", |
| 124 | "\044\264\326\331\312\252\231\230\247\327", |
| 125 | "\047\250\270\267\247\045\265\264\244\245", |
| 126 | "\046\247\267\266\246\064\244\245\265\263\242", |
| 127 | "\112\227\304", |
| 128 | "\030\330\026\326", |
| 129 | "\032\307\224", |
| 130 | "\031\252\312\331\330\307\267\266\065\264", |
| 131 | |
| 132 | /* 0x40 ... 0x4f */ |
| 133 | "\025\325\027\327\030\251\270\310\331", /*congruent */ |
| 134 | "\024\231\252\312\331\324\026\326", /* A */ |
| 135 | "\024\232\312\331\330\307\227\024\304\325\326\307", /*B*/ "\024\332\124\232", /* Chi (X) */ |
| 136 | "\024\272\324\224", /*Delta */ |
| 137 | "\124\224\232\332\027\307", /*E*/ "\052\312\072\264\044\304\027\251\311\327\305\245\227", /*Phi */ |
| 138 | "\052\332\330\072\264\044\304", /*Gamma */ |
| 139 | "\024\232\124\332\027\327", /*H*/ "\024\324\064\272\032\332", /*I*/ "\027\304\330\331\271\270\326", /*vartheta */ |
| 140 | "\024\232\027\247\324\047\332", /*K*/ "\024\272\324", /*Lambda */ |
| 141 | "\024\232\270\332\324", /*M*/ |
| 142 | "\024\232\324\332", /*N*/ |
| 143 | "\044\225\231\252\312\331\325\304\244", /*O*/ |
| 144 | /* 0x50 ... 0x5f */ |
| 145 | "\044\252\032\332\112\304", /*Pi */ |
| 146 | "\044\225\231\252\312\331\325\304\244\027\327", /*Theta */ |
| 147 | "\024\232\312\331\330\307\227", /*Rho (P) */ |
| 148 | "\044\252\032\332\112\304", /*Sigma */ |
| 149 | "\064\272\232\332", /*T*/ "\032\231\266\264\066\331\332", /*Y*/ "\042\262\303\304\225\226\247\307", /*varsigma */ |
| 150 | "\024\244\226\231\252\312\331\326\304\324", /*Omega */ |
| 151 | "\031\232\332\331\050\246\047\307\110\306\025\224\324\325", /*Xi */ |
| 152 | "\030\250\246\306\310\330\052\312\072\264\044\304", /*Psi */ |
| 153 | "\032\332\224\324", /*Z*/ "\124\264\272\332", /*opening bracket */ |
| 154 | "\004\224\225\205\204\104\324\325\305\304\051\271\272\252\251", /*point triangle */ |
| 155 | "\024\264\272\232", /* closing bracket */ |
| 156 | "\024\324\064\270", /*bottom */ |
| 157 | "\023\323", /*underline */ |
| 158 | |
| 159 | /* 0x60 ... 0x6f */ |
| 160 | |
| 161 | "\034\334", /*overline */ |
| 162 | "\025\227\250\270\307\305\264\244\225\107\330\105\324", /* alpha */ |
| 163 | "\044\251\272\311\310\267\306\304\264\245", /* beta */ |
| 164 | "\027\250\267\265\304\325\024\330", /* chi */ |
| 165 | "\045\246\267\307\326\325\304\264\245\107\271\312\331", /*delta */ |
| 166 | "\127\310\250\227\246\266\046\225\244\304\325", /* epsilon */ |
| 167 | "\026\247\307\326\305\245\226\064\270", /*phi */ |
| 168 | "\027\226\303\262\243\326\327", /*gamma */ |
| 169 | "\030\247\270\310\327\322\047\245", /* eta */ |
| 170 | "067\264\304\305", /* iota */ |
| 171 | "\030\227\246\306\327\310\270\264\244", /*varphi */ |
| 172 | "\050\244\046\266\330\066\305\304\324", /* kappa */ |
| 173 | "\031\251\250\324\024\266", /* lambda */ |
| 174 | "\024\250\246\265\306\310\106\325", /* mu */ |
| 175 | "\030\226\264\326\327\310", /* nu */ |
| 176 | "\044\225\227\250\270\307\305\264\244", /*o */ |
| 177 | |
| 178 | /* 0x70 ... 0x7f */ |
| 179 | "\044\247\104\307\027\250\267\307\330", /* pi */ |
| 180 | "\045\264\305\311\272\251\245\047\307", /* theta */ |
| 181 | "\023\246\267\307\326\325\304\264\245", /*rho */ |
| 182 | "\045\246\267\307\326\325\304\264\245\107\330", /*sigma */ |
| 183 | "\026\267\327\067\264\324", /*tau */ |
| 184 | "\030\226\264\326\330", /*v */ |
| 185 | "\050\227\225\244\265\266\065\304\325\327\310\047\307", /*var pi */ |
| 186 | "\050\227\225\244\265\266\065\304\325\327\310", /*omega */ |
| 187 | "\051\250\267\307\330\270\246\265\305\326\266\244\243\262\322\321\301", /*xi */ |
| 188 | "\027\247\265\305\327\110\264", /*psi */ |
| 189 | "\051\250\267\307\330\270\246\244\243\262\322\321\301", /*zeta */ |
| 190 | "\113\273\252\250\227\246\244\263\303", /* opening curly brace */ |
| 191 | "\073\263", /* vertical bar */ |
| 192 | "\053\273\312\310\327\306\304\263\243", /*closing curly brace */ |
| 193 | "\027\250\267\307\330", /* similar */ |
| 194 | "", /*blank */ |
| 195 | |
| 196 | /* 0x80 ... 0x9f */ |
| 197 | "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", |
| 198 | "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", |
| 199 | |
| 200 | /* 0xa0 ... 0xaf */ |
| 201 | |
| 202 | "", /* space */ |
| 203 | "\030\251\270\311\330\070\264\044\304", /* Upsilon */ |
| 204 | "\071\312", /* prime */ |
| 205 | "\025\325\227\331", /*lessorequal */ |
| 206 | "\352", /* slash */ |
| 207 | "\026\226\247\247\266\266\245\245\226\66\266\307\326\305\266", /*infinity */ |
| 208 | "\131\332\312\270\265\244\224\225\050\310", /* math function */ |
| 209 | "\026\247\266\245\226\066\307\326\305\266\067\250\271\310\267\067\264", /*clubsuit */ |
| 210 | "\026\271\326\263\226", /* diamondsuit */ |
| 211 | "\030\252\271\312\330\265\230", /* heartsuit */ |
| 212 | "\026\271\326\305\267\245\226\067\264", /* spadesuit */ |
| 213 | "\027\327\106\327\310\046\227\250", /* leftrightarrow */ |
| 214 | "\027\327\046\227\250", /* leftarrow */ |
| 215 | "\072\264\030\272\330", /*uparrow */ |
| 216 | "\027\327\106\327\310", /*rightarrow */ |
| 217 | "\072\264\026\264\326", /* downarrow */ |
| 218 | |
| 219 | |
| 220 | |
| 221 | /* 0xb0 ... 0xbf */ |
| 222 | "\050\251\272\311\310\267\250", /* degree */ |
| 223 | "\065\271\027\327\025\325", /* plusminus */ |
| 224 | "\051\252\111\312", /* two primes */ |
| 225 | "\125\225\327\231", /*greaterorequal */ |
| 226 | "\045\310\050\305", /* times */ |
| 227 | "\026\226\247\247\266\266\245\245\226\66\266\307\066\305", /* propto */ |
| 228 | "\050\271\311\305\264\244\225\226\267\306", /* partial */ |
| 229 | "\047\270\307\266\247", /* circle */ |
| 230 | "\027\327\065\266\071\272", /*divide */ |
| 231 | "\030\330\026\326\045\311", /*notequal */ |
| 232 | "\025\325\027\327\031\331", /* identity */ |
| 233 | "\026\247\266\306\327\030\251\270\310\331", /* approx */ |
| 234 | "\024\225\064\265\124\325", /* ellipsis */ |
| 235 | "\072\264", /* center part of braces and brackets */ |
| 236 | "\027\327", /* horiz line */ |
| 237 | "\027\327\046\227\250\127\330", /* leftanglearrow */ |
| 238 | |
| 239 | /* 0xc0 ... 0xcf */ |
| 240 | |
| 241 | "\024\245\247\130\307\305\030\324", /* aleph */ |
| 242 | "\050\231\252\272\330\132\310\305\264\244\225", /* Im */ |
| 243 | "\050\231\252\312\330\307\305\324\107\267\072\265\244\225", /* Re */ |
| 244 | "\030\227\245\243\222\224\246\247\270\310\327\325\304\264\245", /*wp */ |
| 245 | "\027\230\251\311\330\326\305\245\226\227\045\310\050\305", /* otimes */ |
| 246 | "\027\230\251\311\330\326\305\245\226\227\071\265\027\327", /*oplus */ |
| 247 | "\027\251\311\327\305\245\227\024\332", /* oslash */ |
| 248 | "\025\230\251\311\330\325", /* cap */ |
| 249 | "\031\226\245\305\326\331", /* cup */ |
| 250 | "\025\305\326\330\311\231", /* superset */ |
| 251 | "\026\306\327\310\230\024\324", /* supsetequal */ |
| 252 | "\125\245\226\230\251\331\045\311", /* not subset */ |
| 253 | "\125\245\226\230\251\331", /* subset */ |
| 254 | "\126\246\227\250\330\024\324", /*subsetequal */ |
| 255 | "\125\245\226\230\251\331\027\327", /* in */ |
| 256 | "\125\245\226\230\251\331\027\327\045\311", /* not in */ |
| 257 | |
| 258 | /* 0xd0 ... 0xdf */ |
| 259 | |
| 260 | "\132\224\324", /* angle */ |
| 261 | "\032\332\264\232", /* nabla */ |
| 262 | "\027\230\251\311\330\326\305\245\226\227\046\250\270\267\247\266", /* registered */ |
| 263 | "\027\230\251\311\330\326\305\245\226\227\110\270\247\266\306", /* copyright */ |
| 264 | "\032\272\052\250\070\272\311\332\330", /* TM */ |
| 265 | "\024\231\124\331\031\331", /* prod */ |
| 266 | "\026\246\264\311\331", /* root */ |
| 267 | "\066\267", /* centered dot */ |
| 268 | "\026\326\325", /* neg */ |
| 269 | "\024\267\324", /*wedge */ |
| 270 | "\030\264\330", /* vee */ |
| 271 | "\045\305\047\307\070\226\264\070\326\264", /* leftright doublearrow */ |
| 272 | "\045\325\047\327\070\226\264", /* left doublearrow */ |
| 273 | "\044\250\104\310\027\272\327", /* up doublearrow */ |
| 274 | "\025\305\027\307\070\326\264", /* right doublearrow */ |
| 275 | "\052\245\112\305\026\264\326", /* down doublearrow */ |
| 276 | |
| 277 | /* 0xe0 ... 0xef */ |
| 278 | |
| 279 | "\026\270\326\264\226", /* diamond */ |
| 280 | "\112\247\304", /* opening angle bracket */ |
| 281 | "\027\230\251\311\330\326\305\245\226\227\046\250\270\267\247\266", /*registered */ |
| 282 | "\027\230\251\311\330\326\305\245\226\227\110\270\247\266\306", /* copyright */ |
| 283 | "\032\272\052\250\070\272\311\332\330", /* TM */ |
| 284 | "\044\252\032\332\112\304", /*Sigma */ |
| 285 | "\112\270\264", /* top third of opening brace */ |
| 286 | "\072\264", /* center part of braces and brackets */ |
| 287 | "\072\266\304", /* lower third of opening brace */ |
| 288 | "\112\272\264", /* upper third of opening bracket */ |
| 289 | "\072\264", /* center part of braces and brackets */ |
| 290 | "\072\264\304", /* lower third of opening bracket */ |
| 291 | "\112\270\264", /* top third of opening brace */ |
| 292 | "\072\270\247\266\264", /* center part of opening curly brace */ |
| 293 | "\072\266\324", /* lower third of opening round brace */ |
| 294 | "\072\264", /* center part of braces and brackets */ |
| 295 | |
| 296 | /* 0xf0 ... 0xff */ |
| 297 | |
| 298 | "", /* empty */ |
| 299 | "\052\307\244", /* closing angle bracket */ |
| 300 | "\024\243\264\272\313\332", /* integral */ |
| 301 | "\112\270\264", /* top third of opening brace */ |
| 302 | "\072\264", /* center part of braces */ |
| 303 | "\072\266\224", /* lower third of closing brace */ |
| 304 | "\052\270\264", /* top third of closing brace */ |
| 305 | "\072\264", /* center part of braces */ |
| 306 | "\072\266\224", /* lower third of closing brace */ |
| 307 | "\052\272\264", /* upper third of closing bracket */ |
| 308 | "\072\264", /* center part of braces */ |
| 309 | "\072\264\244", /* lower third of closing bracket */ |
| 310 | "\052\270\264", /* top third of closing brace */ |
| 311 | "\072\270\307\266\264", /* center part of closing curly brace */ |
| 312 | "\072\266\224", /* lower third of closing brace */ |
| 313 | "" /* blank */ |
| 314 | }; |