Debian Codegraph @

texk/dvipdfm-x/pdfencoding.c

raw
1 /* This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
2
3 Copyright (C) 2002-2021 by Jin-Hwan Cho, Matthias Franz, 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 <string.h>
28
29 #include "system.h"
30 #include "mem.h"
31 #include "error.h"
32 #include "dpxconf.h"
33 #include "dpxutil.h"
34
35 #include "pdfparse.h"
36 #include "pdfobj.h"
37
38 #include "dpxfile.h"
39
40 #include "pdfencoding.h"
41
42 static int is_similar_charset (char **encoding, const char **encoding2);
43 static pdf_obj *make_encoding_differences (char **encoding, const char **baseenc, const char *is_used);
44
45 static const char *MacRomanEncoding[256];
46 static const char *MacExpertEncoding[256];
47 static const char *WinAnsiEncoding[256];
48 #if 0
49 static const char *StandardEncoding[256];
50 static const char *ISOLatin1Encoding[256];
51 #endif
52
53 /*
54 * ident: File name, e.g., 8a.enc.
55 * name: Name of encoding, StandardEncoding, TeXBase1Encoding, ...
56 * glyphs: List of encoded glyphs (name).
57 * flags:
58 * IS_PREDEFINED:
59 * Encoding is one of the MacRomanEncoding, MacExpertEncoding, and
60 * WinAnsiEncoding.
61 * FLAG_USED_BY_TYPE3:
62 * Encoding is used by a Type 3 font.
63 */
64 #define FLAG_IS_PREDEFINED (1 << 0)
65 #define FLAG_USED_BY_TYPE3 (1 << 1)
66
67 typedef struct pdf_encoding
68 {
69 char *ident;
70
71 char *enc_name;
72 int flags;
73 char *glyphs[256]; /* ".notdef" must be represented as NULL */
74 char is_used[256];
75
76 pdf_obj *tounicode;
77
78 pdf_obj *resource;
79 } pdf_encoding;
80
81 static int pdf_encoding_new_encoding (const char *enc_name, const char *ident, const char **encoding_vec, int flags);
82
83 static void
84 pdf_init_encoding_struct (pdf_encoding *encoding)
85 {
86 ASSERT(encoding);
87
88 encoding->ident = NULL;
89
90 encoding->enc_name = NULL;
91
92 memset(encoding->glyphs, 0, 256*sizeof(char *));
93 memset(encoding->is_used, 0, 256);
94
95 encoding->tounicode = NULL;
96
97 encoding->resource = NULL;
98
99 encoding->flags = 0;
100
101 return;
102 }
103
104 /* Creates the PDF Encoding entry for the encoding. */
105 static pdf_obj *
106 create_encoding_resource (char **enc_vec, const char *baseenc_name, const char **baseenc_vec, char *is_used)
107 {
108 pdf_obj *differences;
109
110 ASSERT(enc_vec);
111
112 if (baseenc_name) {
113 if (strcmp(baseenc_name, "MacRomanEncoding") &&
114 strcmp(baseenc_name, "MacExpertEncoding") &&
115 strcmp(baseenc_name, "WinAnsiEncoding")) {
116 ERROR("Invalid encoding name for BaseEncoding: %s", baseenc_name);
117 }
118 }
119
120 differences = make_encoding_differences(enc_vec, baseenc_vec, is_used);
121 if (differences) {
122 pdf_obj *resource = pdf_new_dict();
123 if (baseenc_name)
124 pdf_add_dict(resource, pdf_new_name("BaseEncoding"), pdf_new_name(baseenc_name));
125 pdf_add_dict(resource, pdf_new_name("Differences"), differences);
126 return resource;
127 } else {
128 /* Fix a bug with the MinionPro package using MnSymbol fonts
129 * in its virtual fonts:
130 *
131 * Some font may have font_id even if no character is used.
132 * For example, suppose that a virtual file A.vf uses two
133 * other fonts, B and C. Even if only characters of B are used
134 * in a DVI document, C will have font_id too.
135 * In this case, both baseenc and differences can be NULL.
136 *
137 * Actually these fonts will be ignored in pdffont.c.
138 */
139 return baseenc_name ? pdf_new_name(baseenc_name) : NULL;
140 }
141 }
142
143 static void
144 pdf_flush_encoding (pdf_encoding *encoding)
145 {
146 ASSERT(encoding);
147
148 if (encoding->resource) {
149 pdf_release_obj(encoding->resource);
150 encoding->resource = NULL;
151 }
152 if (encoding->tounicode) {
153 pdf_release_obj(encoding->tounicode);
154 encoding->tounicode = NULL;
155 }
156
157 return;
158 }
159
160 static void
161 pdf_clean_encoding_struct (pdf_encoding *encoding)
162 {
163 int code;
164
165 ASSERT(encoding);
166
167 if (encoding->resource)
168 ERROR("Object not flushed.");
169
170 if (encoding->tounicode)
171 pdf_release_obj(encoding->tounicode);
172 if (encoding->ident)
173 RELEASE(encoding->ident);
174 if (encoding->enc_name)
175 RELEASE(encoding->enc_name);
176
177 encoding->ident = NULL;
178 encoding->enc_name = NULL;
179
180 for (code = 0; code < 256; code++) {
181 if (encoding->glyphs[code])
182 RELEASE(encoding->glyphs[code]);
183 encoding->glyphs[code] = NULL;
184 }
185 encoding->ident = NULL;
186 encoding->enc_name = NULL;
187
188 return;
189 }
190
191 #if 0
192 static inline int
193 glycmp (const void *pv1, const void *pv2)
194 {
195 char *v1, *v2;
196
197 v1 = (char *) pv1;
198 v2 = *((char **) pv2);
199
200 return strcmp(v1, v2);
201 }
202 #endif
203
204 static int
205 is_similar_charset (char **enc_vec, const char **enc_vec2)
206 {
207 int code, same = 0;
208
209 for (code = 0; code < 256; code++)
210 if (!(enc_vec[code] && strcmp(enc_vec[code], enc_vec2[code])) && ++same >= 64)
211 /* is 64 a good level? */
212 return 1;
213
214 return 0;
215 }
216
217 /* Creates a PDF Differences array for the encoding, based on the
218 * base encoding baseenc (if not NULL). Only character codes which
219 * are actually used in the document are considered.
220 */
221 static pdf_obj *
222 make_encoding_differences (char **enc_vec, const char **baseenc, const char *is_used)
223 {
224 pdf_obj *differences = NULL;
225 int code, count = 0;
226 int skipping = 1;
227
228 ASSERT(enc_vec);
229
230 /*
231 * Write all entries (except .notdef) if baseenc is unknown.
232 * If is_used is given, write only used entries.
233 */
234 differences = pdf_new_array();
235 for (code = 0; code < 256; code++) {
236 /* We skip NULL (= ".notdef"). Any character code mapped to ".notdef"
237 * glyph should not be used in the document.
238 */
239 if ((is_used && !is_used[code]) || !enc_vec[code])
240 skipping = 1;
241 else if (!baseenc || !baseenc[code] ||
242 strcmp(baseenc[code], enc_vec[code]) != 0) {
243 /*
244 * Difference found.
245 */
246 if (skipping)
247 pdf_add_array(differences, pdf_new_number(code));
248 pdf_add_array(differences, pdf_new_name(enc_vec[code]));
249 skipping = 0;
250 count++;
251 } else
252 skipping = 1;
253 }
254
255 /*
256 * No difference found. Some PDF viewers can't handle differences without
257 * any differences. We return NULL.
258 */
259 if (count == 0) {
260 pdf_release_obj(differences);
261 differences = NULL;
262 }
263
264 return differences;
265 }
266
267 static int
268 load_encoding_file (const char *filename)
269 {
270 FILE *fp;
271 pdf_obj *enc_name = NULL;
272 pdf_obj *encoding_array = NULL;
273 char *wbuf;
274 const char *p, *endptr;
275 const char *enc_vec[256];
276 int code, fsize, enc_id;
277
278 if (!filename)
279 return -1;
280
281 if (dpx_conf.verbose_level > 0) {
282 MESG("(Encoding:%s", filename);
283 }
284
285 fp = DPXFOPEN(filename, DPX_RES_TYPE_ENC);
286 if (!fp)
287 return -1;
288 /*
289 * file_size do seek_end witout saving current position and
290 * do rewind.
291 */
292 fsize = file_size(fp);
293
294 wbuf = NEW(fsize + 1, char);
295 wbuf[fsize] = '\0';
296 fread(wbuf, sizeof(char), fsize, fp);
297 DPXFCLOSE(fp);
298
299 p = wbuf;
300 endptr = wbuf + fsize;
301
302 skip_white(&p, endptr);
303
304 /*
305 * Skip comment lines.
306 */
307 while (p < endptr && p[0] == '%') {
308 pdfparse_skip_line (&p, endptr);
309 skip_white(&p, endptr);
310 }
311 if (p[0] == '/')
312 enc_name = parse_pdf_name(&p, endptr);
313
314 skip_white(&p, endptr);
315 encoding_array = parse_pdf_array(&p, endptr, NULL);
316 RELEASE(wbuf);
317 if (!encoding_array) {
318 if (enc_name)
319 pdf_release_obj(enc_name);
320 return -1;
321 }
322
323 for (code = 0; code < 256; code++) {
324 enc_vec[code] = pdf_name_value(pdf_get_array(encoding_array, code));
325 }
326 enc_id = pdf_encoding_new_encoding(enc_name ? pdf_name_value(enc_name) : NULL, filename, enc_vec, 0);
327
328 if (enc_name) {
329 if (dpx_conf.verbose_level > 1)
330 MESG("[%s]", pdf_name_value(enc_name));
331 pdf_release_obj(enc_name);
332 }
333 pdf_release_obj(encoding_array);
334
335 if (dpx_conf.verbose_level > 0) MESG(")");
336
337 return enc_id;
338 }
339
340 #define CHECK_ID(n) do { \
341 if ((n) < 0 || (n) >= enc_cache.count) { \
342 ERROR("Invalid encoding id: %d", (n)); \
343 } \
344 } while (0)
345
346 #define CACHE_ALLOC_SIZE 16u
347
348 struct {
349 int count;
350 int capacity;
351 pdf_encoding *encodings;
352 } enc_cache = {
353 0, 0, NULL
354 };
355
356 void
357 pdf_init_encodings (void)
358 {
359 enc_cache.count = 0;
360 enc_cache.capacity = 3;
361 enc_cache.encodings = NEW(enc_cache.capacity, pdf_encoding);
362
363 /*
364 * PDF Predefined Encodings
365 */
366 pdf_encoding_new_encoding("WinAnsiEncoding", "WinAnsiEncoding", WinAnsiEncoding, FLAG_IS_PREDEFINED);
367 pdf_encoding_new_encoding("MacRomanEncoding", "MacRomanEncoding", MacRomanEncoding, FLAG_IS_PREDEFINED);
368 pdf_encoding_new_encoding("MacExpertEncoding", "MacExpertEncoding", MacExpertEncoding, FLAG_IS_PREDEFINED);
369
370 return;
371 }
372
373 /*
374 * The original dvipdfm describes as:
375 *
376 * Some software doesn't like BaseEncoding key (e.g., FastLane)
377 * so this code is commented out for the moment. It may reemerge in the
378 * future
379 *
380 * and the line for BaseEncoding is commented out.
381 *
382 * I'm not sure why this happens. But maybe BaseEncoding key causes problems
383 * when the font is Symbol font or TrueType font.
384 */
385
386 static int
387 pdf_encoding_new_encoding (const char *enc_name, const char *ident, const char **encoding_vec, int flags)
388 {
389 int enc_id;
390 int code;
391 pdf_encoding *encoding;
392
393 enc_id = enc_cache.count;
394 if (enc_cache.count++ >= enc_cache.capacity) {
395 enc_cache.capacity += 16;
396 enc_cache.encodings = RENEW(enc_cache.encodings,
397 enc_cache.capacity, pdf_encoding);
398 }
399 encoding = &enc_cache.encodings[enc_id];
400
401 pdf_init_encoding_struct(encoding);
402
403 encoding->ident = NEW(strlen(ident)+1, char);
404 strcpy(encoding->ident, ident);
405 encoding->enc_name = NEW(strlen(enc_name)+1, char);
406 strcpy(encoding->enc_name, enc_name);
407
408 encoding->flags = flags;
409
410 for (code = 0; code < 256; code++) {
411 if (encoding_vec[code] && strcmp(encoding_vec[code], ".notdef")) {
412 encoding->glyphs[code] = NEW(strlen(encoding_vec[code])+1, char);
413 strcpy(encoding->glyphs[code], encoding_vec[code]);
414 }
415 }
416
417 if (flags & FLAG_IS_PREDEFINED)
418 encoding->resource = pdf_new_name(encoding->enc_name);
419
420 return enc_id;
421 }
422
423 /* Creates Encoding resource and ToUnicode CMap
424 * for all non-predefined encodings.
425 */
426 void pdf_encoding_complete (void)
427 {
428 int enc_id;
429
430 for (enc_id = 0; enc_id < enc_cache.count; enc_id++) {
431 if (!pdf_encoding_is_predefined(enc_id)) {
432 pdf_encoding *encoding = &enc_cache.encodings[enc_id];
433 const char *baseenc_name = NULL;
434 const char **baseenc_vec = NULL;
435 /* Section 5.5.4 of the PDF 1.5 reference says that the encoding
436 * of a Type 3 font must be completely described by a Differences
437 * array, but implementation note 56 explains that this is rather
438 * an incorrect implementation in Acrobat 4 and earlier. Hence,
439 * we do use a base encodings for PDF versions >= 1.3.
440 */
441 int with_base = (!(encoding->flags & FLAG_USED_BY_TYPE3) || pdf_check_version(1, 4) >= 0);
442
443 ASSERT(!encoding->resource);
444 ASSERT(!encoding->tounicode);
445
446 /* Currently possible values are WinAnsiEncoding or NULL for BaseEncoding */
447 if (!(encoding->flags & FLAG_IS_PREDEFINED) && with_base) {
448 if (is_similar_charset(encoding->glyphs, WinAnsiEncoding)) {
449 /* Dvipdfmx default setting. */
450 baseenc_name = "WinAnsiEncoding";
451 baseenc_vec = WinAnsiEncoding;
452 }
453 }
454 encoding->resource = create_encoding_resource(encoding->glyphs, baseenc_name, baseenc_vec, encoding->is_used);
455 encoding->tounicode = pdf_create_ToUnicode_CMap(encoding->enc_name, encoding->glyphs, encoding->is_used);
456 }
457 }
458 }
459
460 void
461 pdf_close_encodings (void)
462 {
463 int enc_id;
464
465 if (enc_cache.encodings) {
466 for (enc_id = 0; enc_id < enc_cache.count; enc_id++) {
467 pdf_encoding *encoding;
468
469 encoding = &enc_cache.encodings[enc_id];
470 if (encoding) {
471 pdf_flush_encoding(encoding);
472 pdf_clean_encoding_struct(encoding);
473 }
474 }
475 RELEASE(enc_cache.encodings);
476 }
477 enc_cache.encodings = NULL;
478 enc_cache.count = 0;
479 enc_cache.capacity = 0;
480 }
481
482 int
483 pdf_encoding_findresource (const char *enc_name)
484 {
485 int enc_id;
486 pdf_encoding *encoding;
487
488 ASSERT(enc_name);
489 for (enc_id = 0; enc_id < enc_cache.count; enc_id++) {
490 encoding = &enc_cache.encodings[enc_id];
491 if (encoding->ident &&
492 !strcmp(enc_name, encoding->ident))
493 return enc_id;
494 else if (encoding->enc_name &&
495 !strcmp(enc_name, encoding->enc_name))
496 return enc_id;
497 }
498
499 return load_encoding_file(enc_name);
500 }
501
502
503 /*
504 * Pointer will change if other encoding is loaded...
505 */
506
507 char **
508 pdf_encoding_get_encoding (int enc_id)
509 {
510 pdf_encoding *encoding;
511
512 CHECK_ID(enc_id);
513
514 encoding = &enc_cache.encodings[enc_id];
515
516 return encoding->glyphs;
517 }
518
519 pdf_obj *
520 pdf_get_encoding_obj (int enc_id)
521 {
522 pdf_encoding *encoding;
523
524 CHECK_ID(enc_id);
525
526 encoding = &enc_cache.encodings[enc_id];
527
528 return encoding->resource;
529 }
530
531 int
532 pdf_encoding_is_predefined (int enc_id)
533 {
534 pdf_encoding *encoding;
535
536 CHECK_ID(enc_id);
537
538 encoding = &enc_cache.encodings[enc_id];
539
540 return (encoding->flags & FLAG_IS_PREDEFINED) ? 1 : 0;
541 }
542
543 void
544 pdf_encoding_used_by_type3 (int enc_id)
545 {
546 pdf_encoding *encoding;
547
548 CHECK_ID(enc_id);
549
550 encoding = &enc_cache.encodings[enc_id];
551
552 encoding->flags |= FLAG_USED_BY_TYPE3;
553 }
554
555
556 char *
557 pdf_encoding_get_name (int enc_id)
558 {
559 pdf_encoding *encoding;
560
561 CHECK_ID(enc_id);
562
563 encoding = &enc_cache.encodings[enc_id];
564
565 return encoding->enc_name;
566 }
567
568 /* CSI_UNICODE */
569 #include "cid.h"
570
571 #include "cmap.h"
572 #include "cmap_read.h"
573 #include "cmap_write.h"
574
575 #include "agl.h"
576
577 #define WBUF_SIZE 1024
578 static unsigned char wbuf[WBUF_SIZE];
579 static unsigned char range_min[1] = {0x00u};
580 static unsigned char range_max[1] = {0xFFu};
581
582 void
583 pdf_encoding_add_usedchars (int encoding_id, const char *is_used)
584 {
585 pdf_encoding *encoding;
586 int code;
587
588 CHECK_ID(encoding_id);
589
590 if (!is_used || pdf_encoding_is_predefined(encoding_id))
591 return;
592
593 encoding = &enc_cache.encodings[encoding_id];
594
595 for (code = 0; code <= 0xff; code++)
596 encoding->is_used[code] |= is_used[code];
597 }
598
599 pdf_obj *
600 pdf_encoding_get_tounicode (int encoding_id)
601 {
602 CHECK_ID(encoding_id);
603
604 return enc_cache.encodings[encoding_id].tounicode;
605 }
606
607
608 /* Creates a ToUnicode CMap. An empty CMap is replaced by NULL.
609 *
610 * For PDF <= 1.4 a complete CMap is created unless all character codes
611 * are predefined in PDF. For PDF >= 1.5 only those character codes which
612 * are not predefined appear in the CMap.
613 *
614 * Note: The PDF 1.4 reference is not consistent: Section 5.9 describes
615 * the Unicode mapping of PDF 1.3 and Section 9.7.2 (in the context of
616 * Tagged PDF) the one of PDF 1.5.
617 *
618 * CHANGED: 20180906
619 * Always create ToUnicode CMap unless there is missing mapping.
620 * Change made on rev.7557 broke ToUnicode CMap support. Now reverted.
621 */
622 pdf_obj *
623 pdf_create_ToUnicode_CMap (const char *enc_name,
624 char **enc_vec, const char *is_used)
625 {
626 pdf_obj *stream;
627 CMap *cmap;
628 int code, count, total_fail;
629 char *cmap_name;
630 unsigned char *p, *endptr;
631
632 ASSERT(enc_name && enc_vec);
633
634 if (!is_used)
635 return NULL;
636
637 cmap_name = NEW(strlen(enc_name)+strlen("-UTF16")+1, char);
638 sprintf(cmap_name, "%s-UTF16", enc_name);
639
640 cmap = CMap_new();
641 CMap_set_name (cmap, cmap_name);
642 CMap_set_type (cmap, CMAP_TYPE_TO_UNICODE);
643 CMap_set_wmode(cmap, 0);
644
645 CMap_set_CIDSysInfo(cmap, &CSI_UNICODE);
646
647 CMap_add_codespacerange(cmap, range_min, range_max, 1);
648
649 count = 0;
650 total_fail = 0;
651 for (code = 0; code <= 0xff; code++) {
652 if (is_used && !is_used[code])
653 continue;
654
655 if (enc_vec[code]) {
656 size_t len;
657 int fail_count = 0;
658 wbuf[0] = (code & 0xff);
659 p = wbuf + 1;
660 endptr = wbuf + WBUF_SIZE;
661 len = agl_sput_UTF16BE(enc_vec[code], &p, endptr, &fail_count);
662 if (len < 1 && fail_count > 0) {
663 total_fail++;
664 } else {
665 CMap_add_bfchar(cmap, wbuf, 1, wbuf + 1, len);
666 count++;
667 }
668 }
669 }
670
671 if (total_fail > 0) {
672 if (dpx_conf.verbose_level > 0)
673 WARN("Glyphs with no Unicode mapping found. Removing ToUnicode CMap.");
674 }
675 stream = (count == 0 || total_fail > 0) ? NULL : CMap_create_stream(cmap);
676
677 CMap_release(cmap);
678 RELEASE(cmap_name);
679
680 return stream;
681 }
682
683
684 pdf_obj *
685 pdf_load_ToUnicode_stream (const char *ident)
686 {
687 pdf_obj *stream = NULL;
688 CMap *cmap;
689 FILE *fp;
690
691 if (!ident)
692 return NULL;
693
694 fp = DPXFOPEN(ident, DPX_RES_TYPE_CMAP);
695 if (!fp)
696 return NULL;
697 else if (CMap_parse_check_sig(fp) < 0) {
698 DPXFCLOSE(fp);
699 return NULL;
700 }
701
702 cmap = CMap_new();
703 if (CMap_parse(cmap, fp) < 0) {
704 WARN("Reading CMap file \"%s\" failed.", ident);
705 } else {
706 if (dpx_conf.verbose_level > 0) {
707 MESG("(CMap:%s)", ident);
708 }
709 stream = CMap_create_stream(cmap);
710 if (!stream) {
711 WARN("Failed to creat ToUnicode CMap stream for \"%s\".", ident);
712 }
713 }
714 CMap_release(cmap);
715 DPXFCLOSE(fp);
716
717 return stream;
718 }
719
720
721 static const char *
722 MacRomanEncoding[256] = {
723 ".notdef", ".notdef", ".notdef", ".notdef",
724 ".notdef", ".notdef", ".notdef", ".notdef",
725 ".notdef", ".notdef", ".notdef", ".notdef",
726 ".notdef", ".notdef", ".notdef", ".notdef",
727 ".notdef", ".notdef", ".notdef", ".notdef",
728 ".notdef", ".notdef", ".notdef", ".notdef",
729 ".notdef", ".notdef", ".notdef", ".notdef",
730 ".notdef", ".notdef", ".notdef", ".notdef",
731 "space", "exclam", "quotedbl", "numbersign",
732 "dollar", "percent", "ampersand", "quotesingle",
733 "parenleft", "parenright", "asterisk", "plus",
734 "comma", "hyphen", "period", "slash",
735 "zero", "one", "two", "three",
736 "four", "five", "six", "seven",
737 "eight", "nine", "colon", "semicolon",
738 "less", "equal", "greater", "question",
739 "at", "A", "B", "C",
740 "D", "E", "F", "G", "H",
741 "I", "J", "K", "L",
742 "M", "N", "O", "P",
743 "Q", "R", "S", "T",
744 "U", "V", "W", "X",
745 "Y", "Z", "bracketleft", "backslash",
746 "bracketright", "asciicircum", "underscore",
747 "grave", "a", "b", "c",
748 "d", "e", "f", "g",
749 "h", "i", "j", "k",
750 "l", "m", "n", "o",
751 "p", "q", "r", "s",
752 "t", "u", "v", "w",
753 "x", "y", "z", "braceleft",
754 "bar", "braceright", "asciitilde", ".notdef",
755 "Adieresis", "Aring", "Ccedilla", "Eacute",
756 "Ntilde", "Odieresis", "Udieresis", "aacute",
757 "agrave", "acircumflex", "adieresis", "atilde",
758 "aring", "ccedilla", "eacute", "egrave",
759 "ecircumflex", "edieresis", "iacute", "igrave",
760 "icircumflex", "idieresis", "ntilde", "oacute",
761 "ograve", "ocircumflex", "odieresis", "otilde",
762 "uacute", "ugrave", "ucircumflex", "udieresis",
763 "dagger", "degree", "cent", "sterling",
764 "section", "bullet", "paragraph", "germandbls",
765 "registered", "copyright", "trademark", "acute",
766 "dieresis", "notequal", "AE", "Oslash",
767 "infinity", "plusminus", "lessequal", "greaterequal",
768 "yen", "mu", "partialdiff", "summation",
769 "product", "pi", "integral", "ordfeminine",
770 "ordmasculine", "Omega", "ae", "oslash",
771 "questiondown", "exclamdown", "logicalnot", "radical",
772 "florin", "approxequal", "Delta", "guillemotleft",
773 "guillemotright", "ellipsis", "space", "Agrave",
774 "Atilde", "Otilde", "OE", "oe",
775 "endash", "emdash", "quotedblleft", "quotedblright",
776 "quoteleft", "quoteright", "divide", "lozenge",
777 "ydieresis", "Ydieresis", "fraction", "currency",
778 "guilsinglleft", "guilsinglright", "fi", "fl",
779 "daggerdbl", "periodcentered", "quotesinglbase", "quotedblbase",
780 "perthousand", "Acircumflex", "Ecircumflex", "Aacute",
781 "Edieresis", "Egrave", "Iacute", "Icircumflex",
782 "Idieresis", "Igrave", "Oacute", "Ocircumflex",
783 "apple", "Ograve", "Uacute", "Ucircumflex",
784 "Ugrave", "dotlessi", "circumflex", "tilde",
785 "macron", "breve", "dotaccent", "ring",
786 "cedilla", "hungarumlaut", "ogonek", "caron"
787 };
788
789 static const char *
790 MacExpertEncoding[256] = {
791 ".notdef", ".notdef", ".notdef", ".notdef",
792 ".notdef", ".notdef", ".notdef", ".notdef",
793 ".notdef", ".notdef", ".notdef", ".notdef",
794 ".notdef", ".notdef", ".notdef", ".notdef",
795 ".notdef", ".notdef", ".notdef", ".notdef",
796 ".notdef", ".notdef", ".notdef", ".notdef",
797 ".notdef", ".notdef", ".notdef", ".notdef",
798 ".notdef", ".notdef", ".notdef", ".notdef",
799 "space", "exclamsmall", "Hungarumlautsmall", "centoldstyle",
800 "dollaroldstyle", "dollarsuperior", "ampersandsmall", "Acutesmall",
801 "parenleftsuperior", "parenrightsuperior", "twodotenleader", "onedotenleader",
802 "comma", "hyphen", "period", "fraction",
803 "zerooldstyle", "oneoldstyle", "twooldstyle", "threeoldstyle",
804 "fouroldstyle", "fiveoldstyle", "sixoldstyle", "sevenoldstyle",
805 "eightoldstyle", "nineoldstyle", "colon", "semicolon",
806 ".notdef", "threequartersemdash", ".notdef", "questionsmall",
807 ".notdef", ".notdef", ".notdef", ".notdef",
808 "Ethsmall", ".notdef", ".notdef", "onequarter",
809 "onehalf", "threequarters", "oneeighth", "threeeighths",
810 "fiveeighths", "seveneighths", "onethird", "twothirds",
811 ".notdef", ".notdef", ".notdef", ".notdef",
812 ".notdef", ".notdef", "ff", "fi",
813 "fl", "ffi", "ffl", "parenleftinferior",
814 ".notdef", "parenrightinferior", "Circumflexsmall", "hypheninferior",
815 "Gravesmall", "Asmall", "Bsmall", "Csmall",
816 "Dsmall", "Esmall", "Fsmall", "Gsmall",
817 "Hsmall", "Ismall", "Jsmall", "Ksmall",
818 "Lsmall", "Msmall", "Nsmall", "Osmall",
819 "Psmall", "Qsmall", "Rsmall", "Ssmall",
820 "Tsmall", "Usmall", "Vsmall", "Wsmall",
821 "Xsmall", "Ysmall", "Zsmall", "colonmonetary",
822 "onefitted", "rupiah", "Tildesmall", ".notdef",
823 ".notdef", "asuperior", "centsuperior", ".notdef",
824 ".notdef", ".notdef", ".notdef", "Aacutesmall",
825 "Agravesmall", "Acircumflexsmall", "Adieresissmall", "Atildesmall",
826 "Aringsmall", "Ccedillasmall", "Eacutesmall", "Egravesmall",
827 "Ecircumflexsmall", "Edieresissmall", "Iacutesmall", "Igravesmall",
828 "Icircumflexsmall", "Idieresissmall", "Ntildesmall", "Oacutesmall",
829 "Ogravesmall", "Ocircumflexsmall", "Odieresissmall", "Otildesmall",
830 "Uacutesmall", "Ugravesmall", "Ucircumflexsmall", "Udieresissmall",
831 ".notdef", "eightsuperior", "fourinferior", "threeinferior",
832 "sixinferior", "eightinferior", "seveninferior", "Scaronsmall",
833 ".notdef", "centinferior", "twoinferior", ".notdef",
834 "Dieresissmall", ".notdef", "Caronsmall", "osuperior",
835 "fiveinferior", ".notdef", "commainferior", "periodinferior",
836 "Yacutesmall", ".notdef", "dollarinferior", ".notdef",
837 ".notdef", "Thornsmall", ".notdef", "nineinferior",
838 "zeroinferior", "Zcaronsmall", "AEsmall", "Oslashsmall",
839 "questiondownsmall", "oneinferior", "Lslashsmall", ".notdef",
840 ".notdef", ".notdef", ".notdef", ".notdef",
841 ".notdef", "Cedillasmall", ".notdef", ".notdef",
842 ".notdef", ".notdef", ".notdef", "OEsmall",
843 "figuredash", "hyphensuperior", ".notdef", ".notdef",
844 ".notdef", ".notdef", "exclamdownsmall", ".notdef",
845 "Ydieresissmall", ".notdef", "onesuperior", "twosuperior",
846 "threesuperior", "foursuperior", "fivesuperior", "sixsuperior",
847 "sevensuperior", "ninesuperior", "zerosuperior", ".notdef",
848 "esuperior", "rsuperior", "tsuperior", ".notdef",
849 ".notdef", "isuperior", "ssuperior", "dsuperior",
850 ".notdef", ".notdef", ".notdef", ".notdef",
851 ".notdef", "lsuperior", "Ogoneksmall", "Brevesmall",
852 "Macronsmall", "bsuperior", "nsuperior", "msuperior",
853 "commasuperior", "periodsuperior", "Dotaccentsmall", "Ringsmall",
854 ".notdef", ".notdef", ".notdef", ".notdef"
855 };
856
857 static const char *
858 WinAnsiEncoding[256] = {
859 ".notdef", ".notdef", ".notdef", ".notdef",
860 ".notdef", ".notdef", ".notdef", ".notdef",
861 ".notdef", ".notdef", ".notdef", ".notdef",
862 ".notdef", ".notdef", ".notdef", ".notdef",
863 ".notdef", ".notdef", ".notdef", ".notdef",
864 ".notdef", ".notdef", ".notdef", ".notdef",
865 ".notdef", ".notdef", ".notdef", ".notdef",
866 ".notdef", ".notdef", ".notdef", ".notdef",
867 "space", "exclam", "quotedbl", "numbersign",
868 "dollar", "percent", "ampersand", "quotesingle",
869 "parenleft", "parenright", "asterisk", "plus",
870 "comma", "hyphen", "period", "slash",
871 "zero", "one", "two", "three",
872 "four", "five", "six", "seven",
873 "eight", "nine", "colon", "semicolon",
874 "less", "equal", "greater", "question",
875 "at", "A", "B", "C",
876 "D", "E", "F", "G",
877 "H", "I", "J", "K",
878 "L", "M", "N", "O",
879 "P", "Q", "R", "S",
880 "T", "U", "V", "W",
881 "X", "Y", "Z", "bracketleft",
882 "backslash", "bracketright", "asciicircum", "underscore",
883 "grave", "a", "b", "c",
884 "d", "e", "f", "g",
885 "h", "i", "j", "k",
886 "l", "m", "n", "o",
887 "p", "q", "r", "s",
888 "t", "u", "v", "w",
889 "x", "y", "z", "braceleft",
890 "bar", "braceright", "asciitilde", "bullet",
891 "Euro", "bullet", "quotesinglbase", "florin",
892 "quotedblbase", "ellipsis", "dagger", "daggerdbl",
893 "circumflex", "perthousand", "Scaron", "guilsinglleft",
894 "OE", "bullet", "Zcaron", "bullet",
895 "bullet", "quoteleft", "quoteright", "quotedblleft",
896 "quotedblright", "bullet", "endash", "emdash",
897 "tilde", "trademark", "scaron", "guilsinglright",
898 "oe", "bullet", "zcaron", "Ydieresis",
899 "space", "exclamdown", "cent", "sterling",
900 "currency", "yen", "brokenbar", "section",
901 "dieresis", "copyright", "ordfeminine", "guillemotleft",
902 "logicalnot", "hyphen", "registered", "macron",
903 "degree", "plusminus", "twosuperior", "threesuperior",
904 "acute", "mu", "paragraph", "periodcentered",
905 "cedilla", "onesuperior", "ordmasculine", "guillemotright",
906 "onequarter", "onehalf", "threequarters", "questiondown",
907 "Agrave", "Aacute", "Acircumflex", "Atilde",
908 "Adieresis", "Aring", "AE", "Ccedilla",
909 "Egrave", "Eacute", "Ecircumflex", "Edieresis",
910 "Igrave", "Iacute", "Icircumflex", "Idieresis",
911 "Eth", "Ntilde", "Ograve", "Oacute",
912 "Ocircumflex", "Otilde", "Odieresis", "multiply",
913 "Oslash", "Ugrave", "Uacute", "Ucircumflex",
914 "Udieresis", "Yacute", "Thorn", "germandbls",
915 "agrave", "aacute", "acircumflex", "atilde",
916 "adieresis", "aring", "ae", "ccedilla",
917 "egrave", "eacute", "ecircumflex", "edieresis",
918 "igrave", "iacute", "icircumflex", "idieresis",
919 "eth", "ntilde", "ograve", "oacute",
920 "ocircumflex", "otilde", "odieresis", "divide",
921 "oslash", "ugrave", "uacute", "ucircumflex",
922 "udieresis", "yacute", "thorn", "ydieresis"
923 };
924
925 #if 0
926 static const char *
927 StandardEncoding[256] = {
928 ".notdef", ".notdef", ".notdef", ".notdef",
929 ".notdef", ".notdef", ".notdef", ".notdef",
930 ".notdef", ".notdef", ".notdef", ".notdef",
931 ".notdef", ".notdef", ".notdef", ".notdef",
932 ".notdef", ".notdef", ".notdef", ".notdef",
933 ".notdef", ".notdef", ".notdef", ".notdef",
934 ".notdef", ".notdef", ".notdef", ".notdef",
935 ".notdef", ".notdef", ".notdef", ".notdef",
936 "space", "exclam", "quotedbl", "numbersign",
937 "dollar", "percent", "ampersand", "quoteright",
938 "parenleft", "parenright", "asterisk", "plus",
939 "comma", "hyphen", "period", "slash",
940 "zero", "one", "two", "three",
941 "four", "five", "six", "seven",
942 "eight", "nine", "colon", "semicolon",
943 "less", "equal", "greater", "question",
944 "at", "A", "B", "C",
945 "D", "E", "F", "G",
946 "H", "I", "J", "K",
947 "L", "M", "N", "O",
948 "P", "Q", "R", "S",
949 "T", "U", "V", "W",
950 "X", "Y", "Z", "bracketleft",
951 "backslash", "bracketright", "asciicircum", "underscore",
952 "quoteleft", "a", "b", "c",
953 "d", "e", "f", "g",
954 "h", "i", "j", "k",
955 "l", "m", "n", "o",
956 "p", "q", "r", "s",
957 "t", "u", "v", "w",
958 "x", "y", "z", "braceleft",
959 "bar", "braceright", "asciitilde", ".notdef",
960 ".notdef", ".notdef", ".notdef", ".notdef",
961 ".notdef", ".notdef", ".notdef", ".notdef",
962 ".notdef", ".notdef", ".notdef", ".notdef",
963 ".notdef", ".notdef", ".notdef", ".notdef",
964 ".notdef", ".notdef", ".notdef", ".notdef",
965 ".notdef", ".notdef", ".notdef", ".notdef",
966 ".notdef", ".notdef", ".notdef", ".notdef",
967 ".notdef", ".notdef", ".notdef", ".notdef",
968 ".notdef", "exclamdown", "cent", "sterling",
969 "fraction", "yen", "florin", "section",
970 "currency", "quotesingle", "quotedblleft", "guillemotleft",
971 "guilsinglleft", "guilsinglright", "fi", "fl",
972 ".notdef", "endash", "dagger", "daggerdbl",
973 "periodcentered", ".notdef", "paragraph", "bullet",
974 "quotesinglbase", "quotedblbase", "quotedblright", "guillemotright",
975 "ellipsis", "perthousand", ".notdef", "questiondown",
976 ".notdef", "grave", "acute", "circumflex",
977 "tilde", "macron", "breve", "dotaccent",
978 "dieresis", ".notdef", "ring", "cedilla",
979 ".notdef", "hungarumlaut", "ogonek", "caron",
980 "emdash", ".notdef", ".notdef", ".notdef",
981 ".notdef", ".notdef", ".notdef", ".notdef",
982 ".notdef", ".notdef", ".notdef", ".notdef",
983 ".notdef", ".notdef", ".notdef", ".notdef",
984 ".notdef", "AE", ".notdef", "ordfeminine",
985 ".notdef", ".notdef", ".notdef", ".notdef",
986 "Lslash", "Oslash", "OE", "ordmasculine",
987 ".notdef", ".notdef", ".notdef", ".notdef",
988 ".notdef", "ae", ".notdef", ".notdef",
989 ".notdef", "dotlessi", ".notdef", ".notdef",
990 "lslash", "oslash", "oe", "germandbls",
991 ".notdef", ".notdef", ".notdef", ".notdef"
992 };
993
994 static const char *
995 ISOLatin1Encoding[256] = {
996 ".notdef", ".notdef", ".notdef", ".notdef",
997 ".notdef", ".notdef", ".notdef", ".notdef",
998 ".notdef", ".notdef", ".notdef", ".notdef",
999 ".notdef", ".notdef", ".notdef", ".notdef",
1000 ".notdef", ".notdef", ".notdef", ".notdef",
1001 ".notdef", ".notdef", ".notdef", ".notdef",
1002 ".notdef", ".notdef", ".notdef", ".notdef",
1003 ".notdef", ".notdef", ".notdef", ".notdef",
1004 "space", "exclam", "quotedbl", "numbersign",
1005 "dollar", "percent", "ampersand", "quotesingle",
1006 "parenleft", "parenright", "asterisk", "plus",
1007 "comma", "hyphen", "period", "slash",
1008 "zero", "one", "two", "three",
1009 "four", "five", "six", "seven",
1010 "eight", "nine", "colon", "semicolon",
1011 "less", "equal", "greater", "question",
1012 "at", "A", "B", "C",
1013 "D", "E", "F", "G",
1014 "H", "I", "J", "K",
1015 "L", "M", "N", "O",
1016 "P", "Q", "R", "S",
1017 "T", "U", "V", "W",
1018 "X", "Y", "Z", "bracketleft",
1019 "backslash", "bracketright", "asciicircum", "underscore",
1020 "grave", "a", "b", "c",
1021 "d", "e", "f", "g",
1022 "h", "i", "j", "k",
1023 "l", "m", "n", "o",
1024 "p", "q", "r", "s",
1025 "t", "u", "v", "w",
1026 "x", "y", "z", "braceleft",
1027 "bar", "braceright", "asciitilde", ".notdef",
1028 ".notdef", ".notdef", ".notdef", ".notdef",
1029 ".notdef", ".notdef", ".notdef", ".notdef",
1030 ".notdef", ".notdef", ".notdef", ".notdef",
1031 ".notdef", ".notdef", ".notdef", ".notdef",
1032 "dotlessi", "quoteleft", "quoteright", "circumflex",
1033 "tilde", "macron", "breve", "dotaccent",
1034 "dieresis", ".notdef", "ring", "cedilla",
1035 ".notdef", "hungarumlaut", "ogonek", "caron",
1036 "space", "exclamdown", "cent", "sterling",
1037 "currency", "yen", "brokenbar", "section",
1038 "dieresis", "copyright", "ordfeminine", "guillemotleft",
1039 "logicalnot", "hyphen", "registered", "macron",
1040 "degree", "plusminus", "twosuperior", "threesuperior",
1041 "acute", "mu", "paragraph", "periodcentered",
1042 "cedilla", "onesuperior", "ordmasculine", "guillemotright",
1043 "onequarter", "onehalf", "threequarters", "questiondown",
1044 "Agrave", "Aacute", "Acircumflex", "Atilde",
1045 "Adieresis", "Aring", "AE", "Ccedilla",
1046 "Egrave", "Eacute", "Ecircumflex", "Edieresis",
1047 "Igrave", "Iacute", "Icircumflex", "Idieresis",
1048 "Eth", "Ntilde", "Ograve", "Oacute",
1049 "Ocircumflex", "Otilde", "Odieresis", "multiply",
1050 "Oslash", "Ugrave", "Uacute", "Ucircumflex",
1051 "Udieresis", "Yacute", "Thorn", "germandbls",
1052 "agrave", "aacute", "acircumflex", "atilde",
1053 "adieresis", "aring", "ae", "ccedilla",
1054 "egrave", "eacute", "ecircumflex", "edieresis",
1055 "igrave", "iacute", "icircumflex", "idieresis",
1056 "eth", "ntilde", "ograve", "oacute",
1057 "ocircumflex", "otilde", "odieresis", "divide",
1058 "oslash", "ugrave", "uacute", "ucircumflex",
1059 "udieresis", "yacute", "thorn", "ydieresis"
1060 };
1061 #endif