1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6
7 #include "core/include/fpdfapi/fpdf_page.h"
8 #include "core/include/fpdfapi/fpdf_parser.h"
9 #include "core/include/fpdfapi/fpdf_resource.h"
10 #include "core/include/fxge/fx_freetype.h"
11
12 static const struct _UnicodeAlt {
13 FX_WORD m_Unicode;
14 const FX_CHAR* m_Alter;
15 } UnicodeAlts[] = {
16 {0x00a0, " "}, {0x00a1, "!"}, {0x00a2, "c"}, {0x00a3, "P"},
17 {0x00a4, "o"}, {0x00a5, "Y"}, {0x00a6, "|"}, {0x00a7, "S"},
18 {0x00a9, "(C)"}, {0x00aa, "a"}, {0x00ab, "<<"}, {0x00ac, "-|"},
19 {0x00ae, "(R)"}, {0x00af, "-"}, {0x00b0, "o"}, {0x00b1, "+/-"},
20 {0x00b2, "^2"}, {0x00b3, "^3"}, {0x00b4, "'"}, {0x00b5, "u"},
21 {0x00b6, "P"}, {0x00b7, "."}, {0x00b9, "^1"}, {0x00ba, "o"},
22 {0x00bb, ">>"}, {0x00bc, "1/4"}, {0x00bd, "1/2"}, {0x00be, "3/4"},
23 {0x00bf, "?"}, {0x00c0, "A"}, {0x00c1, "A"}, {0x00c2, "A"},
24 {0x00c3, "A"}, {0x00c4, "A"}, {0x00c5, "A"}, {0x00c6, "AE"},
25 {0x00c7, "C"}, {0x00c8, "E"}, {0x00c9, "E"}, {0x00ca, "E"},
26 {0x00cb, "E"}, {0x00cc, "I"}, {0x00cd, "I"}, {0x00ce, "I"},
27 {0x00cf, "I"}, {0x00d1, "N"}, {0x00d2, "O"}, {0x00d3, "O"},
28 {0x00d4, "O"}, {0x00d5, "O"}, {0x00d6, "O"}, {0x00d7, "x"},
29 {0x00d8, "O"}, {0x00d9, "U"}, {0x00da, "U"}, {0x00db, "U"},
30 {0x00dc, "U"}, {0x00dd, "Y"}, {0x00df, "S"}, {0x00e0, "a"},
31 {0x00e1, "a"}, {0x00e2, "a"}, {0x00e3, "a"}, {0x00e4, "a"},
32 {0x00e5, "a"}, {0x00e6, "ae"}, {0x00e7, "c"}, {0x00e8, "e"},
33 {0x00e9, "e"}, {0x00ea, "e"}, {0x00eb, "e"}, {0x00ec, "i"},
34 {0x00ed, "i"}, {0x00ee, "i"}, {0x00ef, "i"}, {0x00f1, "n"},
35 {0x00f2, "o"}, {0x00f3, "o"}, {0x00f4, "o"}, {0x00f5, "o"},
36 {0x00f6, "o"}, {0x00f7, "/"}, {0x00f8, "o"}, {0x00f9, "u"},
37 {0x00fa, "u"}, {0x00fb, "u"}, {0x00fc, "u"}, {0x00fd, "y"},
38 {0x00ff, "y"}, {0x02b0, "h"}, {0x02b2, "j"}, {0x02b3, "r"},
39 {0x02b7, "w"}, {0x02b8, "y"}, {0x02b9, "'"}, {0x02ba, "\""},
40 {0x02bb, "'"}, {0x02bc, "'"}, {0x02bd, "'"}, {0x02be, "'"},
41 {0x02bf, "'"}, {0x02c2, "<"}, {0x02c3, ">"}, {0x02c4, "^"},
42 {0x02c5, "v"}, {0x02c6, "^"}, {0x02c7, "v"}, {0x02c8, "'"},
43 {0x02c9, "-"}, {0x02ca, "'"}, {0x02cb, "'"}, {0x02cc, "."},
44 {0x02cd, "_"}, {0x2010, "-"}, {0x2012, "-"}, {0x2013, "-"},
45 {0x2014, "--"}, {0x2015, "--"}, {0x2016, "|"}, {0x2017, "_"},
46 {0x2018, "'"}, {0x2019, "'"}, {0x201a, ","}, {0x201b, "'"},
47 {0x201c, "\""}, {0x201d, "\""}, {0x201e, ","}, {0x201f, "'"},
48 {0x2020, "+"}, {0x2021, "+"}, {0x2022, "*"}, {0x2023, ">"},
49 {0x2024, "."}, {0x2025, ".."}, {0x2027, "."}, {0x2032, "'"},
50 {0x2033, "\""}, {0x2035, "'"}, {0x2036, "\""}, {0x2038, "^"},
51 {0x2039, "<"}, {0x203a, ">"}, {0x203b, "*"}, {0x203c, "!!"},
52 {0x203d, "?!"}, {0x203e, "-"}, {0x2044, "/"}, {0x2047, "??"},
53 {0x2048, "?!"}, {0x2049, "!?"}, {0x204e, "*"}, {0x2052, "%"},
54 {0x2122, "(TM)"}, {0x2212, "-"}, {0x2215, "/"}, {0x2216, "\\"},
55 {0x2217, "*"}, {0x2218, "*"}, {0x2219, "*"}, {0x2223, "|"},
56 {0x22c5, "."}, {0x266f, "#"}, {0XF6D9, "(C)"}, {0XF6DA, "(C)"},
57 {0XF6DB, "(TM)"}, {0XF8E8, "(C)"}, {0xf8e9, "(C)"}, {0XF8EA, "(TM)"},
58 {0xfb01, "fi"}, {0xfb02, "fl"}};
FCS_GetAltStr(FX_WCHAR unicode)59 const FX_CHAR* FCS_GetAltStr(FX_WCHAR unicode) {
60 int begin = 0;
61 int end = sizeof UnicodeAlts / sizeof(struct _UnicodeAlt) - 1;
62 while (begin <= end) {
63 int middle = (begin + end) / 2;
64 FX_WORD middlecode = UnicodeAlts[middle].m_Unicode;
65 if (middlecode > unicode) {
66 end = middle - 1;
67 } else if (middlecode < unicode) {
68 begin = middle + 1;
69 } else {
70 return UnicodeAlts[middle].m_Alter;
71 }
72 }
73 return NULL;
74 }
75 static const FX_WORD StandardEncoding[256] = {
76 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
77 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
78 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
79 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0020, 0x0021, 0x0022, 0x0023,
80 0x0024, 0x0025, 0x0026, 0x2019, 0x0028, 0x0029, 0x002a, 0x002b, 0x002c,
81 0x002d, 0x002e, 0x002f, 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035,
82 0x0036, 0x0037, 0x0038, 0x0039, 0x003a, 0x003b, 0x003c, 0x003d, 0x003e,
83 0x003f, 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047,
84 0x0048, 0x0049, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x004f, 0x0050,
85 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059,
86 0x005a, 0x005b, 0x005c, 0x005d, 0x005e, 0x005f, 0x2018, 0x0061, 0x0062,
87 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006a, 0x006b,
88 0x006c, 0x006d, 0x006e, 0x006f, 0x0070, 0x0071, 0x0072, 0x0073, 0x0074,
89 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007a, 0x007b, 0x007c, 0x007d,
90 0x007e, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
91 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
92 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
93 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x00a1,
94 0x00a2, 0x00a3, 0x2044, 0x00a5, 0x0192, 0x00a7, 0x00a4, 0x0027, 0x201c,
95 0x00ab, 0x2039, 0x203a, 0xfb01, 0xfb02, 0x0000, 0x2013, 0x2020, 0x2021,
96 0x00b7, 0x0000, 0x00b6, 0x2022, 0x201a, 0x201e, 0x201d, 0x00bb, 0x2026,
97 0x2030, 0x0000, 0x00bf, 0x0000, 0x0060, 0x00b4, 0x02c6, 0x02dc, 0x00af,
98 0x02d8, 0x02d9, 0x00a8, 0x0000, 0x02da, 0x00b8, 0x0000, 0x02dd, 0x02db,
99 0x02c7, 0x2014, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
100 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
101 0x00c6, 0x0000, 0x00aa, 0x0000, 0x0000, 0x0000, 0x0000, 0x0141, 0x00d8,
102 0x0152, 0x00ba, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x00e6, 0x0000,
103 0x0000, 0x0000, 0x0131, 0x0000, 0x0000, 0x0142, 0x00f8, 0x0153, 0x00df,
104 0x0000, 0x0000, 0x0000, 0x0000};
105 static const FX_WORD MacRomanEncoding[256] = {
106 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
107 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
108 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
109 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0020, 0x0021, 0x0022, 0x0023,
110 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002a, 0x002b, 0x002c,
111 0x002d, 0x002e, 0x002f, 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035,
112 0x0036, 0x0037, 0x0038, 0x0039, 0x003a, 0x003b, 0x003c, 0x003d, 0x003e,
113 0x003f, 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047,
114 0x0048, 0x0049, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x004f, 0x0050,
115 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059,
116 0x005a, 0x005b, 0x005c, 0x005d, 0x005e, 0x005f, 0x0060, 0x0061, 0x0062,
117 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006a, 0x006b,
118 0x006c, 0x006d, 0x006e, 0x006f, 0x0070, 0x0071, 0x0072, 0x0073, 0x0074,
119 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007a, 0x007b, 0x007c, 0x007d,
120 0x007e, 0x0000, 0x00c4, 0x00c5, 0x00c7, 0x00c9, 0x00d1, 0x00d6, 0x00dc,
121 0x00e1, 0x00e0, 0x00e2, 0x00e4, 0x00e3, 0x00e5, 0x00e7, 0x00e9, 0x00e8,
122 0x00ea, 0x00eb, 0x00ed, 0x00ec, 0x00ee, 0x00ef, 0x00f1, 0x00f3, 0x00f2,
123 0x00f4, 0x00f6, 0x00f5, 0x00fa, 0x00f9, 0x00fb, 0x00fc, 0x2020, 0x00b0,
124 0x00a2, 0x00a3, 0x00a7, 0x2022, 0x00b6, 0x00df, 0x00ae, 0x00a9, 0x2122,
125 0x00b4, 0x00a8, 0x0000, 0x00c6, 0x00d8, 0x0000, 0x00b1, 0x0000, 0x0000,
126 0x00a5, 0x00b5, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x00aa, 0x00ba,
127 0x0000, 0x00e6, 0x00f8, 0x00bf, 0x00a3, 0x00ac, 0x0000, 0x0192, 0x0000,
128 0x0000, 0x00ab, 0x00bb, 0x2026, 0x0020, 0x00c0, 0x00c3, 0x00d5, 0x0152,
129 0x0153, 0x2013, 0x2014, 0x201c, 0x201d, 0x2018, 0x2019, 0x00f7, 0x0000,
130 0x00ff, 0x0178, 0x2044, 0x00a4, 0x2039, 0x203a, 0xfb01, 0xfb02, 0x2021,
131 0x00b7, 0x201a, 0x201e, 0x2030, 0x00c2, 0x00ca, 0x00c1, 0x00cb, 0x00c8,
132 0x00cd, 0x00ce, 0x00cf, 0x00cc, 0x00d3, 0x00d4, 0x0000, 0x00d2, 0x00da,
133 0x00db, 0x00d9, 0x0131, 0x02c6, 0x02dc, 0x00af, 0x02d8, 0x02d9, 0x02da,
134 0x00b8, 0x02dd, 0x02db, 0x02c7};
135 static const FX_WORD AdobeWinAnsiEncoding[256] = {
136 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
137 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
138 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
139 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0020, 0x0021, 0x0022, 0x0023,
140 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002a, 0x002b, 0x002c,
141 0x002d, 0x002e, 0x002f, 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035,
142 0x0036, 0x0037, 0x0038, 0x0039, 0x003a, 0x003b, 0x003c, 0x003d, 0x003e,
143 0x003f, 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047,
144 0x0048, 0x0049, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x004f, 0x0050,
145 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059,
146 0x005a, 0x005b, 0x005c, 0x005d, 0x005e, 0x005f, 0x0060, 0x0061, 0x0062,
147 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006a, 0x006b,
148 0x006c, 0x006d, 0x006e, 0x006f, 0x0070, 0x0071, 0x0072, 0x0073, 0x0074,
149 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007a, 0x007b, 0x007c, 0x007d,
150 0x007e, 0x2022, 0x20ac, 0x2022, 0x201a, 0x0192, 0x201e, 0x2026, 0x2020,
151 0x2021, 0x02c6, 0x2030, 0x0160, 0x2039, 0x0152, 0x2022, 0x017d, 0x2022,
152 0x2022, 0x2018, 0x2019, 0x201c, 0x201d, 0x2022, 0x2013, 0x2014, 0x02dc,
153 0x2122, 0x0161, 0x203a, 0x0153, 0x2022, 0x017e, 0x0178, 0x0020, 0x00a1,
154 0x00a2, 0x00a3, 0x00a4, 0x00a5, 0x00a6, 0x00a7, 0x00a8, 0x00a9, 0x00aa,
155 0x00ab, 0x00ac, 0x002d, 0x00ae, 0x00af, 0x00b0, 0x00b1, 0x00b2, 0x00b3,
156 0x00b4, 0x00b5, 0x00b6, 0x00b7, 0x00b8, 0x00b9, 0x00ba, 0x00bb, 0x00bc,
157 0x00bd, 0x00be, 0x00bf, 0x00c0, 0x00c1, 0x00c2, 0x00c3, 0x00c4, 0x00c5,
158 0x00c6, 0x00c7, 0x00c8, 0x00c9, 0x00ca, 0x00cb, 0x00cc, 0x00cd, 0x00ce,
159 0x00cf, 0x00d0, 0x00d1, 0x00d2, 0x00d3, 0x00d4, 0x00d5, 0x00d6, 0x00d7,
160 0x00d8, 0x00d9, 0x00da, 0x00db, 0x00dc, 0x00dd, 0x00de, 0x00df, 0x00e0,
161 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x00e7, 0x00e8, 0x00e9,
162 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef, 0x00f0, 0x00f1, 0x00f2,
163 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x00f7, 0x00f8, 0x00f9, 0x00fa, 0x00fb,
164 0x00fc, 0x00fd, 0x00fe, 0x00ff};
165 static const FX_WORD MacExpertEncoding[256] = {
166 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
167 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
168 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
169 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0020, 0xf721, 0xf6f8, 0xf7a2,
170 0xf724, 0xf6e4, 0xf726, 0xf7b4, 0x207d, 0x207e, 0x2025, 0x2024, 0x002c,
171 0x002d, 0x002e, 0x2044, 0xf730, 0xf731, 0xf732, 0xf733, 0xf734, 0xf735,
172 0xf736, 0xf737, 0xf738, 0xf739, 0x003a, 0x003b, 0x0000, 0xf6de, 0x0000,
173 0xf73f, 0x0000, 0x0000, 0x0000, 0x0000, 0xf7f0, 0x0000, 0x0000, 0x00bc,
174 0x00bd, 0x00be, 0x215b, 0x215c, 0x215d, 0x215e, 0x2153, 0x2154, 0x0000,
175 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xfb00, 0xfb01, 0xfb02, 0xfb03,
176 0xfb04, 0x208d, 0x0000, 0x208e, 0xf6f6, 0xf6e5, 0xf760, 0xf761, 0xf762,
177 0xf763, 0xf764, 0xf765, 0xf766, 0xf767, 0xf768, 0xf769, 0xf76a, 0xf76b,
178 0xf76c, 0xf76d, 0xf76e, 0xf76f, 0xf770, 0xf771, 0xf772, 0xf773, 0xf774,
179 0xf775, 0xf776, 0xf777, 0xf778, 0xf779, 0xf77a, 0x20a1, 0xf6dc, 0xf6dd,
180 0xf6fe, 0x0000, 0x0000, 0xf6e9, 0xf6e0, 0x0000, 0x0000, 0x0000, 0x0000,
181 0xf7e1, 0xf7e0, 0xf7e2, 0xf7e4, 0xf7e3, 0xf7e5, 0xf7e7, 0xf7e9, 0xf7e8,
182 0xf7ea, 0xf7eb, 0xf7ed, 0xf7ec, 0xf7ee, 0xf7ef, 0xf7f1, 0xf7f3, 0xf7f2,
183 0xf7f4, 0xf7f6, 0xf7f5, 0xf7fa, 0xf7f9, 0xf7fb, 0xf7fc, 0x0000, 0x2078,
184 0x2084, 0x2083, 0x2086, 0x2088, 0x2087, 0xf6fd, 0x0000, 0xf6df, 0x2082,
185 0x0000, 0xf7a8, 0x0000, 0xf6f5, 0xf6fd, 0x2085, 0x0000, 0xf6e1, 0xf6e7,
186 0xf7fd, 0x0000, 0xf6e3, 0x0000, 0x0000, 0xf7fe, 0x0000, 0x2089, 0x2080,
187 0xf6ff, 0xf7e6, 0xf7f8, 0xf7bf, 0x2081, 0xf6e9, 0x0000, 0x0000, 0x0000,
188 0x0000, 0x0000, 0x0000, 0xf7b8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
189 0xf6fa, 0x2012, 0xf6e6, 0x0000, 0x0000, 0x0000, 0x0000, 0xf7a1, 0x0000,
190 0xf7ff, 0x0000, 0x00b9, 0x00b2, 0x00b3, 0x2074, 0x2075, 0x2076, 0x2077,
191 0x2079, 0x2070, 0x0000, 0xf6ec, 0xf6f1, 0x0000, 0x0000, 0x0000, 0xf6ed,
192 0xf6f2, 0xf6eb, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xf6ee, 0xf6fb,
193 0xf6f4, 0xf7af, 0xf6ea, 0x207f, 0xf6ef, 0xf6e2, 0xf6e8, 0xf6f7, 0xf6fc,
194 0x0000, 0x0000, 0x0000, 0x0000};
195 static const FX_WORD AdobeSymbolEncoding[256] = {
196 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
197 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
198 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
199 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0020, 0x0021, 0x2200, 0x0023,
200 0x2203, 0x0025, 0x0026, 0x220B, 0x0028, 0x0029, 0x2217, 0x002B, 0x002C,
201 0x2212, 0x002E, 0x002F, 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035,
202 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E,
203 0x003F, 0x2245, 0x0391, 0x0392, 0x03A7, 0x0394, 0x0395, 0x03A6, 0x0393,
204 0x0397, 0x0399, 0x03D1, 0x039A, 0x039B, 0x039C, 0x039D, 0x039F, 0x03A0,
205 0x0398, 0x03A1, 0x03A3, 0x03A4, 0x03A5, 0x03C2, 0x03A9, 0x039E, 0x03A8,
206 0x0396, 0x005B, 0x2234, 0x005D, 0x22A5, 0x005F, 0xF8E5, 0x03B1, 0x03B2,
207 0x03C7, 0x03B4, 0x03B5, 0x03C6, 0x03B3, 0x03B7, 0x03B9, 0x03D5, 0x03BA,
208 0x03BB, 0x03BC, 0x03BD, 0x03BF, 0x03C0, 0x03B8, 0x03C1, 0x03C3, 0x03C4,
209 0x03C5, 0x03D6, 0x03C9, 0x03BE, 0x03C8, 0x03B6, 0x007B, 0x007C, 0x007D,
210 0x223C, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
211 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
212 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
213 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x20AC, 0x03D2,
214 0x2032, 0x2264, 0x2044, 0x221E, 0x0192, 0x2663, 0x2666, 0x2665, 0x2660,
215 0x2194, 0x2190, 0x2191, 0x2192, 0x2193, 0x00B0, 0x00B1, 0x2033, 0x2265,
216 0x00D7, 0x221D, 0x2202, 0x2022, 0x00F7, 0x2260, 0x2261, 0x2248, 0x2026,
217 0xF8E6, 0xF8E7, 0x21B5, 0x2135, 0x2111, 0x211C, 0x2118, 0x2297, 0x2295,
218 0x2205, 0x2229, 0x222A, 0x2283, 0x2287, 0x2284, 0x2282, 0x2286, 0x2208,
219 0x2209, 0x2220, 0x2207, 0xF6DA, 0xF6D9, 0xF6DB, 0x220F, 0x221A, 0x22C5,
220 0x00AC, 0x2227, 0x2228, 0x21D4, 0x21D0, 0x21D1, 0x21D2, 0x21D3, 0x25CA,
221 0x2329, 0xF8E8, 0xF8E9, 0xF8EA, 0x2211, 0xF8EB, 0xF8EC, 0xF8ED, 0xF8EE,
222 0xF8EF, 0xF8F0, 0xF8F1, 0xF8F2, 0xF8F3, 0xF8F4, 0x0000, 0x232A, 0x222B,
223 0x2320, 0xF8F5, 0x2321, 0xF8F6, 0xF8F7, 0xF8F8, 0xF8F9, 0xF8FA, 0xF8FB,
224 0xF8FC, 0xF8FD, 0xF8FE, 0x0000,
225 };
226 static const FX_WORD ZapfEncoding[256] = {
227 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
228 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
229 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
230 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0020, 0x2701, 0x2702, 0x2703,
231 0x2704, 0x260E, 0x2706, 0x2707, 0x2708, 0x2709, 0x261B, 0x261E, 0x270C,
232 0x270D, 0x270E, 0x270F, 0x2710, 0x2711, 0x2712, 0x2713, 0x2714, 0x2715,
233 0x2716, 0x2717, 0x2718, 0x2719, 0x271A, 0x271B, 0x271C, 0x271D, 0x271E,
234 0x271F, 0x2720, 0x2721, 0x2722, 0x2723, 0x2724, 0x2725, 0x2726, 0x2727,
235 0x2605, 0x2729, 0x272A, 0x272B, 0x272C, 0x272D, 0x272E, 0x272F, 0x2730,
236 0x2731, 0x2732, 0x2733, 0x2734, 0x2735, 0x2736, 0x2737, 0x2738, 0x2739,
237 0x273A, 0x273B, 0x273C, 0x273D, 0x273E, 0x273F, 0x2740, 0x2741, 0x2742,
238 0x2743, 0x2744, 0x2745, 0x2746, 0x2747, 0x2748, 0x2749, 0x274A, 0x274B,
239 0x25CF, 0x274D, 0x25A0, 0x274F, 0x2750, 0x2751, 0x2752, 0x25B2, 0x25BC,
240 0x25C6, 0x2756, 0x25D7, 0x2758, 0x2759, 0x275A, 0x275B, 0x275C, 0x275D,
241 0x275E, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
242 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
243 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
244 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x2761,
245 0x2762, 0x2763, 0x2764, 0x2765, 0x2766, 0x2767, 0x2663, 0x2666, 0x2665,
246 0x2660, 0x2460, 0x2461, 0x2462, 0x2463, 0x2464, 0x2465, 0x2466, 0x2467,
247 0x2468, 0x2469, 0x2776, 0x2777, 0x2778, 0x2779, 0x277A, 0x277B, 0x277C,
248 0x277D, 0x277E, 0x277F, 0x2780, 0x2781, 0x2782, 0x2783, 0x2784, 0x2785,
249 0x2786, 0x2787, 0x2788, 0x2789, 0x278A, 0x278B, 0x278C, 0x278D, 0x278E,
250 0x278F, 0x2790, 0x2791, 0x2792, 0x2793, 0x2794, 0x2192, 0x2194, 0x2195,
251 0x2798, 0x2799, 0x279A, 0x279B, 0x279C, 0x279D, 0x279E, 0x279F, 0x27A0,
252 0x27A1, 0x27A2, 0x27A3, 0x27A4, 0x27A5, 0x27A6, 0x27A7, 0x27A8, 0x27A9,
253 0x27AA, 0x27AB, 0x27AC, 0x27AD, 0x27AE, 0x27AF, 0x0000, 0x27B1, 0x27B2,
254 0x27B3, 0x27B4, 0x27B5, 0x27B6, 0x27B7, 0x27B8, 0x27B9, 0x27BA, 0x27BB,
255 0x27BC, 0x27BD, 0x27BE, 0x0000,
256 };
257 static const FX_CHAR* const StandardEncodingNames[224] = {
258 "space",
259 "exclam",
260 "quotedbl",
261 "numbersign",
262 "dollar",
263 "percent",
264 "ampersand",
265 "quoteright",
266 "parenleft",
267 "parenright",
268 "asterisk",
269 "plus",
270 "comma",
271 "hyphen",
272 "period",
273 "slash",
274 "zero",
275 "one",
276 "two",
277 "three",
278 "four",
279 "five",
280 "six",
281 "seven",
282 "eight",
283 "nine",
284 "colon",
285 "semicolon",
286 "less",
287 "equal",
288 "greater",
289 "question",
290 "at",
291 "A",
292 "B",
293 "C",
294 "D",
295 "E",
296 "F",
297 "G",
298 "H",
299 "I",
300 "J",
301 "K",
302 "L",
303 "M",
304 "N",
305 "O",
306 "P",
307 "Q",
308 "R",
309 "S",
310 "T",
311 "U",
312 "V",
313 "W",
314 "X",
315 "Y",
316 "Z",
317 "bracketleft",
318 "backslash",
319 "bracketright",
320 "asciicircum",
321 "underscore",
322 "quoteleft",
323 "a",
324 "b",
325 "c",
326 "d",
327 "e",
328 "f",
329 "g",
330 "h",
331 "i",
332 "j",
333 "k",
334 "l",
335 "m",
336 "n",
337 "o",
338 "p",
339 "q",
340 "r",
341 "s",
342 "t",
343 "u",
344 "v",
345 "w",
346 "x",
347 "y",
348 "z",
349 "braceleft",
350 "bar",
351 "braceright",
352 "asciitilde",
353 NULL,
354 NULL,
355 NULL,
356 NULL,
357 NULL,
358 NULL,
359 NULL,
360 NULL,
361 NULL,
362 NULL,
363 NULL,
364 NULL,
365 NULL,
366 NULL,
367 NULL,
368 NULL,
369 NULL,
370 NULL,
371 NULL,
372 NULL,
373 NULL,
374 NULL,
375 NULL,
376 NULL,
377 NULL,
378 NULL,
379 NULL,
380 NULL,
381 NULL,
382 NULL,
383 NULL,
384 NULL,
385 NULL,
386 NULL,
387 "exclamdown",
388 "cent",
389 "sterling",
390 "fraction",
391 "yen",
392 "florin",
393 "section",
394 "currency",
395 "quotesingle",
396 "quotedblleft",
397 "guillemotleft",
398 "guilsinglleft",
399 "guilsinglright",
400 "fi",
401 "fl",
402 NULL,
403 "endash",
404 "dagger",
405 "daggerdbl",
406 "periodcentered",
407 NULL,
408 "paragraph",
409 "bullet",
410 "quotesinglbase",
411 "quotedblbase",
412 "quotedblright",
413 "guillemotright",
414 "ellipsis",
415 "perthousand",
416 NULL,
417 "questiondown",
418 NULL,
419 "grave",
420 "acute",
421 "circumflex",
422 "tilde",
423 "macron",
424 "breve",
425 "dotaccent",
426 "dieresis",
427 NULL,
428 "ring",
429 "cedilla",
430 NULL,
431 "hungarumlaut",
432 "ogonek",
433 "caron",
434 "emdash",
435 NULL,
436 NULL,
437 NULL,
438 NULL,
439 NULL,
440 NULL,
441 NULL,
442 NULL,
443 NULL,
444 NULL,
445 NULL,
446 NULL,
447 NULL,
448 NULL,
449 NULL,
450 NULL,
451 "AE",
452 NULL,
453 "ordfeminine",
454 NULL,
455 NULL,
456 NULL,
457 NULL,
458 "Lslash",
459 "Oslash",
460 "OE",
461 "ordmasculine",
462 NULL,
463 NULL,
464 NULL,
465 NULL,
466 NULL,
467 "ae",
468 NULL,
469 NULL,
470 NULL,
471 "dotlessi",
472 NULL,
473 NULL,
474 "lslash",
475 "oslash",
476 "oe",
477 "germandbls",
478 NULL,
479 NULL,
480 NULL,
481 NULL,
482 };
483 static const FX_CHAR* const AdobeWinAnsiEncodingNames[224] = {
484 "space",
485 "exclam",
486 "quotedbl",
487 "numbersign",
488 "dollar",
489 "percent",
490 "ampersand",
491 "quotesingle",
492 "parenleft",
493 "parenright",
494 "asterisk",
495 "plus",
496 "comma",
497 "hyphen",
498 "period",
499 "slash",
500 "zero",
501 "one",
502 "two",
503 "three",
504 "four",
505 "five",
506 "six",
507 "seven",
508 "eight",
509 "nine",
510 "colon",
511 "semicolon",
512 "less",
513 "equal",
514 "greater",
515 "question",
516 "at",
517 "A",
518 "B",
519 "C",
520 "D",
521 "E",
522 "F",
523 "G",
524 "H",
525 "I",
526 "J",
527 "K",
528 "L",
529 "M",
530 "N",
531 "O",
532 "P",
533 "Q",
534 "R",
535 "S",
536 "T",
537 "U",
538 "V",
539 "W",
540 "X",
541 "Y",
542 "Z",
543 "bracketleft",
544 "backslash",
545 "bracketright",
546 "asciicircum",
547 "underscore",
548 "grave",
549 "a",
550 "b",
551 "c",
552 "d",
553 "e",
554 "f",
555 "g",
556 "h",
557 "i",
558 "j",
559 "k",
560 "l",
561 "m",
562 "n",
563 "o",
564 "p",
565 "q",
566 "r",
567 "s",
568 "t",
569 "u",
570 "v",
571 "w",
572 "x",
573 "y",
574 "z",
575 "braceleft",
576 "bar",
577 "braceright",
578 "asciitilde",
579 "bullet",
580 "Euro",
581 "bullet",
582 "quotesinglbase",
583 "florin",
584 "quotedblbase",
585 "ellipsis",
586 "dagger",
587 "daggerdbl",
588 "circumflex",
589 "perthousand",
590 "Scaron",
591 "guilsinglleft",
592 "OE",
593 "bullet",
594 "Zcaron",
595 "bullet",
596 "bullet",
597 "quoteleft",
598 "quoteright",
599 "quotedblleft",
600 "quotedblright",
601 "bullet",
602 "endash",
603 "emdash",
604 "tilde",
605 "trademark",
606 "scaron",
607 "guilsinglright",
608 "oe",
609 "bullet",
610 "zcaron",
611 "Ydieresis",
612 "space",
613 "exclamdown",
614 "cent",
615 "sterling",
616 "currency",
617 "yen",
618 "brokenbar",
619 "section",
620 "dieresis",
621 "copyright",
622 "ordfeminine",
623 "guillemotleft",
624 "logicalnot",
625 "hyphen",
626 "registered",
627 "macron",
628 "degree",
629 "plusminus",
630 "twosuperior",
631 "threesuperior",
632 "acute",
633 "mu",
634 "paragraph",
635 "periodcentered",
636 "cedilla",
637 "onesuperior",
638 "ordmasculine",
639 "guillemotright",
640 "onequarter",
641 "onehalf",
642 "threequarters",
643 "questiondown",
644 "Agrave",
645 "Aacute",
646 "Acircumflex",
647 "Atilde",
648 "Adieresis",
649 "Aring",
650 "AE",
651 "Ccedilla",
652 "Egrave",
653 "Eacute",
654 "Ecircumflex",
655 "Edieresis",
656 "Igrave",
657 "Iacute",
658 "Icircumflex",
659 "Idieresis",
660 "Eth",
661 "Ntilde",
662 "Ograve",
663 "Oacute",
664 "Ocircumflex",
665 "Otilde",
666 "Odieresis",
667 "multiply",
668 "Oslash",
669 "Ugrave",
670 "Uacute",
671 "Ucircumflex",
672 "Udieresis",
673 "Yacute",
674 "Thorn",
675 "germandbls",
676 "agrave",
677 "aacute",
678 "acircumflex",
679 "atilde",
680 "adieresis",
681 "aring",
682 "ae",
683 "ccedilla",
684 "egrave",
685 "eacute",
686 "ecircumflex",
687 "edieresis",
688 "igrave",
689 "iacute",
690 "icircumflex",
691 "idieresis",
692 "eth",
693 "ntilde",
694 "ograve",
695 "oacute",
696 "ocircumflex",
697 "otilde",
698 "odieresis",
699 "divide",
700 "oslash",
701 "ugrave",
702 "uacute",
703 "ucircumflex",
704 "udieresis",
705 "yacute",
706 "thorn",
707 "ydieresis",
708 };
709 static const FX_CHAR* const MacRomanEncodingNames[224] = {
710 "space",
711 "exclam",
712 "quotedbl",
713 "numbersign",
714 "dollar",
715 "percent",
716 "ampersand",
717 "quotesingle",
718 "parenleft",
719 "parenright",
720 "asterisk",
721 "plus",
722 "comma",
723 "hyphen",
724 "period",
725 "slash",
726 "zero",
727 "one",
728 "two",
729 "three",
730 "four",
731 "five",
732 "six",
733 "seven",
734 "eight",
735 "nine",
736 "colon",
737 "semicolon",
738 "less",
739 "equal",
740 "greater",
741 "question",
742 "at",
743 "A",
744 "B",
745 "C",
746 "D",
747 "E",
748 "F",
749 "G",
750 "H",
751 "I",
752 "J",
753 "K",
754 "L",
755 "M",
756 "N",
757 "O",
758 "P",
759 "Q",
760 "R",
761 "S",
762 "T",
763 "U",
764 "V",
765 "W",
766 "X",
767 "Y",
768 "Z",
769 "bracketleft",
770 "backslash",
771 "bracketright",
772 "asciicircum",
773 "underscore",
774 "grave",
775 "a",
776 "b",
777 "c",
778 "d",
779 "e",
780 "f",
781 "g",
782 "h",
783 "i",
784 "j",
785 "k",
786 "l",
787 "m",
788 "n",
789 "o",
790 "p",
791 "q",
792 "r",
793 "s",
794 "t",
795 "u",
796 "v",
797 "w",
798 "x",
799 "y",
800 "z",
801 "braceleft",
802 "bar",
803 "braceright",
804 "asciitilde",
805 NULL,
806 "Adieresis",
807 "Aring",
808 "Ccedilla",
809 "Eacute",
810 "Ntilde",
811 "Odieresis",
812 "Udieresis",
813 "aacute",
814 "agrave",
815 "acircumflex",
816 "adieresis",
817 "atilde",
818 "aring",
819 "ccedilla",
820 "eacute",
821 "egrave",
822 "ecircumflex",
823 "edieresis",
824 "iacute",
825 "igrave",
826 "icircumflex",
827 "idieresis",
828 "ntilde",
829 "oacute",
830 "ograve",
831 "ocircumflex",
832 "odieresis",
833 "otilde",
834 "uacute",
835 "ugrave",
836 "ucircumflex",
837 "udieresis",
838 "dagger",
839 "degree",
840 "cent",
841 "sterling",
842 "section",
843 "bullet",
844 "paragraph",
845 "germandbls",
846 "registered",
847 "copyright",
848 "trademark",
849 "acute",
850 "dieresis",
851 "notequal",
852 "AE",
853 "Oslash",
854 "infinity",
855 "plusminus",
856 "lessequal",
857 "greaterequal",
858 "yen",
859 "mu",
860 "partialdiff",
861 "summation",
862 "product",
863 "pi",
864 "integral",
865 "ordfeminine",
866 "ordmasculine",
867 "Omega",
868 "ae",
869 "oslash",
870 "questiondown",
871 "exclamdown",
872 "logicalnot",
873 "radical",
874 "florin",
875 "approxequal",
876 "Delta",
877 "guillemotleft",
878 "guillemotright",
879 "ellipsis",
880 "space",
881 "Agrave",
882 "Atilde",
883 "Otilde",
884 "OE",
885 "oe",
886 "endash",
887 "emdash",
888 "quotedblleft",
889 "quotedblright",
890 "quoteleft",
891 "quoteright",
892 "divide",
893 "lozenge",
894 "ydieresis",
895 "Ydieresis",
896 "fraction",
897 "currency",
898 "guilsinglleft",
899 "guilsinglright",
900 "fi",
901 "fl",
902 "daggerdbl",
903 "periodcentered",
904 "quotesinglbase",
905 "quotedblbase",
906 "perthousand",
907 "Acircumflex",
908 "Ecircumflex",
909 "Aacute",
910 "Edieresis",
911 "Egrave",
912 "Iacute",
913 "Icircumflex",
914 "Idieresis",
915 "Igrave",
916 "Oacute",
917 "Ocircumflex",
918 "apple",
919 "Ograve",
920 "Uacute",
921 "Ucircumflex",
922 "Ugrave",
923 "dotlessi",
924 "circumflex",
925 "tilde",
926 "macron",
927 "breve",
928 "dotaccent",
929 "ring",
930 "cedilla",
931 "hungarumlaut",
932 "ogonek",
933 "caron",
934 };
935 static const FX_CHAR* const MacExpertEncodingNames[224] = {
936 "space",
937 "exclamsmall",
938 "Hungarumlautsmall",
939 "centoldstyle",
940 "dollaroldstyle",
941 "dollarsuperior",
942 "ampersandsmall",
943 "Acutesmall",
944 "parenleftsuperior",
945 "parenrightsuperior",
946 "twodotenleader",
947 "onedotenleader",
948 "comma",
949 "hyphen",
950 "period",
951 "fraction",
952 "zerooldstyle",
953 "oneoldstyle",
954 "twooldstyle",
955 "threeoldstyle",
956 "fouroldstyle",
957 "fiveoldstyle",
958 "sixoldstyle",
959 "sevenoldstyle",
960 "eightoldstyle",
961 "nineoldstyle",
962 "colon",
963 "semicolon",
964 NULL,
965 "threequartersemdash",
966 NULL,
967 "questionsmall",
968 NULL,
969 NULL,
970 NULL,
971 NULL,
972 "Ethsmall",
973 NULL,
974 NULL,
975 "onequarter",
976 "onehalf",
977 "threequarters",
978 "oneeighth",
979 "threeeighths",
980 "fiveeighths",
981 "seveneighths",
982 "onethird",
983 "twothirds",
984 NULL,
985 NULL,
986 NULL,
987 NULL,
988 NULL,
989 NULL,
990 "ff",
991 "fi",
992 "fl",
993 "ffi",
994 "ffl",
995 "parenleftinferior",
996 NULL,
997 "parenrightinferior",
998 "Circumflexsmall",
999 "hypheninferior",
1000 "Gravesmall",
1001 "Asmall",
1002 "Bsmall",
1003 "Csmall",
1004 "Dsmall",
1005 "Esmall",
1006 "Fsmall",
1007 "Gsmall",
1008 "Hsmall",
1009 "Ismall",
1010 "Jsmall",
1011 "Ksmall",
1012 "Lsmall",
1013 "Msmall",
1014 "Nsmall",
1015 "Osmall",
1016 "Psmall",
1017 "Qsmall",
1018 "Rsmall",
1019 "Ssmall",
1020 "Tsmall",
1021 "Usmall",
1022 "Vsmall",
1023 "Wsmall",
1024 "Xsmall",
1025 "Ysmall",
1026 "Zsmall",
1027 "colonmonetary",
1028 "onefitted",
1029 "rupiah",
1030 "Tildesmall",
1031 NULL,
1032 NULL,
1033 "asuperior",
1034 "centsuperior",
1035 NULL,
1036 NULL,
1037 NULL,
1038 NULL,
1039 "Aacutesmall",
1040 "Agravesmall",
1041 "Acircumflexsmall",
1042 "Adieresissmall",
1043 "Atildesmall",
1044 "Aringsmall",
1045 "Ccedillasmall",
1046 "Eacutesmall",
1047 "Egravesmall",
1048 "Ecircumflexsmall",
1049 "Edieresissmall",
1050 "Iacutesmall",
1051 "Igravesmall",
1052 "Icircumflexsmall",
1053 "Idieresissmall",
1054 "Ntildesmall",
1055 "Oacutesmall",
1056 "Ogravesmall",
1057 "Ocircumflexsmall",
1058 "Odieresissmall",
1059 "Otildesmall",
1060 "Uacutesmall",
1061 "Ugravesmall",
1062 "Ucircumflexsmall",
1063 "Udieresissmall",
1064 NULL,
1065 "eightsuperior",
1066 "fourinferior",
1067 "threeinferior",
1068 "sixinferior",
1069 "eightinferior",
1070 "seveninferior",
1071 "Scaronsmall",
1072 NULL,
1073 "centinferior",
1074 "twoinferior",
1075 NULL,
1076 "Dieresissmall",
1077 NULL,
1078 "Caronsmall",
1079 "Scaronsmall",
1080 "fiveinferior",
1081 NULL,
1082 "commainferior",
1083 "periodinferior",
1084 "Yacutesmall",
1085 NULL,
1086 "dollarinferior",
1087 NULL,
1088 NULL,
1089 "Thornsmall",
1090 NULL,
1091 "nineinferior",
1092 "zeroinferior",
1093 "Zcaronsmall",
1094 "AEsmall",
1095 "Oslashsmall",
1096 "questiondownsmall",
1097 "oneinferior",
1098 "asuperior",
1099 NULL,
1100 NULL,
1101 NULL,
1102 NULL,
1103 NULL,
1104 NULL,
1105 "Cedillasmall",
1106 NULL,
1107 NULL,
1108 NULL,
1109 NULL,
1110 NULL,
1111 "OEsmall",
1112 "figuredash",
1113 "hyphensuperior",
1114 NULL,
1115 NULL,
1116 NULL,
1117 NULL,
1118 "exclamdownsmall",
1119 NULL,
1120 "Ydieresissmall",
1121 NULL,
1122 "onesuperior",
1123 "twosuperior",
1124 "threesuperior",
1125 "foursuperior",
1126 "fivesuperior",
1127 "sixsuperior",
1128 "sevensuperior",
1129 "ninesuperior",
1130 "zerosuperior",
1131 NULL,
1132 "esuperior",
1133 "rsuperior",
1134 NULL,
1135 NULL,
1136 NULL,
1137 "isuperior",
1138 "ssuperior",
1139 "dsuperior",
1140 NULL,
1141 NULL,
1142 NULL,
1143 NULL,
1144 NULL,
1145 "lsuperior",
1146 "Ogoneksmall",
1147 "Brevesmall",
1148 "Macronsmall",
1149 "bsuperior",
1150 "nsuperior",
1151 "msuperior",
1152 "commasuperior",
1153 "periodsuperior",
1154 "Dotaccentsmall",
1155 "Ringsmall",
1156 NULL,
1157 NULL,
1158 NULL,
1159 NULL,
1160 };
1161 static const FX_CHAR* const PDFDocEncodingNames[232] = {
1162 "breve",
1163 "caron",
1164 "circumflex",
1165 "dotaccent",
1166 "hungarumlaut",
1167 "ogonek",
1168 "ring",
1169 "tilde",
1170 "space",
1171 "exclam",
1172 "quotedbl",
1173 "numbersign",
1174 "dollar",
1175 "percent",
1176 "ampersand",
1177 "quotesingle",
1178 "parenleft",
1179 "parenright",
1180 "asterisk",
1181 "plus",
1182 "comma",
1183 "hyphen",
1184 "period",
1185 "slash",
1186 "zero",
1187 "one",
1188 "two",
1189 "three",
1190 "four",
1191 "five",
1192 "six",
1193 "seven",
1194 "eight",
1195 "nine",
1196 "colon",
1197 "semicolon",
1198 "less",
1199 "equal",
1200 "greater",
1201 "question",
1202 "at",
1203 "A",
1204 "B",
1205 "C",
1206 "D",
1207 "E",
1208 "F",
1209 "G",
1210 "H",
1211 "I",
1212 "J",
1213 "K",
1214 "L",
1215 "M",
1216 "N",
1217 "O",
1218 "P",
1219 "Q",
1220 "R",
1221 "S",
1222 "T",
1223 "U",
1224 "V",
1225 "W",
1226 "X",
1227 "Y",
1228 "Z",
1229 "bracketleft",
1230 "backslash",
1231 "bracketright",
1232 "asciicircum",
1233 "underscore",
1234 "grave",
1235 "a",
1236 "b",
1237 "c",
1238 "d",
1239 "e",
1240 "f",
1241 "g",
1242 "h",
1243 "i",
1244 "j",
1245 "k",
1246 "l",
1247 "m",
1248 "n",
1249 "o",
1250 "p",
1251 "q",
1252 "r",
1253 "s",
1254 "t",
1255 "u",
1256 "v",
1257 "w",
1258 "x",
1259 "y",
1260 "z",
1261 "braceleft",
1262 "bar",
1263 "braceright",
1264 "asciitilde",
1265 NULL,
1266 "bullet3",
1267 "dagger",
1268 "daggerdbl",
1269 "ellipsis",
1270 "emdash",
1271 "endash",
1272 "florin",
1273 "fraction",
1274 "guilsinglleft",
1275 "guilsinglright",
1276 "minus",
1277 "perthousand",
1278 "quotedblbase",
1279 "quotedblleft",
1280 "quotedblright",
1281 "quoteleft",
1282 "quoteright",
1283 "quotesinglbase",
1284 "trademark",
1285 "fi",
1286 "fl",
1287 "Lslash",
1288 "OE",
1289 "Scaron",
1290 "Ydieresis",
1291 "Zcaron2",
1292 "dotlessi",
1293 "lslash",
1294 "oe",
1295 "scaron",
1296 "zcaron2",
1297 NULL,
1298 "Euro",
1299 "exclamdown",
1300 "cent",
1301 "sterling",
1302 "currency",
1303 "yen",
1304 "brokenbar",
1305 "section",
1306 "dieresis",
1307 "copyright",
1308 "ordfeminine",
1309 "guillemotleft4",
1310 "logicalnot",
1311 NULL,
1312 "registered",
1313 "macron",
1314 "degree",
1315 "plusminus",
1316 "twosuperior",
1317 "threesuperior",
1318 "acute",
1319 "mu",
1320 "paragraph",
1321 "periodcentered",
1322 "cedilla",
1323 "onesuperior",
1324 "ordmasculine",
1325 "guillemotright4",
1326 "onequarter",
1327 "onehalf",
1328 "threequarters",
1329 "questiondown",
1330 "Agrave",
1331 "Aacute",
1332 "Acircumflex",
1333 "Atilde",
1334 "Adieresis",
1335 "Aring",
1336 "AE",
1337 "Ccedilla",
1338 "Egrave",
1339 "Eacute",
1340 "Ecircumflex",
1341 "Edieresis",
1342 "Igrave",
1343 "Iacute",
1344 "Icircumflex",
1345 "Idieresis",
1346 "Eth",
1347 "Ntilde",
1348 "Ograve",
1349 "Oacute",
1350 "Ocircumflex",
1351 "Otilde",
1352 "Odieresis",
1353 "multiply",
1354 "Oslash",
1355 "Ugrave",
1356 "Uacute",
1357 "Ucircumflex",
1358 "Udieresis",
1359 "Yacute",
1360 "Thorn",
1361 "germandbls",
1362 "agrave",
1363 "aacute",
1364 "acircumflex",
1365 "atilde",
1366 "adieresis",
1367 "aring",
1368 "ae",
1369 "ccedilla",
1370 "egrave",
1371 "eacute",
1372 "ecircumflex",
1373 "edieresis",
1374 "igrave",
1375 "iacute",
1376 "icircumflex",
1377 "idieresis",
1378 "eth",
1379 "ntilde",
1380 "ograve",
1381 "oacute",
1382 "ocircumflex",
1383 "otilde",
1384 "odieresis",
1385 "divide",
1386 "oslash",
1387 "ugrave",
1388 "uacute",
1389 "ucircumflex",
1390 "udieresis",
1391 "yacute",
1392 "thorn",
1393 "ydieresis",
1394 };
1395 static const FX_CHAR* const AdobeSymbolEncodingNames[224] = {
1396 "space",
1397 "exclam",
1398 "universal",
1399 "numbersign",
1400 "existential",
1401 "percent",
1402 "ampersand",
1403 "suchthat",
1404 "parenleft",
1405 "parenright",
1406 "asteriskmath",
1407 "plus",
1408 "comma",
1409 "minus",
1410 "period",
1411 "slash",
1412 "zero",
1413 "one",
1414 "two",
1415 "three",
1416 "four",
1417 "five",
1418 "six",
1419 "seven",
1420 "eight",
1421 "nine",
1422 "colon",
1423 "semicolon",
1424 "less",
1425 "equal",
1426 "greater",
1427 "question",
1428 "congruent",
1429 "Alpha",
1430 "Beta",
1431 "Chi",
1432 "Delta",
1433 "Epsilon",
1434 "Phi",
1435 "Gamma",
1436 "Eta",
1437 "Iota",
1438 "theta1",
1439 "Kappa",
1440 "Lambda",
1441 "Mu",
1442 "Nu",
1443 "Omicron",
1444 "Pi",
1445 "Theta",
1446 "Rho",
1447 "Sigma",
1448 "Tau",
1449 "Upsilon",
1450 "sigma1",
1451 "Omega",
1452 "Xi",
1453 "Psi",
1454 "Zeta",
1455 "bracketleft",
1456 "therefore",
1457 "bracketright",
1458 "perpendicular",
1459 "underscore",
1460 "radicalex",
1461 "alpha",
1462 "beta",
1463 "chi",
1464 "delta",
1465 "epsilon",
1466 "phi",
1467 "gamma",
1468 "eta",
1469 "iota",
1470 "phi1",
1471 "kappa",
1472 "lambda",
1473 "mu",
1474 "nu",
1475 "omicron",
1476 "pi",
1477 "theta",
1478 "rho",
1479 "sigma",
1480 "tau",
1481 "upsilon",
1482 "omega1",
1483 "omega",
1484 "xi",
1485 "psi",
1486 "zeta",
1487 "braceleft",
1488 "bar",
1489 "braceright",
1490 "similar",
1491 NULL,
1492 NULL,
1493 NULL,
1494 NULL,
1495 NULL,
1496 NULL,
1497 NULL,
1498 NULL,
1499 NULL,
1500 NULL,
1501 NULL,
1502 NULL,
1503 NULL,
1504 NULL,
1505 NULL,
1506 NULL,
1507 NULL,
1508 NULL,
1509 NULL,
1510 NULL,
1511 NULL,
1512 NULL,
1513 NULL,
1514 NULL,
1515 NULL,
1516 NULL,
1517 NULL,
1518 NULL,
1519 NULL,
1520 NULL,
1521 NULL,
1522 NULL,
1523 NULL,
1524 "Euro",
1525 "Upsilon1",
1526 "minute",
1527 "lessequal",
1528 "fraction",
1529 "infinity",
1530 "florin",
1531 "club",
1532 "diamond",
1533 "heart",
1534 "spade",
1535 "arrowboth",
1536 "arrowleft",
1537 "arrowup",
1538 "arrowright",
1539 "arrowdown",
1540 "degree",
1541 "plusminus",
1542 "second",
1543 "greaterequal",
1544 "multiply",
1545 "proportional",
1546 "partialdiff",
1547 "bullet",
1548 "divide",
1549 "notequal",
1550 "equivalence",
1551 "approxequal",
1552 "ellipsis",
1553 "arrowvertex",
1554 "arrowhorizex",
1555 "carriagereturn",
1556 "aleph",
1557 "Ifraktur",
1558 "Rfraktur",
1559 "weierstrass",
1560 "circlemultiply",
1561 "circleplus",
1562 "emptyset",
1563 "intersection",
1564 "union",
1565 "propersuperset",
1566 "reflexsuperset",
1567 "notsubset",
1568 "propersubset",
1569 "reflexsubset",
1570 "element",
1571 "notelement",
1572 "angle",
1573 "gradient",
1574 "registerserif",
1575 "copyrightserif",
1576 "trademarkserif",
1577 "product",
1578 "radical",
1579 "dotmath",
1580 "logicalnot",
1581 "logicaland",
1582 "logicalor",
1583 "arrowdblboth",
1584 "arrowdblleft",
1585 "arrowdblup",
1586 "arrowdblright",
1587 "arrowdbldown",
1588 "lozenge",
1589 "angleleft",
1590 "registersans",
1591 "copyrightsans",
1592 "trademarksans",
1593 "summation",
1594 "parenlefttp",
1595 "parenleftex",
1596 "parenleftbt",
1597 "bracketlefttp",
1598 "bracketleftex",
1599 "bracketleftbt",
1600 "bracelefttp",
1601 "braceleftmid",
1602 "braceleftbt",
1603 "braceex",
1604 NULL,
1605 "angleright",
1606 "integral",
1607 "integraltp",
1608 "integralex",
1609 "integralbt",
1610 "parenrighttp",
1611 "parenrightex",
1612 "parenrightbt",
1613 "bracketrighttp",
1614 "bracketrightex",
1615 "bracketrightbt",
1616 "bracerighttp",
1617 "bracerightmid",
1618 "bracerightbt",
1619 NULL,
1620 };
1621 static const FX_CHAR* const ZapfEncodingNames[224] = {
1622 "space", "a1", "a2", "a202", "a3", "a4", "a5", "a119", "a118",
1623 "a117", "a11", "a12", "a13", "a14", "a15", "a16", "a105", "a17",
1624 "a18", "a19", "a20", "a21", "a22", "a23", "a24", "a25", "a26",
1625 "a27", "a28", "a6", "a7", "a8", "a9", "a10", "a29", "a30",
1626 "a31", "a32", "a33", "a34", "a35", "a36", "a37", "a38", "a39",
1627 "a40", "a41", "a42", "a43", "a44", "a45", "a46", "a47", "a48",
1628 "a49", "a50", "a51", "a52", "a53", "a54", "a55", "a56", "a57",
1629 "a58", "a59", "a60", "a61", "a62", "a63", "a64", "a65", "a66",
1630 "a67", "a68", "a69", "a70", "a71", "a72", "a73", "a74", "a203",
1631 "a75", "a204", "a76", "a77", "a78", "a79", "a81", "a82", "a83",
1632 "a84", "a97", "a98", "a99", "a100", NULL, "a89", "a90", "a93",
1633 "a94", "a91", "a92", "a205", "a85", "a206", "a86", "a87", "a88",
1634 "a95", "a96", NULL, NULL, NULL, NULL, NULL, NULL, NULL,
1635 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
1636 NULL, NULL, NULL, "a101", "a102", "a103", "a104", "a106", "a107",
1637 "a108", "a112", "a111", "a110", "a109", "a120", "a121", "a122", "a123",
1638 "a124", "a125", "a126", "a127", "a128", "a129", "a130", "a131", "a132",
1639 "a133", "a134", "a135", "a136", "a137", "a138", "a139", "a140", "a141",
1640 "a142", "a143", "a144", "a145", "a146", "a147", "a148", "a149", "a150",
1641 "a151", "a152", "a153", "a154", "a155", "a156", "a157", "a158", "a159",
1642 "a160", "a161", "a163", "a164", "a196", "a165", "a192", "a166", "a167",
1643 "a168", "a169", "a170", "a171", "a172", "a173", "a162", "a174", "a175",
1644 "a176", "a177", "a178", "a179", "a193", "a180", "a199", "a181", "a200",
1645 "a182", NULL, "a201", "a183", "a184", "a197", "a185", "a194", "a198",
1646 "a186", "a195", "a187", "a188", "a189", "a190", "a191", NULL};
PDF_CharNameFromPredefinedCharSet(int encoding,uint8_t charcode)1647 const FX_CHAR* PDF_CharNameFromPredefinedCharSet(int encoding,
1648 uint8_t charcode) {
1649 if (encoding == PDFFONT_ENCODING_PDFDOC) {
1650 if (charcode < 24) {
1651 return NULL;
1652 }
1653 charcode -= 24;
1654 } else {
1655 if (charcode < 32) {
1656 return NULL;
1657 }
1658 charcode -= 32;
1659 }
1660 switch (encoding) {
1661 case PDFFONT_ENCODING_WINANSI:
1662 return AdobeWinAnsiEncodingNames[charcode];
1663 case PDFFONT_ENCODING_MACROMAN:
1664 return MacRomanEncodingNames[charcode];
1665 case PDFFONT_ENCODING_MACEXPERT:
1666 return MacExpertEncodingNames[charcode];
1667 case PDFFONT_ENCODING_STANDARD:
1668 return StandardEncodingNames[charcode];
1669 case PDFFONT_ENCODING_ADOBE_SYMBOL:
1670 return AdobeSymbolEncodingNames[charcode];
1671 case PDFFONT_ENCODING_ZAPFDINGBATS:
1672 return ZapfEncodingNames[charcode];
1673 case PDFFONT_ENCODING_PDFDOC:
1674 return PDFDocEncodingNames[charcode];
1675 }
1676 return NULL;
1677 }
FT_UnicodeFromCharCode(int encoding,FX_DWORD charcode)1678 FX_WCHAR FT_UnicodeFromCharCode(int encoding, FX_DWORD charcode) {
1679 switch (encoding) {
1680 case FXFT_ENCODING_UNICODE:
1681 return (FX_WORD)charcode;
1682 case FXFT_ENCODING_ADOBE_STANDARD:
1683 return StandardEncoding[(uint8_t)charcode];
1684 case FXFT_ENCODING_ADOBE_EXPERT:
1685 return MacExpertEncoding[(uint8_t)charcode];
1686 case FXFT_ENCODING_ADOBE_LATIN_1:
1687 return AdobeWinAnsiEncoding[(uint8_t)charcode];
1688 case FXFT_ENCODING_APPLE_ROMAN:
1689 return MacRomanEncoding[(uint8_t)charcode];
1690 case PDFFONT_ENCODING_PDFDOC:
1691 return PDFDocEncoding[(uint8_t)charcode];
1692 }
1693 return 0;
1694 }
PDF_FindCode(const FX_WORD * pCodes,FX_WORD unicode)1695 static FX_DWORD PDF_FindCode(const FX_WORD* pCodes, FX_WORD unicode) {
1696 for (FX_DWORD i = 0; i < 256; i++)
1697 if (pCodes[i] == unicode) {
1698 return i;
1699 }
1700 return 0;
1701 }
1702 static const FX_WORD MSSymbolEncoding[256] = {
1703 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
1704 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
1705 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
1706 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 32, 33, 8704, 35,
1707 8707, 37, 38, 8715, 40, 41, 8727, 43, 44,
1708 8722, 46, 47, 48, 49, 50, 51, 52, 53,
1709 54, 55, 56, 57, 58, 59, 60, 61, 62,
1710 63, 8773, 913, 914, 935, 916, 917, 934, 915,
1711 919, 921, 977, 922, 923, 924, 925, 927, 928,
1712 920, 929, 931, 932, 933, 962, 937, 926, 936,
1713 918, 91, 8756, 93, 8869, 95, 8254, 945, 946,
1714 967, 948, 949, 966, 947, 951, 953, 981, 954,
1715 955, 956, 957, 959, 960, 952, 961, 963, 964,
1716 965, 982, 969, 958, 968, 950, 123, 124, 125,
1717 8764, 0, 0, 0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
1718 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
1719 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
1720 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 978,
1721 8242, 8804, 8725, 8734, 402, 9827, 9830, 9828, 9824,
1722 8596, 8592, 8593, 8594, 8595, 176, 177, 8243, 8805,
1723 215, 8733, 8706, 8729, 247, 8800, 8801, 8776, 8943,
1724 0, 0, 8629, 0, 8465, 8476, 8472, 8855, 8853,
1725 8709, 8745, 8746, 8835, 8839, 8836, 8834, 8838, 8712,
1726 8713, 8736, 8711, 174, 169, 8482, 8719, 8730, 8901,
1727 172, 8743, 8744, 8660, 8656, 8657, 8658, 8659, 9674,
1728 9001, 0, 0, 0, 8721, 0, 0, 0, 0,
1729 0, 0, 0, 0, 0, 0, 0x0000, 9002, 8747,
1730 8992, 0, 8993, 0, 0, 0, 0, 0, 0,
1731 0x0000, 0x0000, 0x0000, 0x0000};
FT_CharCodeFromUnicode(int encoding,FX_WCHAR unicode)1732 FX_DWORD FT_CharCodeFromUnicode(int encoding, FX_WCHAR unicode) {
1733 switch (encoding) {
1734 case FXFT_ENCODING_UNICODE:
1735 return unicode;
1736 case FXFT_ENCODING_ADOBE_STANDARD:
1737 return PDF_FindCode(StandardEncoding, unicode);
1738 case FXFT_ENCODING_ADOBE_EXPERT:
1739 return PDF_FindCode(MacExpertEncoding, unicode);
1740 case FXFT_ENCODING_ADOBE_LATIN_1:
1741 return PDF_FindCode(AdobeWinAnsiEncoding, unicode);
1742 case FXFT_ENCODING_APPLE_ROMAN:
1743 return PDF_FindCode(MacRomanEncoding, unicode);
1744 case FXFT_ENCODING_ADOBE_CUSTOM:
1745 return PDF_FindCode(PDFDocEncoding, unicode);
1746 case FXFT_ENCODING_MS_SYMBOL:
1747 return PDF_FindCode(MSSymbolEncoding, unicode);
1748 }
1749 return 0;
1750 }
PDF_UnicodesForPredefinedCharSet(int encoding)1751 const FX_WORD* PDF_UnicodesForPredefinedCharSet(int encoding) {
1752 switch (encoding) {
1753 case PDFFONT_ENCODING_WINANSI:
1754 return AdobeWinAnsiEncoding;
1755 case PDFFONT_ENCODING_MACROMAN:
1756 return MacRomanEncoding;
1757 case PDFFONT_ENCODING_MACEXPERT:
1758 return MacExpertEncoding;
1759 case PDFFONT_ENCODING_STANDARD:
1760 return StandardEncoding;
1761 case PDFFONT_ENCODING_ADOBE_SYMBOL:
1762 return AdobeSymbolEncoding;
1763 case PDFFONT_ENCODING_ZAPFDINGBATS:
1764 return ZapfEncoding;
1765 case PDFFONT_ENCODING_PDFDOC:
1766 return PDFDocEncoding;
1767 case PDFFONT_ENCODING_MS_SYMBOL:
1768 return MSSymbolEncoding;
1769 }
1770 return NULL;
1771 }
PDF_PredefinedCharCodeFromUnicode(int encoding,FX_WCHAR unicode)1772 FX_DWORD PDF_PredefinedCharCodeFromUnicode(int encoding, FX_WCHAR unicode) {
1773 return PDF_FindCode(PDF_UnicodesForPredefinedCharSet(encoding), unicode);
1774 }
PDF_UnicodeFromAdobeName(const FX_CHAR * name)1775 FX_WCHAR PDF_UnicodeFromAdobeName(const FX_CHAR* name) {
1776 return (FX_WCHAR)(FXFT_unicode_from_adobe_name(name) & 0x7FFFFFFF);
1777 }
PDF_AdobeNameFromUnicode(FX_WCHAR unicode)1778 CFX_ByteString PDF_AdobeNameFromUnicode(FX_WCHAR unicode) {
1779 char glyph_name[64];
1780 FXFT_adobe_name_from_unicode(glyph_name, unicode);
1781 return CFX_ByteString(glyph_name);
1782 }
1783