mktrfn: include glyph bounding box with -b
[neatmkfn.git] / trfn_ch.h
blob1a6f8b7b8c54a617fee6a34cfafd49ea2d5d7322
1 /* ligatures */
2 static char *ligs[] = {
3 "fh", "fi", "fj", "fk", "fl", "ff", "ffi", "ffj", "ffl", "fft", "ft", "Th"
4 };
6 /* AGL exceptions; expanding ligatures */
7 static char *agl_exceptions[][2] = {
8 {"ff", "ff"},
9 {"fi", "fi"},
10 {"fl", "fl"},
11 {"ffi", "ffi"},
12 {"ffl", "ffl"},
13 {"st", "st"},
16 /* troff aliases */
17 static char *alts[][8] = {
18 {"\\", "bs"},
19 {"`", "ga"},
20 {"¡", "!!"},
21 {"¢", "c|", "ct"},
22 {"£", "L-", "ps"},
23 {"¤", "xo", "cr"},
24 {"¥", "Y-", "yn"},
25 {"¦", "||"},
26 {"§", "so", "sc"},
27 {"¨", "\"\"", ":a"},
28 {"©", "co"},
29 {"ª", "a_"},
30 {"«", "<<"},
31 {"¬", "-,", "no"},
32 {"-", "hy"},
33 {"®", "ro", "rg"},
34 {"¯", "a^", "-a"},
35 {"°", "0^"},
36 {"²", "2^"},
37 {"³", "3^"},
38 {"´", "\\'", "aa"},
39 {"µ", "/u"},
40 {"¶", "P!", "pg"},
41 {"·", ".^"},
42 {"¸", ",,", ",a"},
43 {"¹", "1^"},
44 {"º", "o_"},
45 {"»", ">>"},
46 {"¼", "14"},
47 {"½", "12"},
48 {"¾", "34"},
49 {"¿", "??"},
50 {"À", "A`"},
51 {"Á", "A'"},
52 {"Â", "A^"},
53 {"Ã", "A~"},
54 {"Ä", "A:", "A\""},
55 {"Å", "A*"},
56 {"Æ", "AE"},
57 {"Ç", "C,"},
58 {"Č", "C<"},
59 {"È", "E`"},
60 {"É", "E'"},
61 {"Ê", "E^"},
62 {"Ë", "E:", "E\""},
63 {"Ì", "I`"},
64 {"Í", "I'"},
65 {"Î", "I^"},
66 {"Ï", "I:", "I\""},
67 {"Ð", "D-"},
68 {"Ď", "D<"},
69 {"Ñ", "N~"},
70 {"Ò", "O`"},
71 {"Ó", "O'"},
72 {"Ô", "O^"},
73 {"Õ", "O~"},
74 {"Ö", "O:"},
75 {"Ő", "O\""},
76 {"×", "xx", "mu"},
77 {"Ø", "O/"},
78 {"Ř", "R<"},
79 {"Š", "S<"},
80 {"Ť", "T<"},
81 {"Ù", "U`"},
82 {"Ú", "U'"},
83 {"Û", "U^"},
84 {"Ü", "U:"},
85 {"Ű", "U\""},
86 {"Ů", "U0"},
87 {"Ý", "Y'"},
88 {"Ÿ", "Y:", "Y\""},
89 {"Ž", "Z<"},
90 {"Þ", "TH"},
91 {"ß", "ss"},
92 {"à", "a`"},
93 {"á", "a'"},
94 {"â", "a^"},
95 {"ã", "a~"},
96 {"ä", "a:", "a\""},
97 {"å", "a*"},
98 {"æ", "ae"},
99 {"ç", "c,"},
100 {"č", "c<"},
101 {"ď", "d<"},
102 {"è", "e`"},
103 {"é", "e'"},
104 {"ê", "e^"},
105 {"ë", "e:", "e\""},
106 {"ě", "e<"},
107 {"ì", "i`"},
108 {"í", "i'"},
109 {"î", "i^"},
110 {"ï", "i\""},
111 {"ð", "d-"},
112 {"ñ", "n~"},
113 {"ň", "n<"},
114 {"ò", "o`"},
115 {"ó", "o'"},
116 {"ô", "o^"},
117 {"õ", "o~"},
118 {"ö", "o:"},
119 {"ő", "o\""},
120 {"÷", "-:"},
121 {"ø", "o/"},
122 {"ř", "r<"},
123 {"š", "s<"},
124 {"ť", "t<"},
125 {"ù", "u`"},
126 {"ú", "u'"},
127 {"û", "u^"},
128 {"ü", "u:"},
129 {"ű", "u\""},
130 {"ů", "u0"},
131 {"ý", "y'"},
132 {"ž", "z<"},
133 {"þ", "th"},
134 {"ÿ", "y:", "y\""},
135 {"˘", "Ua"},
136 {"˙", ".a"},
137 {"˚", "oa"},
138 {"˝", "\"a"},
139 {"˛", "Ca"},
140 {"ˇ", "va"},
141 {"∀", "fa"},
142 {"∃", "te"},
143 {"∋", "st"},
144 {"∗", "**"},
145 {"+", "pl"},
146 {"−", "mi"},
147 {"/", "sl"},
148 {"=", "eq"},
149 {"≅", "cg"},
150 {"Α", "*A"},
151 {"Β", "*B"},
152 {"Χ", "*X"},
153 {"∆", "*D"},
154 {"Ε", "*E"},
155 {"Φ", "*F"},
156 {"Γ", "*G"},
157 {"Η", "*Y"},
158 {"Ι", "*I"},
159 {"Κ", "*K"},
160 {"Λ", "*L"},
161 {"Μ", "*M"},
162 {"Ν", "*N"},
163 {"Ο", "*O"},
164 {"Π", "*P"},
165 {"Θ", "*H"},
166 {"Ρ", "*R"},
167 {"Σ", "*S"},
168 {"Τ", "*T"},
169 {"Υ", "*U"},
170 {"ς", "ts"},
171 {"Ω", "*W"},
172 {"Ξ", "*C"},
173 {"Ψ", "*Q"},
174 {"Ζ", "*Z"},
175 {"∴", "tf"},
176 {"⊥", "pp"},
177 {"", "rn"},
178 {"α", "*a"},
179 {"β", "*b"},
180 {"χ", "*x"},
181 {"δ", "*d"},
182 {"ε", "*e"},
183 {"φ", "*f"},
184 {"γ", "*g"},
185 {"η", "*y"},
186 {"ι", "*i"},
187 {"κ", "*k"},
188 {"λ", "*l"},
189 {"μ", "*m"},
190 {"ν", "*n"},
191 {"ο", "*o"},
192 {"π", "*p"},
193 {"θ", "*h"},
194 {"ρ", "*r"},
195 {"σ", "*s"},
196 {"τ", "*t"},
197 {"υ", "*u"},
198 {"ω", "*w"},
199 {"ξ", "*c"},
200 {"ψ", "*q"},
201 {"ζ", "*z"},
202 {"|", "or"},
203 {"∼", "ap"},
204 {"′", "fm"},
205 {"≤", "<="},
206 {"⁄", "fr"},
207 {"∞", "if"},
208 {"ƒ", "fn",},
209 {"↔", "ab"},
210 {"←", "<-"},
211 {"↑", "ua"},
212 {"→", "->"},
213 {"↓", "da"},
214 {"°", "de"},
215 {"±", "+-"},
216 {"≥", ">="},
217 {"∝", "pt"},
218 {"∂", "pd"},
219 {"•", "bu"},
220 {"÷", "di"},
221 {"≠", "!="},
222 {"≡", "=="},
223 {"≈", "~~"},
224 {"…", "el"},
225 {"", "av"},
226 {"", "ah"},
227 {"↵", "CR"},
228 {"ℵ", "af"},
229 {"ℑ", "If"},
230 {"ℜ", "Rf"},
231 {"ℛ", "ws"},
232 {"⊗", "Ox"},
233 {"⊕", "O+"},
234 {"∅", "es"},
235 {"∩", "ca"},
236 {"∪", "cu"},
237 {"⊃", "sp"},
238 {"⊇", "ip"},
239 {"⊄", "!b"},
240 {"⊂", "sb"},
241 {"⊆", "ib"},
242 {"∈", "mo"},
243 {"∉", "!m"},
244 {"∠", "an"},
245 {"∇", "gr"},
246 {"", "rg"},
247 {"", "co"},
248 {"", "tm"},
249 {"∏", "pr"},
250 {"√", "sr"},
251 {"⋅", "c."},
252 {"∧", "l&"},
253 {"∨", "l|"},
254 {"◊", "lz"},
255 {"〈", "b<"},
256 {"", "RG"},
257 {"", "CO"},
258 {"", "TM"},
259 {"∑", "su"},
260 {"", "LT"},
261 {"", "br", "LX"},
262 {"", "LB"},
263 {"", "lc"},
264 {"", "lx"},
265 {"", "lf"},
266 {"", "lt"},
267 {"", "lk"},
268 {"", "lb"},
269 {"", "bv", "|",},
270 {"〉", "b>"},
271 {"∫", "is"},
272 {"", "RT"},
273 {"", "RX"},
274 {"", "RB"},
275 {"", "rc"},
276 {"", "rx"},
277 {"", "rf"},
278 {"", "rt"},
279 {"", "rk"},
280 {"", "rb"},
281 {"_", "ru", "ul"},
282 {"”", "''"},
283 {"“", "``"},
284 {"†", "dg"},
285 {"‡", "dd"},
286 {"–", "en", "\\-"},
287 {"—", "em", "--"},
288 {"ff", "ff"},
289 {"fi", "fi"},
290 {"fl", "fl"},
291 {"ffi", "ffi"},
292 {"ffl", "ffl"},
293 {"st", "st"},
296 /* different shapes of arabic and farsi characters */
297 static struct achar {
298 char *name;
299 unsigned c;
300 unsigned s;
301 unsigned i;
302 unsigned m;
303 unsigned f;
304 } achars[] = {
305 {"hamza", 0x0621, 0xfe80},
306 {"alefwithmaddaabove", 0x0622, 0xfe81, 0, 0, 0xfe82},
307 {"alefwithhamzaabove", 0x0623, 0xfe83, 0, 0, 0xfe84},
308 {"wawwithhamzaabove", 0x0624, 0xfe85, 0, 0, 0xfe86},
309 {"alefwithhamzabelow", 0x0625, 0xfe87, 0, 0, 0xfe88},
310 {"yehwithhamzaabove", 0x0626, 0xfe89, 0xfe8b, 0xfe8c, 0xfe8a},
311 {"alef", 0x0627, 0xfe8d, 0, 0, 0xfe8e},
312 {"arabicalef", 0x0627},
313 {"beh", 0x0628, 0xfe8f, 0xfe91, 0xfe92, 0xfe90},
314 {"tehmarbuta", 0x0629, 0xfe93, 0, 0, 0xfe94},
315 {"teh", 0x062a, 0xfe95, 0xfe97, 0xfe98, 0xfe96},
316 {"theh", 0x062b, 0xfe99, 0xfe9b, 0xfe9c, 0xfe9a},
317 {"jeem", 0x062c, 0xfe9d, 0xfe9f, 0xfea0, 0xfe9e},
318 {"hah", 0x062d, 0xfea1, 0xfea3, 0xfea4, 0xfea2},
319 {"khah", 0x062e, 0xfea5, 0xfea7, 0xfea8, 0xfea6},
320 {"dal", 0x062f, 0xfea9, 0, 0, 0xfeaa},
321 {"thal", 0x0630, 0xfeab, 0, 0, 0xfeac},
322 {"reh", 0x0631, 0xfead, 0, 0, 0xfeae},
323 {"zain", 0x0632, 0xfeaf, 0, 0, 0xfeb0},
324 {"seen", 0x0633, 0xfeb1, 0xfeb3, 0xfeb4, 0xfeb2},
325 {"sheen", 0x0634, 0xfeb5, 0xfeb7, 0xfeb8, 0xfeb6},
326 {"sad", 0x0635, 0xfeb9, 0xfebb, 0xfebc, 0xfeba},
327 {"dad", 0x0636, 0xfebd, 0xfebf, 0xfec0, 0xfebe},
328 {"tah", 0x0637, 0xfec1, 0xfec3, 0xfec4, 0xfec2},
329 {"zah", 0x0638, 0xfec5, 0xfec7, 0xfec8, 0xfec6},
330 {"ain", 0x0639, 0xfec9, 0xfecb, 0xfecc, 0xfeca},
331 {"ghain", 0x063a, 0xfecd, 0xfecf, 0xfed0, 0xfece},
332 {"tatweel", 0x0640},
333 {"feh", 0x0641, 0xfed1, 0xfed3, 0xfed4, 0xfed2},
334 {"qaf", 0x0642, 0xfed5, 0xfed7, 0xfed8, 0xfed6},
335 {"kaf", 0x0643, 0xfed9, 0xfedb, 0xfedc, 0xfeda},
336 {"lam", 0x0644, 0xfedd, 0xfedf, 0xfee0, 0xfede},
337 {"meem", 0x0645, 0xfee1, 0xfee3, 0xfee4, 0xfee2},
338 {"noon", 0x0646, 0xfee5, 0xfee7, 0xfee8, 0xfee6},
339 {"heh", 0x0647, 0xfee9, 0xfeeb, 0xfeec, 0xfeea},
340 {"waw", 0x0648, 0xfeed, 0, 0, 0xfeee},
341 {"alefmaksura", 0x0649, 0xfeef, 0, 0, 0xfef0},
342 {"yeh", 0x064a, 0xfef1, 0xfef3, 0xfef4, 0xfef2},
343 {"fathatan", 0x064b, 0xfe70},
344 {"dammatan", 0x064c, 0xfe72},
345 {"kasratan", 0x064d, 0xfe74},
346 {"fatha", 0x064e, 0xfe76, 0, 0xfe77, 0},
347 {"damma", 0x064f, 0xfe78, 0, 0xfe79, 0},
348 {"kasra", 0x0650, 0xfe7a, 0, 0xfe7b, 0},
349 {"shadda", 0x0651, 0xfe7c, 0, 0xfe7c, 0},
350 {"sukun", 0x0652, 0xfe7e, 0, 0xfe7f, 0},
351 {"peh", 0x067e, 0xfb56, 0xfb58, 0xfb59, 0xfb57},
352 {"tcheh", 0x0686, 0xfb7a, 0xfb7c, 0xfb7d, 0xfb7b},
353 {"jeh", 0x0698, 0xfb8a, 0, 0, 0xfb8b},
354 {"keheh", 0x06a9, 0xfb8e, 0xfb90, 0xfb91, 0xfb8f},
355 {"gaf", 0x06af, 0xfb92, 0xfb94, 0xfb95, 0xfb93},
356 {"farsiyeh", 0x06cc, 0xfbfc, 0xfbfe, 0xfbff, 0xfbfd},
357 {"lamwithalef", 0xfefb, 0xfefb, 0, 0, 0xfefc},
358 {"arabiccomma", 0x060c},
359 {"arabicsemicolon", 0x061b},
360 {"arabicquestionmark", 0x061f},
361 {"arabicindicdigitzero", 0x0660},
362 {"arabicindicdigitone", 0x0661},
363 {"arabicindicdigittwo", 0x0662},
364 {"arabicindicdigitthree", 0x0663},
365 {"arabicindicdigitfour", 0x0664},
366 {"arabicindicdigitfive", 0x0665},
367 {"arabicindicdigitsix", 0x0666},
368 {"arabicindicdigitseven", 0x0667},
369 {"arabicindicdigiteight", 0x0668},
370 {"arabicindicdigitnine", 0x0669},
371 {"arabicpercentsign", 0x066a},
372 {"extendedarabicindicdigitzero", 0x06f0},
373 {"extendedarabicindicdigitone", 0x06f1},
374 {"extendedarabicindicdigittwo", 0x06f2},
375 {"extendedarabicindicdigitthree", 0x06f3},
376 {"extendedarabicindicdigitfour", 0x06f4},
377 {"extendedarabicindicdigitfive", 0x06f5},
378 {"extendedarabicindicdigitsix", 0x06f6},
379 {"extendedarabicindicdigitseven", 0x06f7},
380 {"extendedarabicindicdigiteight", 0x06f8},
381 {"extendedarabicindicdigitnine", 0x06f9},
382 {"zeronojoin", 0x200c},
383 {"zerojoin", 0x200d},
386 static struct ctype {
387 char *ch; /* character name */
388 int type; /* ascender/descender type */
389 } ctype[] = {
390 {"Ï", 2},
391 {"²", 2},
392 {"ì", 2},
393 {"u", 0},
394 {"Ì", 2},
395 {"U", 2},
396 {"∞", 0},
397 {"ú", 2},
398 {"∫", 3},
399 {"Ú", 2},
400 {"a", 0},
401 {"ι", 0},
402 {"û", 2},
403 {"A", 2},
404 {"Ι", 2},
405 {"Û", 2},
406 {"á", 2},
407 {"j", 3},
408 {"ü", 2},
409 {"Á", 2},
410 {"J", 3},
411 {"Ü", 2},
412 {"â", 2},
413 {"k", 2},
414 {"ù", 2},
415 {"Â", 2},
416 {"K", 2},
417 {"Ù", 2},
418 {"´", 2},
419 {"κ", 0},
420 {"ű", 2},
421 {"ä", 2},
422 {"Κ", 2},
423 {"Ű", 2},
424 {"Ä", 2},
425 {"l", 2},
426 {"_", 1},
427 {"æ", 0},
428 {"L", 2},
429 {"υ", 0},
430 {"Æ", 2},
431 {"λ", 2},
432 {"Υ", 2},
433 {"à", 2},
434 {"Λ", 2},
435 {"ů", 2},
436 {"À", 2},
437 {"<", 0},
438 {"Ů", 2},
439 {"α", 0},
440 {"≤", 2},
441 {"v", 0},
442 {"Α", 2},
443 {"¬", 0},
444 {"V", 2},
445 {"&", 2},
446 {"◊", 2},
447 {"w", 0},
448 {"≈", 0},
449 {"m", 0},
450 {"W", 2},
451 {"å", 2},
452 {"M", 2},
453 {"x", 0},
454 {"Å", 2},
455 {"¯", 2},
456 {"X", 2},
457 {"^", 2},
458 {"−", 0},
459 {"ξ", 3},
460 {"~", 0},
461 {"µ", 1},
462 {"Ξ", 2},
463 {"*", 2},
464 {"Μ", 2},
465 {"y", 1},
466 {"@", 3},
467 {"×", 0},
468 {"Y", 2},
469 {"ã", 2},
470 {"n", 0},
471 {"ý", 3},
472 {"Ã", 2},
473 {"N", 2},
474 {"Ý", 2},
475 {"b", 2},
476 {"ň", 2},
477 {"ÿ", 3},
478 {"B", 2},
479 {"9", 2},
480 {"¥", 2},
481 {"\\", 2},
482 {"≠", 0},
483 {"z", 0},
484 {"|", 3},
485 {"ñ", 2},
486 {"Z", 2},
487 {"β", 3},
488 {"Ñ", 2},
489 {"ž", 2},
490 {"Β", 2},
491 {"ν", 0},
492 {"Ž", 2},
493 {"{", 3},
494 {"Ν", 2},
495 {"0", 2},
496 {"}", 3},
497 {"#", 2},
498 {"ζ", 3},
499 {"[", 3},
500 {"o", 0},
501 {"Ζ", 2},
502 {"]", 3},
503 {"O", 2},
504 {"", 3},
505 {"˘", 2},
506 {"ó", 2},
507 {"", 2},
508 {"¦", 3},
509 {"Ó", 2},
510 {"", 3},
511 {"•", 0},
512 {"ô", 2},
513 {"", 2},
514 {"c", 0},
515 {"Ô", 2},
516 {"", 2},
517 {"C", 2},
518 {"ö", 2},
519 {"", 2},
520 {"ˇ", 2},
521 {"Ö", 2},
522 {"", 2},
523 {"č", 2},
524 {"˛", 1},
525 {"", 2},
526 {"Č", 2},
527 {"ò", 2},
528 {"", 2},
529 {"ç", 1},
530 {"Ò", 2},
531 {"،", 0},
532 {"Ç", 3},
533 {"ő", 2},
534 {"؛", 2},
535 {"¸", 1},
536 {"Ő", 2},
537 {"؟", 2},
538 {"¢", 2},
539 {"ω", 0},
540 {"٠", 0},
541 {"χ", 1},
542 {"Ω", 2},
543 {"١", 2},
544 {"Χ", 2},
545 {"ο", 0},
546 {"٢", 2},
547 {"ˆ", 2},
548 {"Ο", 2},
549 {"٣", 2},
550 {":", 0},
551 {"1", 2},
552 {"٤", 2},
553 {",", 1},
554 {"½", 2},
555 {"٥", 2},
556 {"©", 2},
557 {"¼", 2},
558 {"٦", 2},
559 {"¤", 2},
560 {"¹", 2},
561 {"٧", 2},
562 {"d", 2},
563 {"ª", 2},
564 {"٨", 2},
565 {"D", 2},
566 {"º", 2},
567 {"٩", 2},
568 {"ď", 2},
569 {"ø", 0},
570 {"۰", 0},
571 {"Ď", 2},
572 {"Ø", 2},
573 {"۱", 2},
574 {"°", 2},
575 {"õ", 2},
576 {"۲", 2},
577 {"δ", 2},
578 {"Õ", 2},
579 {"۳", 2},
580 {"∆", 2},
581 {"p", 1},
582 {"۴", 2},
583 {"¨", 2},
584 {"P", 2},
585 {"۵", 2},
586 {"÷", 0},
587 {"¶", 3},
588 {"۶", 2},
589 {"$", 2},
590 {"(", 3},
591 {"۷", 2},
592 {"˙", 2},
593 {")", 3},
594 {"۸", 2},
595 {"e", 0},
596 {"∂", 2},
597 {"۹", 2},
598 {"E", 2},
599 {"%", 2},
600 {"٪", 2},
601 {"é", 2},
602 {".", 0},
603 {"‌", 0},
604 {"É", 2},
605 {"·", 0},
606 {"‍", 0},
607 {"ě", 2},
608 {"φ", 3},
609 {"ê", 2},
610 {"Φ", 2},
611 {"Ê", 2},
612 {"π", 0},
613 {"ë", 2},
614 {"Π", 2},
615 {"Ë", 2},
616 {"+", 0},
617 {"è", 2},
618 {"±", 2},
619 {"È", 2},
620 {"∏", 2},
621 {"8", 2},
622 {"ψ", 3},
623 {"…", 0},
624 {"Ψ", 2},
625 {"ε", 0},
626 {"q", 1},
627 {"Ε", 2},
628 {"Q", 3},
629 {"=", 0},
630 {"?", 2},
631 {"η", 1},
632 {"¿", 1},
633 {"Η", 2},
634 {"\"", 2},
635 {"ð", 2},
636 {"‘", 2},
637 {"Ð", 2},
638 {"’", 2},
639 {"!", 2},
640 {"r", 0},
641 {"¡", 1},
642 {"R", 2},
643 {"f", 2},
644 {"√", 2},
645 {"F", 2},
646 {"ř", 2},
647 {"ff", 2},
648 {"Ř", 2},
649 {"ffi", 2},
650 {"®", 2},
651 {"ffj", 3},
652 {"ρ", 1},
653 {"ffl", 2},
654 {"Ρ", 2},
655 {"fi", 2},
656 {"˚", 2},
657 {"fi", 2},
658 {"s", 0},
659 {"5", 2},
660 {"S", 2},
661 {"fj", 3},
662 {"š", 2},
663 {"fl", 2},
664 {"Š", 2},
665 {"fl", 2},
666 {"§", 2},
667 {"ƒ", 3},
668 {";", 1},
669 {"4", 2},
670 {"7", 2},
671 {"⁄", 2},
672 {"σ", 0},
673 {"g", 1},
674 {"Σ", 2},
675 {"G", 2},
676 {"6", 2},
677 {"γ", 1},
678 {"/", 2},
679 {"Γ", 2},
680 {"£", 2},
681 {"ß", 2},
682 {"∑", 2},
683 {"`", 2},
684 {"t", 2},
685 {">", 0},
686 {"T", 2},
687 {"≥", 2},
688 {"τ", 0},
689 {"«", 0},
690 {"Τ", 2},
691 {"»", 0},
692 {"ť", 2},
693 {"h", 2},
694 {"Ť", 2},
695 {"H", 2},
696 {"Th", 2},
697 {"˝", 2},
698 {"θ", 2},
699 {"-", 0},
700 {"Θ", 2},
701 {"i", 2},
702 {"þ", 3},
703 {"I", 2},
704 {"Þ", 2},
705 {"í", 2},
706 {"3", 2},
707 {"Í", 2},
708 {"¾", 2},
709 {"î", 2},
710 {"³", 2},
711 {"Î", 2},
712 {"˜", 2},
713 {"ï", 2},
714 {"2", 2},