1 |
769 |
jeremybenn |
/* GlyphNamer.java -- Provides glyph names.
|
2 |
|
|
Copyright (C) 2006 Free Software Foundation, Inc.
|
3 |
|
|
|
4 |
|
|
This file is part of GNU Classpath.
|
5 |
|
|
|
6 |
|
|
GNU Classpath is free software; you can redistribute it and/or modify
|
7 |
|
|
it under the terms of the GNU General Public License as published by
|
8 |
|
|
the Free Software Foundation; either version 2, or (at your option)
|
9 |
|
|
any later version.
|
10 |
|
|
|
11 |
|
|
GNU Classpath is distributed in the hope that it will be useful, but
|
12 |
|
|
WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 |
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
14 |
|
|
General Public License for more details.
|
15 |
|
|
|
16 |
|
|
You should have received a copy of the GNU General Public License
|
17 |
|
|
along with GNU Classpath; see the file COPYING. If not, write to the
|
18 |
|
|
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
19 |
|
|
02110-1301 USA.
|
20 |
|
|
|
21 |
|
|
Linking this library statically or dynamically with other modules is
|
22 |
|
|
making a combined work based on this library. Thus, the terms and
|
23 |
|
|
conditions of the GNU General Public License cover the whole
|
24 |
|
|
combination.
|
25 |
|
|
|
26 |
|
|
As a special exception, the copyright holders of this library give you
|
27 |
|
|
permission to link this library with independent modules to produce an
|
28 |
|
|
executable, regardless of the license terms of these independent
|
29 |
|
|
modules, and to copy and distribute the resulting executable under
|
30 |
|
|
terms of your choice, provided that you also meet, for each linked
|
31 |
|
|
independent module, the terms and conditions of the license of that
|
32 |
|
|
module. An independent module is a module which is not derived from
|
33 |
|
|
or based on this library. If you modify this library, you may extend
|
34 |
|
|
this exception to your version of the library, but you are not
|
35 |
|
|
obligated to do so. If you do not wish to do so, delete this
|
36 |
|
|
exception statement from your version. */
|
37 |
|
|
|
38 |
|
|
package gnu.java.awt.font.opentype;
|
39 |
|
|
|
40 |
|
|
import gnu.java.lang.CPStringBuilder;
|
41 |
|
|
|
42 |
|
|
import java.nio.ByteBuffer;
|
43 |
|
|
import java.nio.IntBuffer;
|
44 |
|
|
import java.nio.CharBuffer;
|
45 |
|
|
|
46 |
|
|
|
47 |
|
|
/**
|
48 |
|
|
* Provides names for glyphs, which is useful when embedding fonts
|
49 |
|
|
* in PostScript or PDF documents.
|
50 |
|
|
*
|
51 |
|
|
* <p>If the font has a <code>Zapf</code> table, it is used to map
|
52 |
|
|
* glyph IDs back to a sequence of Unicode codepoints, which then
|
53 |
|
|
* makes it possible to look up or synthesize a PostScript glyph name
|
54 |
|
|
* according to Adobe’s conventions. This allows to extract the
|
55 |
|
|
* original text from the generated PDF or PostScript file, which is
|
56 |
|
|
* important for indexing, searching and extracting.
|
57 |
|
|
*
|
58 |
|
|
* <p>Otherwise, glyph names are taken from the <a href=
|
59 |
|
|
* "http://developer.apple.com/fonts/TTRefMan/RM06/Chap6post.html"
|
60 |
|
|
* ><code>post</code> table</a>. All known formats (1, 2, 2.5, 3 and
|
61 |
|
|
* 4) are supported.
|
62 |
|
|
*
|
63 |
|
|
* <p><b>Open Tasks:</b> The code could be cleaner structured by
|
64 |
|
|
* having separate sub-classes for each variant of the POST table.
|
65 |
|
|
* Also, the implementation should not read in all glyph names if a
|
66 |
|
|
* font provides them in a POST table of type 2. It would be
|
67 |
|
|
* sufficient to just read in the offsets and delay the String
|
68 |
|
|
* fetching and conversion to the time when the glyph name is actually
|
69 |
|
|
* requested.
|
70 |
|
|
*
|
71 |
|
|
* <p><b>Lack of Thread Safety:</b> The GlyphNamer class is
|
72 |
|
|
* intentionally <i>not</i> safe to access from multiple concurrent
|
73 |
|
|
* threads. Synchronization needs to be performed externally. Usually,
|
74 |
|
|
* the font has already obtained a lock before calling the GlyphNamer.
|
75 |
|
|
* It would thus be wasteful to acquire additional locks for the
|
76 |
|
|
* GlyphNamer.
|
77 |
|
|
*
|
78 |
|
|
* @author Sascha Brawer (brawer@dandelis.ch)
|
79 |
|
|
*/
|
80 |
|
|
final class GlyphNamer
|
81 |
|
|
{
|
82 |
|
|
/**
|
83 |
|
|
* The 'post' table of the font.
|
84 |
|
|
*/
|
85 |
|
|
private ByteBuffer postTable;
|
86 |
|
|
|
87 |
|
|
|
88 |
|
|
/**
|
89 |
|
|
* The 'Zapf' table of the font, or null if the font has no
|
90 |
|
|
* such table.
|
91 |
|
|
*/
|
92 |
|
|
private ByteBuffer zapfTable;
|
93 |
|
|
|
94 |
|
|
|
95 |
|
|
/**
|
96 |
|
|
* The offset of each glyph relative to the Zapf table,
|
97 |
|
|
* or null if the font does not have a Zapf table.
|
98 |
|
|
*/
|
99 |
|
|
private IntBuffer zapfOffsets;
|
100 |
|
|
|
101 |
|
|
|
102 |
|
|
/**
|
103 |
|
|
* The offset from the start of the Zapf table to the start
|
104 |
|
|
* of the extra info area.
|
105 |
|
|
*/
|
106 |
|
|
private int zapfExtraInfo;
|
107 |
|
|
|
108 |
|
|
|
109 |
|
|
/**
|
110 |
|
|
* The format of the post table, a Fixed 16.16 number.
|
111 |
|
|
*/
|
112 |
|
|
private int postFormat;
|
113 |
|
|
|
114 |
|
|
|
115 |
|
|
/**
|
116 |
|
|
* An array of glyph names. Used for table formats 1, 2, 2.5.
|
117 |
|
|
*/
|
118 |
|
|
private String[] glyphNames;
|
119 |
|
|
|
120 |
|
|
|
121 |
|
|
/**
|
122 |
|
|
* An array from glyph to character codes. Similar to the
|
123 |
|
|
* workings of a Zapf table, but maps to CID instead of
|
124 |
|
|
* Unicode. Used for table format 4.
|
125 |
|
|
*/
|
126 |
|
|
private CharBuffer glyphCharacterCodes;
|
127 |
|
|
|
128 |
|
|
|
129 |
|
|
/**
|
130 |
|
|
* The PostScript names of the 258 standard Macintosh glyphs. Note
|
131 |
|
|
* that some of these glyphs are not in the Adobe Standard Glyph
|
132 |
|
|
* List for New Fonts, namely .notdef, .null, nonmarkingreturn,
|
133 |
|
|
* nonbreakingspace, apple, onesuperior, twosuperior, and
|
134 |
|
|
* threesuperior.
|
135 |
|
|
*/
|
136 |
|
|
private static final String[] STANDARD_POSTSCRIPT_GLYPH_NAMES =
|
137 |
|
|
{
|
138 |
|
|
".notdef", // glyph #0
|
139 |
|
|
".null", // glyph #1
|
140 |
|
|
"nonmarkingreturn", // glyph #2
|
141 |
|
|
"space", // glyph #3
|
142 |
|
|
"exclam", // glyph #4
|
143 |
|
|
"quotedbl", // glyph #5
|
144 |
|
|
"numbersign", // glyph #6
|
145 |
|
|
"dollar", // glyph #7
|
146 |
|
|
"percent", // glyph #8
|
147 |
|
|
"ampersand", // glyph #9
|
148 |
|
|
"quotesingle", // glyph #10
|
149 |
|
|
"parenleft", // glyph #11
|
150 |
|
|
"parenright", // glyph #12
|
151 |
|
|
"asterisk", // glyph #13
|
152 |
|
|
"plus", // glyph #14
|
153 |
|
|
"comma", // glyph #15
|
154 |
|
|
"hyphen", // glyph #16
|
155 |
|
|
"period", // glyph #17
|
156 |
|
|
"slash", // glyph #18
|
157 |
|
|
"zero", // glyph #19
|
158 |
|
|
"one", // glyph #20
|
159 |
|
|
"two", // glyph #21
|
160 |
|
|
"three", // glyph #22
|
161 |
|
|
"four", // glyph #23
|
162 |
|
|
"five", // glyph #24
|
163 |
|
|
"six", // glyph #25
|
164 |
|
|
"seven", // glyph #26
|
165 |
|
|
"eight", // glyph #27
|
166 |
|
|
"nine", // glyph #28
|
167 |
|
|
"colon", // glyph #29
|
168 |
|
|
"semicolon", // glyph #30
|
169 |
|
|
"less", // glyph #31
|
170 |
|
|
"equal", // glyph #32
|
171 |
|
|
"greater", // glyph #33
|
172 |
|
|
"question", // glyph #34
|
173 |
|
|
"at", // glyph #35
|
174 |
|
|
"A", // glyph #36
|
175 |
|
|
"B", // glyph #37
|
176 |
|
|
"C", // glyph #38
|
177 |
|
|
"D", // glyph #39
|
178 |
|
|
"E", // glyph #40
|
179 |
|
|
"F", // glyph #41
|
180 |
|
|
"G", // glyph #42
|
181 |
|
|
"H", // glyph #43
|
182 |
|
|
"I", // glyph #44
|
183 |
|
|
"J", // glyph #45
|
184 |
|
|
"K", // glyph #46
|
185 |
|
|
"L", // glyph #47
|
186 |
|
|
"M", // glyph #48
|
187 |
|
|
"N", // glyph #49
|
188 |
|
|
"O", // glyph #50
|
189 |
|
|
"P", // glyph #51
|
190 |
|
|
"Q", // glyph #52
|
191 |
|
|
"R", // glyph #53
|
192 |
|
|
"S", // glyph #54
|
193 |
|
|
"T", // glyph #55
|
194 |
|
|
"U", // glyph #56
|
195 |
|
|
"V", // glyph #57
|
196 |
|
|
"W", // glyph #58
|
197 |
|
|
"X", // glyph #59
|
198 |
|
|
"Y", // glyph #60
|
199 |
|
|
"Z", // glyph #61
|
200 |
|
|
"bracketleft", // glyph #62
|
201 |
|
|
"backslash", // glyph #63
|
202 |
|
|
"bracketright", // glyph #64
|
203 |
|
|
"asciicircum", // glyph #65
|
204 |
|
|
"underscore", // glyph #66
|
205 |
|
|
"grave", // glyph #67
|
206 |
|
|
"a", // glyph #68
|
207 |
|
|
"b", // glyph #69
|
208 |
|
|
"c", // glyph #70
|
209 |
|
|
"d", // glyph #71
|
210 |
|
|
"e", // glyph #72
|
211 |
|
|
"f", // glyph #73
|
212 |
|
|
"g", // glyph #74
|
213 |
|
|
"h", // glyph #75
|
214 |
|
|
"i", // glyph #76
|
215 |
|
|
"j", // glyph #77
|
216 |
|
|
"k", // glyph #78
|
217 |
|
|
"l", // glyph #79
|
218 |
|
|
"m", // glyph #80
|
219 |
|
|
"n", // glyph #81
|
220 |
|
|
"o", // glyph #82
|
221 |
|
|
"p", // glyph #83
|
222 |
|
|
"q", // glyph #84
|
223 |
|
|
"r", // glyph #85
|
224 |
|
|
"s", // glyph #86
|
225 |
|
|
"t", // glyph #87
|
226 |
|
|
"u", // glyph #88
|
227 |
|
|
"v", // glyph #89
|
228 |
|
|
"w", // glyph #90
|
229 |
|
|
"x", // glyph #91
|
230 |
|
|
"y", // glyph #92
|
231 |
|
|
"z", // glyph #93
|
232 |
|
|
"braceleft", // glyph #94
|
233 |
|
|
"bar", // glyph #95
|
234 |
|
|
"braceright", // glyph #96
|
235 |
|
|
"asciitilde", // glyph #97
|
236 |
|
|
"Adieresis", // glyph #98
|
237 |
|
|
"Aring", // glyph #99
|
238 |
|
|
"Ccedilla", // glyph #100
|
239 |
|
|
"Eacute", // glyph #101
|
240 |
|
|
"Ntilde", // glyph #102
|
241 |
|
|
"Odieresis", // glyph #103
|
242 |
|
|
"Udieresis", // glyph #104
|
243 |
|
|
"aacute", // glyph #105
|
244 |
|
|
"agrave", // glyph #106
|
245 |
|
|
"acircumflex", // glyph #107
|
246 |
|
|
"adieresis", // glyph #108
|
247 |
|
|
"atilde", // glyph #109
|
248 |
|
|
"aring", // glyph #110
|
249 |
|
|
"ccedilla", // glyph #111
|
250 |
|
|
"eacute", // glyph #112
|
251 |
|
|
"egrave", // glyph #113
|
252 |
|
|
"ecircumflex", // glyph #114
|
253 |
|
|
"edieresis", // glyph #115
|
254 |
|
|
"iacute", // glyph #116
|
255 |
|
|
"igrave", // glyph #117
|
256 |
|
|
"icircumflex", // glyph #118
|
257 |
|
|
"idieresis", // glyph #119
|
258 |
|
|
"ntilde", // glyph #120
|
259 |
|
|
"oacute", // glyph #121
|
260 |
|
|
"ograve", // glyph #122
|
261 |
|
|
"ocircumflex", // glyph #123
|
262 |
|
|
"odieresis", // glyph #124
|
263 |
|
|
"otilde", // glyph #125
|
264 |
|
|
"uacute", // glyph #126
|
265 |
|
|
"ugrave", // glyph #127
|
266 |
|
|
"ucircumflex", // glyph #128
|
267 |
|
|
"udieresis", // glyph #129
|
268 |
|
|
"dagger", // glyph #130
|
269 |
|
|
"degree", // glyph #131
|
270 |
|
|
"cent", // glyph #132
|
271 |
|
|
"sterling", // glyph #133
|
272 |
|
|
"section", // glyph #134
|
273 |
|
|
"bullet", // glyph #135
|
274 |
|
|
"paragraph", // glyph #136
|
275 |
|
|
"germandbls", // glyph #137
|
276 |
|
|
"registered", // glyph #138
|
277 |
|
|
"copyright", // glyph #139
|
278 |
|
|
"trademark", // glyph #140
|
279 |
|
|
"acute", // glyph #141
|
280 |
|
|
"dieresis", // glyph #142
|
281 |
|
|
"notequal", // glyph #143
|
282 |
|
|
"AE", // glyph #144
|
283 |
|
|
"Oslash", // glyph #145
|
284 |
|
|
"infinity", // glyph #146
|
285 |
|
|
"plusminus", // glyph #147
|
286 |
|
|
"lessequal", // glyph #148
|
287 |
|
|
"greaterequal", // glyph #149
|
288 |
|
|
"yen", // glyph #150
|
289 |
|
|
"mu", // glyph #151
|
290 |
|
|
"partialdiff", // glyph #152
|
291 |
|
|
"summation", // glyph #153
|
292 |
|
|
"product", // glyph #154
|
293 |
|
|
"pi", // glyph #155
|
294 |
|
|
"integral", // glyph #156
|
295 |
|
|
"ordfeminine", // glyph #157
|
296 |
|
|
"ordmasculine", // glyph #158
|
297 |
|
|
"Omega", // glyph #159
|
298 |
|
|
"ae", // glyph #160
|
299 |
|
|
"oslash", // glyph #161
|
300 |
|
|
"questiondown", // glyph #162
|
301 |
|
|
"exclamdown", // glyph #163
|
302 |
|
|
"logicalnot", // glyph #164
|
303 |
|
|
"radical", // glyph #165
|
304 |
|
|
"florin", // glyph #166
|
305 |
|
|
"approxequal", // glyph #167
|
306 |
|
|
"Delta", // glyph #168
|
307 |
|
|
"guillemotleft", // glyph #169
|
308 |
|
|
"guillemotright", // glyph #170
|
309 |
|
|
"ellipsis", // glyph #171
|
310 |
|
|
"nonbreakingspace", // glyph #172
|
311 |
|
|
"Agrave", // glyph #173
|
312 |
|
|
"Atilde", // glyph #174
|
313 |
|
|
"Otilde", // glyph #175
|
314 |
|
|
"OE", // glyph #176
|
315 |
|
|
"oe", // glyph #177
|
316 |
|
|
"endash", // glyph #178
|
317 |
|
|
"emdash", // glyph #179
|
318 |
|
|
"quotedblleft", // glyph #180
|
319 |
|
|
"quotedblright", // glyph #181
|
320 |
|
|
"quoteleft", // glyph #182
|
321 |
|
|
"quoteright", // glyph #183
|
322 |
|
|
"divide", // glyph #184
|
323 |
|
|
"lozenge", // glyph #185
|
324 |
|
|
"ydieresis", // glyph #186
|
325 |
|
|
"Ydieresis", // glyph #187
|
326 |
|
|
"fraction", // glyph #188
|
327 |
|
|
"currency", // glyph #189
|
328 |
|
|
"guilsinglleft", // glyph #190
|
329 |
|
|
"guilsinglright", // glyph #191
|
330 |
|
|
"fi", // glyph #192
|
331 |
|
|
"fl", // glyph #193
|
332 |
|
|
"daggerdbl", // glyph #194
|
333 |
|
|
"periodcentered", // glyph #195
|
334 |
|
|
"quotesinglbase", // glyph #196
|
335 |
|
|
"quotedblbase", // glyph #197
|
336 |
|
|
"perthousand", // glyph #198
|
337 |
|
|
"Acircumflex", // glyph #199
|
338 |
|
|
"Ecircumflex", // glyph #200
|
339 |
|
|
"Aacute", // glyph #201
|
340 |
|
|
"Edieresis", // glyph #202
|
341 |
|
|
"Egrave", // glyph #203
|
342 |
|
|
"Iacute", // glyph #204
|
343 |
|
|
"Icircumflex", // glyph #205
|
344 |
|
|
"Idieresis", // glyph #206
|
345 |
|
|
"Igrave", // glyph #207
|
346 |
|
|
"Oacute", // glyph #208
|
347 |
|
|
"Ocircumflex", // glyph #209
|
348 |
|
|
"apple", // glyph #210
|
349 |
|
|
"Ograve", // glyph #211
|
350 |
|
|
"Uacute", // glyph #212
|
351 |
|
|
"Ucircumflex", // glyph #213
|
352 |
|
|
"Ugrave", // glyph #214
|
353 |
|
|
"dotlessi", // glyph #215
|
354 |
|
|
"circumflex", // glyph #216
|
355 |
|
|
"tilde", // glyph #217
|
356 |
|
|
"macron", // glyph #218
|
357 |
|
|
"breve", // glyph #219
|
358 |
|
|
"dotaccent", // glyph #220
|
359 |
|
|
"ring", // glyph #221
|
360 |
|
|
"cedilla", // glyph #222
|
361 |
|
|
"hungarumlaut", // glyph #223
|
362 |
|
|
"ogonek", // glyph #224
|
363 |
|
|
"caron", // glyph #225
|
364 |
|
|
"Lslash", // glyph #226
|
365 |
|
|
"lslash", // glyph #227
|
366 |
|
|
"Scaron", // glyph #228
|
367 |
|
|
"scaron", // glyph #229
|
368 |
|
|
"Zcaron", // glyph #230
|
369 |
|
|
"zcaron", // glyph #231
|
370 |
|
|
"brokenbar", // glyph #232
|
371 |
|
|
"Eth", // glyph #233
|
372 |
|
|
"eth", // glyph #234
|
373 |
|
|
"Yacute", // glyph #235
|
374 |
|
|
"yacute", // glyph #236
|
375 |
|
|
"Thorn", // glyph #237
|
376 |
|
|
"thorn", // glyph #238
|
377 |
|
|
"minus", // glyph #239
|
378 |
|
|
"multiply", // glyph #240
|
379 |
|
|
"onesuperior", // glyph #241
|
380 |
|
|
"twosuperior", // glyph #242
|
381 |
|
|
"threesuperior", // glyph #243
|
382 |
|
|
"onehalf", // glyph #244
|
383 |
|
|
"onequarter", // glyph #245
|
384 |
|
|
"threequarters", // glyph #246
|
385 |
|
|
"franc", // glyph #247
|
386 |
|
|
"Gbreve", // glyph #248
|
387 |
|
|
"gbreve", // glyph #249
|
388 |
|
|
"Idotaccent", // glyph #250
|
389 |
|
|
"Scedilla", // glyph #251
|
390 |
|
|
"scedilla", // glyph #252
|
391 |
|
|
"Cacute", // glyph #253
|
392 |
|
|
"cacute", // glyph #254
|
393 |
|
|
"Ccaron", // glyph #255
|
394 |
|
|
"ccaron", // glyph #256
|
395 |
|
|
"dcroat" // glyph #257
|
396 |
|
|
};
|
397 |
|
|
|
398 |
|
|
|
399 |
|
|
private GlyphNamer(int numGlyphs,
|
400 |
|
|
ByteBuffer postTable,
|
401 |
|
|
ByteBuffer zapfTable)
|
402 |
|
|
{
|
403 |
|
|
this.postTable = postTable;
|
404 |
|
|
this.zapfTable = zapfTable;
|
405 |
|
|
|
406 |
|
|
if ((zapfTable != null) && (zapfTable.getInt(0) == 0x00010000))
|
407 |
|
|
{
|
408 |
|
|
readZapf(numGlyphs);
|
409 |
|
|
return;
|
410 |
|
|
}
|
411 |
|
|
|
412 |
|
|
readPost();
|
413 |
|
|
}
|
414 |
|
|
|
415 |
|
|
|
416 |
|
|
/**
|
417 |
|
|
* Sets up the information which allows to retrieve the information
|
418 |
|
|
* on demand.
|
419 |
|
|
*
|
420 |
|
|
* @param numGlyphs the number of glyphs in the font. This value
|
421 |
|
|
* comes from the <code>maxp</code> table.
|
422 |
|
|
*/
|
423 |
|
|
public static GlyphNamer forTables(int numGlyphs,
|
424 |
|
|
ByteBuffer postTable,
|
425 |
|
|
ByteBuffer zapfTable)
|
426 |
|
|
{
|
427 |
|
|
return new GlyphNamer(numGlyphs, postTable, zapfTable);
|
428 |
|
|
}
|
429 |
|
|
|
430 |
|
|
|
431 |
|
|
/**
|
432 |
|
|
* Retrieves or synthesizes a PostScript name for the glyph.
|
433 |
|
|
* Although the code is reasonably fast, it is recommended
|
434 |
|
|
* to cache the results in the printer driver.
|
435 |
|
|
*
|
436 |
|
|
* <p>If a font provides a 'Zapf' table, the reverse mapping
|
437 |
|
|
* from glyph to UTF-16 sequence is performed, and a glyph
|
438 |
|
|
* name is synthesized following the recommendations by Adobe.
|
439 |
|
|
* This allows to extract the original text from the generated
|
440 |
|
|
* PostScript or PDF, which is a requirement for indexing
|
441 |
|
|
* and searching.
|
442 |
|
|
*
|
443 |
|
|
* <p>If a font does not provide a 'Zapf' table, the glyph name
|
444 |
|
|
* is taken from the 'post' table. Note that some fonts have
|
445 |
|
|
* wrong data in their post data, in which case the resulting
|
446 |
|
|
* name will be garbage. Usually, this does not hurt, unless
|
447 |
|
|
* the user wants to extract text from the generated PostScript
|
448 |
|
|
* or PDF file. The GNU implementation understands all known
|
449 |
|
|
* formats of the post table (1, 2, 2.5, 3 and 4).
|
450 |
|
|
*
|
451 |
|
|
* @param glyph the index of the glyph whose name is to be
|
452 |
|
|
* retrieved.
|
453 |
|
|
*
|
454 |
|
|
* @return the glyph name, such as <code>A</code>,
|
455 |
|
|
* <code>gcircumflex</code>, <code>z_uni0302</code>, or
|
456 |
|
|
* <code>u11C42</code>.</li>
|
457 |
|
|
*/
|
458 |
|
|
String getGlyphName(int glyph)
|
459 |
|
|
{
|
460 |
|
|
if (zapfOffsets != null)
|
461 |
|
|
{
|
462 |
|
|
zapfTable.position(zapfOffsets.get(glyph) + 8);
|
463 |
|
|
int numChars = zapfTable.getChar();
|
464 |
|
|
char[] chars = new char[numChars];
|
465 |
|
|
for (int i = 0; i < numChars; i++)
|
466 |
|
|
chars[i] = zapfTable.getChar();
|
467 |
|
|
return getGlyphName(chars);
|
468 |
|
|
}
|
469 |
|
|
|
470 |
|
|
|
471 |
|
|
/* Type 1, Type 2, Type 2.5 */
|
472 |
|
|
if (glyphNames != null)
|
473 |
|
|
return glyphNames[glyph];
|
474 |
|
|
|
475 |
|
|
/* Type 4: Synthesized glyph name. */
|
476 |
|
|
if (glyphCharacterCodes != null)
|
477 |
|
|
return "a" + glyphCharacterCodes.get(glyph);
|
478 |
|
|
|
479 |
|
|
/* Type 3: Arbitrary, but unique name for the glyph.
|
480 |
|
|
*
|
481 |
|
|
* To find out what a good naming scheme would be, we have printed
|
482 |
|
|
* a document containing the character U+201C in the font
|
483 |
|
|
* "Hiragino Kaku Gothic Pro W3" (by Dainippon Screen Mfg. Co.,
|
484 |
|
|
* Ltd.) on Apple MacOS X 10.1.5. This font has a type 3 'post'
|
485 |
|
|
* table, and its 'cmap' maps U+201C to glyph #108. The generated
|
486 |
|
|
* PostScript file defined a character whose name was "g108".
|
487 |
|
|
*
|
488 |
|
|
* Therefore, we use 'g' as name prefix. According to the
|
489 |
|
|
* TrueType/OpenType specification, it should not matter what
|
490 |
|
|
* prefix we use. On the other hand, it does not hurt either to be
|
491 |
|
|
* compatible with a good printer driver.
|
492 |
|
|
*
|
493 |
|
|
* Actually, that specific font also contains a 'Zapf' table,
|
494 |
|
|
* which allows to generate glyph names according to Adobe's
|
495 |
|
|
* conventions, so that extracting text from and searching in the
|
496 |
|
|
* generated PostScript or PDF becomes possible. While the Apple
|
497 |
|
|
* PostScript printer driver does not seem to use the 'Zapf' table
|
498 |
|
|
* for this purpose, we do.
|
499 |
|
|
*/
|
500 |
|
|
return "g" + glyph;
|
501 |
|
|
}
|
502 |
|
|
|
503 |
|
|
|
504 |
|
|
/**
|
505 |
|
|
* Sets up some buffers which allow to quickly read information from
|
506 |
|
|
* the Zapf table.
|
507 |
|
|
*
|
508 |
|
|
* @see <a href=
|
509 |
|
|
* "http://developer.apple.com/fonts/TTRefMan/RM06/Chap6Zapf.html">
|
510 |
|
|
* Apple’s documentation of the <code>Zapf</code> table</a>
|
511 |
|
|
*/
|
512 |
|
|
private void readZapf(int numGlyphs)
|
513 |
|
|
{
|
514 |
|
|
zapfExtraInfo = zapfTable.getInt(4);
|
515 |
|
|
zapfTable.position(8);
|
516 |
|
|
zapfOffsets = zapfTable.asIntBuffer();
|
517 |
|
|
zapfOffsets.limit(numGlyphs);
|
518 |
|
|
}
|
519 |
|
|
|
520 |
|
|
|
521 |
|
|
/**
|
522 |
|
|
* Reads in the PostScript data from a <code>post</code> table of a
|
523 |
|
|
* TrueType or OpenType font. The implementation currently
|
524 |
|
|
* understands the table formats 1, 2, 2.5, 3, and 4.
|
525 |
|
|
*/
|
526 |
|
|
private void readPost()
|
527 |
|
|
{
|
528 |
|
|
int numGlyphs, nameIndex, maxNameIndex;
|
529 |
|
|
char[] nameIndices;
|
530 |
|
|
String[] names;
|
531 |
|
|
byte[] pascalName;
|
532 |
|
|
|
533 |
|
|
postTable.position(0);
|
534 |
|
|
postFormat = postTable.getInt();
|
535 |
|
|
switch (postFormat)
|
536 |
|
|
{
|
537 |
|
|
case 0x00010000:
|
538 |
|
|
glyphNames = STANDARD_POSTSCRIPT_GLYPH_NAMES;
|
539 |
|
|
return;
|
540 |
|
|
|
541 |
|
|
case 0x00020000:
|
542 |
|
|
postTable.position(32);
|
543 |
|
|
numGlyphs = postTable.getChar();
|
544 |
|
|
glyphNames = new String[numGlyphs];
|
545 |
|
|
pascalName = new byte[255];
|
546 |
|
|
nameIndices = new char[numGlyphs];
|
547 |
|
|
maxNameIndex = 0;
|
548 |
|
|
for (int i = 0; i < numGlyphs; i++)
|
549 |
|
|
maxNameIndex = Math.max(maxNameIndex,
|
550 |
|
|
nameIndices[i] = postTable.getChar());
|
551 |
|
|
|
552 |
|
|
names = new String[Math.max(maxNameIndex - 258 + 1, 0)];
|
553 |
|
|
for (int i = 258; i <= maxNameIndex; i++)
|
554 |
|
|
{
|
555 |
|
|
int nameLen = (postTable.get() & 0xff);
|
556 |
|
|
postTable.get(pascalName, 0, nameLen);
|
557 |
|
|
names[i - 258] = new String(pascalName, 0, nameLen);
|
558 |
|
|
}
|
559 |
|
|
for (int i = 0; i < numGlyphs; i++)
|
560 |
|
|
{
|
561 |
|
|
nameIndex = nameIndices[i];
|
562 |
|
|
if (nameIndex < 258)
|
563 |
|
|
glyphNames[i] = STANDARD_POSTSCRIPT_GLYPH_NAMES[nameIndex];
|
564 |
|
|
else
|
565 |
|
|
glyphNames[i] = names[nameIndex - 258];
|
566 |
|
|
}
|
567 |
|
|
return;
|
568 |
|
|
|
569 |
|
|
case 0x00025000: // in case some font has a wrong representation of 2.5
|
570 |
|
|
case 0x00028000:
|
571 |
|
|
/* Format 2.5 is a re-ordering of the standard names. It has
|
572 |
|
|
* been deprecated in February 2000, but might still occasionally
|
573 |
|
|
* float around. Since it can be supported with so little code,
|
574 |
|
|
* we do so.
|
575 |
|
|
*/
|
576 |
|
|
postTable.position(32);
|
577 |
|
|
numGlyphs = postTable.getChar();
|
578 |
|
|
glyphNames = new String[numGlyphs];
|
579 |
|
|
for (int i = 0; i < numGlyphs; i++)
|
580 |
|
|
glyphNames[i] = STANDARD_POSTSCRIPT_GLYPH_NAMES[i + postTable.get()];
|
581 |
|
|
return;
|
582 |
|
|
|
583 |
|
|
case 0x00030000:
|
584 |
|
|
/* Format 3 leaves it to the printer driver to choose whatever
|
585 |
|
|
* name it wants to.
|
586 |
|
|
*/
|
587 |
|
|
return;
|
588 |
|
|
|
589 |
|
|
case 0x00040000:
|
590 |
|
|
/* Format 4 is used by Apple for composite fonts that have
|
591 |
|
|
* synthetic glyph names. The name of a glyph is "a" plus
|
592 |
|
|
* the integer (in decimal notation) that follows the table
|
593 |
|
|
* after numGlyphs.
|
594 |
|
|
*/
|
595 |
|
|
postTable.position(32);
|
596 |
|
|
numGlyphs = postTable.getChar();
|
597 |
|
|
glyphCharacterCodes = postTable.asCharBuffer();
|
598 |
|
|
glyphCharacterCodes.limit(numGlyphs);
|
599 |
|
|
return;
|
600 |
|
|
}
|
601 |
|
|
}
|
602 |
|
|
|
603 |
|
|
|
604 |
|
|
|
605 |
|
|
/* For generating the following tables, a quick-and-dirty Python
|
606 |
|
|
* script was used. It is unlikely that we ever need to run it
|
607 |
|
|
* again, but for information and convenient access, it is included
|
608 |
|
|
* below. Initial '#' characters need to be removed from the generated
|
609 |
|
|
* strings, they are present so that the lines not break in the middle
|
610 |
|
|
* of Java escape sequences (no, this is not very clean).
|
611 |
|
|
*
|
612 |
|
|
* import string
|
613 |
|
|
*
|
614 |
|
|
* javaEscapes = {0x22:'\\"', 0x5c:'\\\\'}
|
615 |
|
|
* def escape(c):
|
616 |
|
|
* if javaEscapes.has_key(c):
|
617 |
|
|
* return javaEscapes[c]
|
618 |
|
|
* elif 0x20 <= c <= 0x7e:
|
619 |
|
|
* return chr(c)
|
620 |
|
|
* else:
|
621 |
|
|
* return '\\u%04x' % c
|
622 |
|
|
*
|
623 |
|
|
* def dump(name, s, stride):
|
624 |
|
|
* s = ('#' * stride) + s
|
625 |
|
|
* print " private static final String %s" % name
|
626 |
|
|
* for i in range(0, len(s), 60):
|
627 |
|
|
* print ' + "%s"' % s[i:i+60]
|
628 |
|
|
*
|
629 |
|
|
* glyphs = {}
|
630 |
|
|
* for line in open('aglfn13.txt', 'r').readlines():
|
631 |
|
|
* if line[0] == '#': continue
|
632 |
|
|
* [ucs, glyphName, desc] = line.split(';')
|
633 |
|
|
* glyph = int('0x' + ucs, 0)
|
634 |
|
|
* assert (not glyphs.has_key(glyph)) or (glyphs[glyph] == glyphName)
|
635 |
|
|
* glyphs[glyph] = glyphName
|
636 |
|
|
* del glyphs[0] # arrowvertex
|
637 |
|
|
* k = glyphs.keys()
|
638 |
|
|
* k.sort()
|
639 |
|
|
* numGlyphs = len(k)
|
640 |
|
|
* names = ''
|
641 |
|
|
* pos = []
|
642 |
|
|
* for glyph in k:
|
643 |
|
|
* pos.append(len(names) + 1)
|
644 |
|
|
* names = names + '/' + glyphs[glyph]
|
645 |
|
|
* dump('AGLFN_GLYPHS', string.join(map(escape, k), ''), 5)
|
646 |
|
|
* dump('AGLFN_NAME_OFFSET', string.join(map(escape, pos), ''), 4)
|
647 |
|
|
* dump('AGLFN_NAMES', names + '/', 0)
|
648 |
|
|
*/
|
649 |
|
|
|
650 |
|
|
|
651 |
|
|
/**
|
652 |
|
|
* A String that contains the Unicode codepoint for each glyph
|
653 |
|
|
* in the Adobe Glyph List. The characters are in sorted order.
|
654 |
|
|
*
|
655 |
|
|
* Generated from the Adobe Glyph List for New Fonts, version 1.1
|
656 |
|
|
* of 17 April 2003.
|
657 |
|
|
*
|
658 |
|
|
* @see <a href=
|
659 |
|
|
* "http://partners.adobe.com/asn/tech/type/aglfn13.txt" >Adobe
|
660 |
|
|
* Glyph List for New Fonts</a>
|
661 |
|
|
*/
|
662 |
|
|
private static final String AGLFN_GLYPHS
|
663 |
|
|
= " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTU"
|
664 |
|
|
+ "VWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u00a1\u00a2\u00a3"
|
665 |
|
|
+ "\u00a4\u00a5\u00a6\u00a7\u00a8\u00a9\u00aa\u00ab\u00ac\u00ae"
|
666 |
|
|
+ "\u00af\u00b0\u00b1\u00b4\u00b5\u00b6\u00b7\u00b8\u00ba\u00bb"
|
667 |
|
|
+ "\u00bc\u00bd\u00be\u00bf\u00c0\u00c1\u00c2\u00c3\u00c4\u00c5"
|
668 |
|
|
+ "\u00c6\u00c7\u00c8\u00c9\u00ca\u00cb\u00cc\u00cd\u00ce\u00cf"
|
669 |
|
|
+ "\u00d0\u00d1\u00d2\u00d3\u00d4\u00d5\u00d6\u00d7\u00d8\u00d9"
|
670 |
|
|
+ "\u00da\u00db\u00dc\u00dd\u00de\u00df\u00e0\u00e1\u00e2\u00e3"
|
671 |
|
|
+ "\u00e4\u00e5\u00e6\u00e7\u00e8\u00e9\u00ea\u00eb\u00ec\u00ed"
|
672 |
|
|
+ "\u00ee\u00ef\u00f0\u00f1\u00f2\u00f3\u00f4\u00f5\u00f6\u00f7"
|
673 |
|
|
+ "\u00f8\u00f9\u00fa\u00fb\u00fc\u00fd\u00fe\u00ff\u0100\u0101"
|
674 |
|
|
+ "\u0102\u0103\u0104\u0105\u0106\u0107\u0108\u0109\u010a\u010b"
|
675 |
|
|
+ "\u010c\u010d\u010e\u010f\u0110\u0111\u0112\u0113\u0114\u0115"
|
676 |
|
|
+ "\u0116\u0117\u0118\u0119\u011a\u011b\u011c\u011d\u011e\u011f"
|
677 |
|
|
+ "\u0120\u0121\u0122\u0123\u0124\u0125\u0126\u0127\u0128\u0129"
|
678 |
|
|
+ "\u012a\u012b\u012c\u012d\u012e\u012f\u0130\u0131\u0132\u0133"
|
679 |
|
|
+ "\u0134\u0135\u0136\u0137\u0138\u0139\u013a\u013b\u013c\u013d"
|
680 |
|
|
+ "\u013e\u013f\u0140\u0141\u0142\u0143\u0144\u0145\u0146\u0147"
|
681 |
|
|
+ "\u0148\u0149\u014a\u014b\u014c\u014d\u014e\u014f\u0150\u0151"
|
682 |
|
|
+ "\u0152\u0153\u0154\u0155\u0156\u0157\u0158\u0159\u015a\u015b"
|
683 |
|
|
+ "\u015c\u015d\u015e\u015f\u0160\u0161\u0162\u0163\u0164\u0165"
|
684 |
|
|
+ "\u0166\u0167\u0168\u0169\u016a\u016b\u016c\u016d\u016e\u016f"
|
685 |
|
|
+ "\u0170\u0171\u0172\u0173\u0174\u0175\u0176\u0177\u0178\u0179"
|
686 |
|
|
+ "\u017a\u017b\u017c\u017d\u017e\u017f\u0192\u01a0\u01a1\u01af"
|
687 |
|
|
+ "\u01b0\u01e6\u01e7\u01fa\u01fb\u01fc\u01fd\u01fe\u01ff\u0218"
|
688 |
|
|
+ "\u0219\u02bc\u02bd\u02c6\u02c7\u02d8\u02d9\u02da\u02db\u02dc"
|
689 |
|
|
+ "\u02dd\u0300\u0301\u0303\u0309\u0323\u0384\u0385\u0386\u0387"
|
690 |
|
|
+ "\u0388\u0389\u038a\u038c\u038e\u038f\u0390\u0391\u0392\u0393"
|
691 |
|
|
+ "\u0395\u0396\u0397\u0398\u0399\u039a\u039b\u039c\u039d\u039e"
|
692 |
|
|
+ "\u039f\u03a0\u03a1\u03a3\u03a4\u03a5\u03a6\u03a7\u03a8\u03aa"
|
693 |
|
|
+ "\u03ab\u03ac\u03ad\u03ae\u03af\u03b0\u03b1\u03b2\u03b3\u03b4"
|
694 |
|
|
+ "\u03b5\u03b6\u03b7\u03b8\u03b9\u03ba\u03bb\u03bd\u03be\u03bf"
|
695 |
|
|
+ "\u03c0\u03c1\u03c2\u03c3\u03c4\u03c5\u03c6\u03c7\u03c8\u03c9"
|
696 |
|
|
+ "\u03ca\u03cb\u03cc\u03cd\u03ce\u03d1\u03d2\u03d5\u03d6\u0401"
|
697 |
|
|
+ "\u0402\u0403\u0404\u0405\u0406\u0407\u0408\u0409\u040a\u040b"
|
698 |
|
|
+ "\u040c\u040e\u040f\u0410\u0411\u0412\u0413\u0414\u0415\u0416"
|
699 |
|
|
+ "\u0417\u0418\u0419\u041a\u041b\u041c\u041d\u041e\u041f\u0420"
|
700 |
|
|
+ "\u0421\u0422\u0423\u0424\u0425\u0426\u0427\u0428\u0429\u042a"
|
701 |
|
|
+ "\u042b\u042c\u042d\u042e\u042f\u0430\u0431\u0432\u0433\u0434"
|
702 |
|
|
+ "\u0435\u0436\u0437\u0438\u0439\u043a\u043b\u043c\u043d\u043e"
|
703 |
|
|
+ "\u043f\u0440\u0441\u0442\u0443\u0444\u0445\u0446\u0447\u0448"
|
704 |
|
|
+ "\u0449\u044a\u044b\u044c\u044d\u044e\u044f\u0451\u0452\u0453"
|
705 |
|
|
+ "\u0454\u0455\u0456\u0457\u0458\u0459\u045a\u045b\u045c\u045e"
|
706 |
|
|
+ "\u045f\u0462\u0463\u0472\u0473\u0474\u0475\u0490\u0491\u04d9"
|
707 |
|
|
+ "\u05b0\u05b1\u05b2\u05b3\u05b4\u05b5\u05b6\u05b7\u05b8\u05b9"
|
708 |
|
|
+ "\u05bb\u05bc\u05bd\u05be\u05bf\u05c0\u05c1\u05c2\u05c3\u05d0"
|
709 |
|
|
+ "\u05d1\u05d2\u05d3\u05d4\u05d5\u05d6\u05d7\u05d8\u05d9\u05da"
|
710 |
|
|
+ "\u05db\u05dc\u05dd\u05de\u05df\u05e0\u05e1\u05e2\u05e3\u05e4"
|
711 |
|
|
+ "\u05e5\u05e6\u05e7\u05e8\u05e9\u05ea\u05f0\u05f1\u05f2\u060c"
|
712 |
|
|
+ "\u061b\u061f\u0621\u0622\u0623\u0624\u0625\u0626\u0627\u0628"
|
713 |
|
|
+ "\u0629\u062a\u062b\u062c\u062d\u062e\u062f\u0630\u0631\u0632"
|
714 |
|
|
+ "\u0633\u0634\u0635\u0636\u0637\u0638\u0639\u063a\u0640\u0641"
|
715 |
|
|
+ "\u0642\u0643\u0644\u0645\u0646\u0647\u0648\u0649\u064a\u064b"
|
716 |
|
|
+ "\u064c\u064d\u064e\u064f\u0650\u0651\u0652\u0660\u0661\u0662"
|
717 |
|
|
+ "\u0663\u0664\u0665\u0666\u0667\u0668\u0669\u066a\u066d\u0679"
|
718 |
|
|
+ "\u067e\u0686\u0688\u0691\u0698\u06a4\u06af\u06ba\u06d2\u06d5"
|
719 |
|
|
+ "\u1e80\u1e81\u1e82\u1e83\u1e84\u1e85\u1ef2\u1ef3\u200c\u200d"
|
720 |
|
|
+ "\u200e\u200f\u2012\u2013\u2014\u2015\u2017\u2018\u2019\u201a"
|
721 |
|
|
+ "\u201b\u201c\u201d\u201e\u2020\u2021\u2022\u2024\u2025\u2026"
|
722 |
|
|
+ "\u202c\u202d\u202e\u2030\u2032\u2033\u2039\u203a\u203c\u2044"
|
723 |
|
|
+ "\u20a1\u20a3\u20a4\u20a7\u20aa\u20ab\u20ac\u2105\u2111\u2113"
|
724 |
|
|
+ "\u2116\u2118\u211c\u211e\u2122\u2126\u212e\u2135\u2153\u2154"
|
725 |
|
|
+ "\u215b\u215c\u215d\u215e\u2190\u2191\u2192\u2193\u2194\u2195"
|
726 |
|
|
+ "\u21a8\u21b5\u21d0\u21d1\u21d2\u21d3\u21d4\u2200\u2202\u2203"
|
727 |
|
|
+ "\u2205\u2206\u2207\u2208\u2209\u220b\u220f\u2211\u2212\u2217"
|
728 |
|
|
+ "\u221a\u221d\u221e\u221f\u2220\u2227\u2228\u2229\u222a\u222b"
|
729 |
|
|
+ "\u2234\u223c\u2245\u2248\u2260\u2261\u2264\u2265\u2282\u2283"
|
730 |
|
|
+ "\u2284\u2286\u2287\u2295\u2297\u22a5\u22c5\u2302\u2310\u2320"
|
731 |
|
|
+ "\u2321\u2329\u232a\u2500\u2502\u250c\u2510\u2514\u2518\u251c"
|
732 |
|
|
+ "\u2524\u252c\u2534\u253c\u2550\u2551\u2552\u2553\u2554\u2555"
|
733 |
|
|
+ "\u2556\u2557\u2558\u2559\u255a\u255b\u255c\u255d\u255e\u255f"
|
734 |
|
|
+ "\u2560\u2561\u2562\u2563\u2564\u2565\u2566\u2567\u2568\u2569"
|
735 |
|
|
+ "\u256a\u256b\u256c\u2580\u2584\u2588\u258c\u2590\u2591\u2592"
|
736 |
|
|
+ "\u2593\u25a0\u25a1\u25aa\u25ab\u25ac\u25b2\u25ba\u25bc\u25c4"
|
737 |
|
|
+ "\u25ca\u25cb\u25cf\u25d8\u25d9\u25e6\u263a\u263b\u263c\u2640"
|
738 |
|
|
+ "\u2642\u2660\u2663\u2665\u2666\u266a\u266b";
|
739 |
|
|
|
740 |
|
|
|
741 |
|
|
/**
|
742 |
|
|
* The offset of each glyph name in AGLFN_NAMES.
|
743 |
|
|
*
|
744 |
|
|
* Generated from the Adobe Glyph List for New Fonts, version 1.1
|
745 |
|
|
* of 17 April 2003.
|
746 |
|
|
*
|
747 |
|
|
* @see <a href=
|
748 |
|
|
* "http://partners.adobe.com/asn/tech/type/aglfn13.txt" >Adobe
|
749 |
|
|
* Glyph List for New Fonts</a>
|
750 |
|
|
*/
|
751 |
|
|
private static final String AGLFN_NAME_OFFSET
|
752 |
|
|
= "\u0001\u0007\u000e\u0017\")1;GQ\\ejpw~\u0084\u0089\u008d"
|
753 |
|
|
+ "\u0091\u0097\u009c\u00a1\u00a5\u00ab\u00b1\u00b6\u00bc\u00c6"
|
754 |
|
|
+ "\u00cb\u00d1\u00d9\u00e2\u00e5\u00e7\u00e9\u00eb\u00ed\u00ef"
|
755 |
|
|
+ "\u00f1\u00f3\u00f5\u00f7\u00f9\u00fb\u00fd\u00ff\u0101\u0103"
|
756 |
|
|
+ "\u0105\u0107\u0109\u010b\u010d\u010f\u0111\u0113\u0115\u0117"
|
757 |
|
|
+ "\u0119\u0125\u012f\u013c\u0148\u0153\u0159\u015b\u015d\u015f"
|
758 |
|
|
+ "\u0161\u0163\u0165\u0167\u0169\u016b\u016d\u016f\u0171\u0173"
|
759 |
|
|
+ "\u0175\u0177\u0179\u017b\u017d\u017f\u0181\u0183\u0185\u0187"
|
760 |
|
|
+ "\u0189\u018b\u018d\u0197\u019b\u01a6\u01b1\u01bc\u01c1\u01ca"
|
761 |
|
|
+ "\u01d3\u01d7\u01e1\u01e9\u01f2\u01fc\u0208\u0216\u0221\u022c"
|
762 |
|
|
+ "\u0233\u023a\u0244\u024a\u024d\u0257\u0266\u026e\u027b\u028a"
|
763 |
|
|
+ "\u0295\u029d\u02ab\u02b8\u02bf\u02c6\u02d2\u02d9\u02e3\u02e9"
|
764 |
|
|
+ "\u02ec\u02f5\u02fc\u0303\u030f\u0319\u0320\u0327\u0333\u033d"
|
765 |
|
|
+ "\u0341\u0348\u034f\u0356\u0362\u0369\u0373\u037c\u0383\u038a"
|
766 |
|
|
+ "\u0391\u039d\u03a7\u03ae\u03b4\u03bf\u03c6\u03cd\u03d9\u03e0"
|
767 |
|
|
+ "\u03ea\u03f0\u03f3\u03fc\u0403\u040a\u0416\u0420\u0427\u042e"
|
768 |
|
|
+ "\u043a\u0444\u0448\u044f\u0456\u045d\u0469\u0470\u047a\u0481"
|
769 |
|
|
+ "\u0488\u048f\u0496\u04a2\u04ac\u04b3\u04b9\u04c3\u04cb\u04d3"
|
770 |
|
|
+ "\u04da\u04e1\u04e9\u04f1\u04f8\u04ff\u050b\u0517\u0522\u052d"
|
771 |
|
|
+ "\u0534\u053b\u0542\u0549\u0550\u0557\u055f\u0567\u056e\u0575"
|
772 |
|
|
+ "\u0580\u058b\u0593\u059b\u05a2\u05a9\u05b5\u05c1\u05c8\u05cf"
|
773 |
|
|
+ "\u05da\u05e5\u05f2\u05ff\u060b\u0617\u061c\u0621\u0628\u062f"
|
774 |
|
|
+ "\u0637\u063f\u0646\u064d\u0655\u065d\u0668\u0671\u0674\u0677"
|
775 |
|
|
+ "\u0683\u068f\u069c\u06a9\u06b6\u06bd\u06c4\u06d1\u06de\u06e5"
|
776 |
|
|
+ "\u06ec\u06f1\u06f6\u06fd\u0704\u070b\u0712\u071f\u072c\u0733"
|
777 |
|
|
+ "\u073a\u0746\u074a\u074e\u0756\u075e\u0765\u076c\u077a\u0788"
|
778 |
|
|
+ "\u078b\u078e\u0795\u079c\u07a9\u07b6\u07bd\u07c4\u07cb\u07d2"
|
779 |
|
|
+ "\u07de\u07ea\u07f3\u07fc\u0803\u080a\u0817\u0824\u082b\u0832"
|
780 |
|
|
+ "\u0837\u083c\u0843\u084a\u0852\u085a\u0861\u0868\u086e\u0874"
|
781 |
|
|
+ "\u0882\u0890\u0898\u08a0\u08ac\u08b8\u08c4\u08d0\u08da\u08e1"
|
782 |
|
|
+ "\u08e8\u08f3\u08fe\u0905\u090c\u0912\u0919\u091f\u0925\u092b"
|
783 |
|
|
+ "\u0931\u0938\u093f\u094a\u0955\u095d\u0965\u0971\u097d\u098a"
|
784 |
|
|
+ "\u0997\u09a1\u09ab\u09b6\u09bc\u09c2\u09cc\u09d1\u09d8\u09de"
|
785 |
|
|
+ "\u09eb\u09f5\u09ff\u0a09\u0a17\u0a24\u0a2a\u0a38\u0a43\u0a4d"
|
786 |
|
|
+ "\u0a5a\u0a63\u0a6d\u0a7a\u0a87\u0a92\u0aa4\u0aaa\u0aaf\u0ab5"
|
787 |
|
|
+ "\u0abd\u0ac2\u0ac6\u0acc\u0ad1\u0ad7\u0ade\u0ae1\u0ae4\u0ae7"
|
788 |
|
|
+ "\u0aef\u0af2\u0af6\u0afc\u0b00\u0b08\u0b0c\u0b10\u0b14\u0b21"
|
789 |
|
|
+ "\u0b31\u0b3c\u0b49\u0b52\u0b5c\u0b71\u0b77\u0b7c\u0b82\u0b88"
|
790 |
|
|
+ "\u0b90\u0b95\u0b99\u0b9f\u0ba4\u0baa\u0bb1\u0bb4\u0bb7\u0bbf"
|
791 |
|
|
+ "\u0bc2\u0bc6\u0bcd\u0bd3\u0bd7\u0bdf\u0be3\u0be7\u0beb\u0bf1"
|
792 |
|
|
+ "\u0bfe\u0c0e\u0c1b\u0c28\u0c33\u0c3a\u0c43\u0c48\u0c4f\u0c59"
|
793 |
|
|
+ "\u0c63\u0c6d\u0c77\u0c81\u0c8b\u0c95\u0c9f\u0ca9\u0cb3\u0cbd"
|
794 |
|
|
+ "\u0cc7\u0cd1\u0cdb\u0ce5\u0cef\u0cf9\u0d03\u0d0d\u0d17\u0d21"
|
795 |
|
|
+ "\u0d2b\u0d35\u0d3f\u0d49\u0d53\u0d5d\u0d67\u0d71\u0d7b\u0d85"
|
796 |
|
|
+ "\u0d8f\u0d99\u0da3\u0dad\u0db7\u0dc1\u0dcb\u0dd5\u0ddf\u0de9"
|
797 |
|
|
+ "\u0df3\u0dfd\u0e07\u0e11\u0e1b\u0e25\u0e2f\u0e39\u0e43\u0e4d"
|
798 |
|
|
+ "\u0e57\u0e61\u0e6b\u0e75\u0e7f\u0e89\u0e93\u0e9d\u0ea7\u0eb1"
|
799 |
|
|
+ "\u0ebb\u0ec5\u0ecf\u0ed9\u0ee3\u0eed\u0ef7\u0f01\u0f0b\u0f15"
|
800 |
|
|
+ "\u0f1f\u0f29\u0f33\u0f3d\u0f47\u0f51\u0f5b\u0f65\u0f6f\u0f79"
|
801 |
|
|
+ "\u0f83\u0f8d\u0f97\u0fa1\u0fab\u0fb5\u0fbf\u0fc9\u0fd3\u0fdd"
|
802 |
|
|
+ "\u0fe7\u0ff1\u0ffb\u1005\u100f\u1019\u1023\u102d\u1037\u1041"
|
803 |
|
|
+ "\u104b\u1055\u105f\u1069\u1073\u107d\u1087\u1091\u109b\u10a5"
|
804 |
|
|
+ "\u10af\u10b9\u10c3\u10cd\u10d7\u10e1\u10eb\u10f5\u10ff\u1109"
|
805 |
|
|
+ "\u1113\u111d\u1127\u1131\u113b\u1145\u114f\u1159\u1163\u116d"
|
806 |
|
|
+ "\u1177\u1181\u118b\u1195\u119f\u11a9\u11b3\u11bd\u11c7\u11d1"
|
807 |
|
|
+ "\u11db\u11e5\u11ef\u11f9\u1203\u120d\u1217\u1221\u122b\u1235"
|
808 |
|
|
+ "\u123f\u1249\u1253\u125d\u1267\u1271\u127b\u1285\u128f\u1299"
|
809 |
|
|
+ "\u12a3\u12ad\u12b7\u12c1\u12cb\u12d5\u12df\u12e9\u12f3\u12fd"
|
810 |
|
|
+ "\u1307\u1311\u131b\u1325\u132f\u1339\u1343\u134d\u1357\u1361"
|
811 |
|
|
+ "\u136b\u1375\u137f\u1389\u1393\u139d\u13a7\u13b1\u13bb\u13c5"
|
812 |
|
|
+ "\u13cf\u13d9\u13e3\u13ed\u13f7\u1401\u140b\u1415\u141f\u1429"
|
813 |
|
|
+ "\u1433\u143d\u1447\u1451\u145b\u1465\u146f\u1479\u1483\u148d"
|
814 |
|
|
+ "\u1497\u14a1\u14ab\u14b5\u14bf\u14c9\u14d3\u14dd\u14e7\u14f1"
|
815 |
|
|
+ "\u14f8\u14ff\u1506\u150d\u1517\u1521\u1528\u152f\u1539\u1541"
|
816 |
|
|
+ "\u1549\u1551\u155c\u1563\u156a\u1574\u1582\u158c\u1597\u15a6"
|
817 |
|
|
+ "\u15b4\u15c1\u15cf\u15dc\u15e3\u15ed\u15f4\u1603\u1612\u161b"
|
818 |
|
|
+ "\u1625\u162f\u1639\u1645\u164c\u1653\u1661\u1670\u167a\u1683"
|
819 |
|
|
+ "\u1691\u1697\u169c\u16a3\u16ad\u16b2\u16b7\u16c1\u16ca\u16d4"
|
820 |
|
|
+ "\u16de\u16ea\u16f3\u1700\u170a\u1710\u171a\u1720\u1729\u1733"
|
821 |
|
|
+ "\u173d\u174a\u1756\u1763\u176d\u1775\u1780\u178a\u1794\u179e"
|
822 |
|
|
+ "\u17ab\u17ba\u17c7\u17d2\u17e0\u17ed\u17fa\u1804\u1810\u181c"
|
823 |
|
|
+ "\u1825\u182b\u1834\u183c\u1847\u1850\u1858\u1862\u1868\u1875"
|
824 |
|
|
+ "\u187d\u188a\u1893\u189e\u18a4\u18af\u18b9\u18c6\u18cc\u18d5"
|
825 |
|
|
+ "\u18df\u18e7\u18f1\u18fd\u1906\u1912\u191c\u1929\u1936\u1945"
|
826 |
|
|
+ "\u194f\u195c\u196b\u1976\u1985\u1993\u199b\u19a1\u19af\u19ba"
|
827 |
|
|
+ "\u19c5\u19cf\u19da\u19e3\u19ec\u19f5\u19fe\u1a07\u1a10\u1a19"
|
828 |
|
|
+ "\u1a22\u1a2b\u1a34\u1a3d\u1a46\u1a4f\u1a58\u1a61\u1a6a\u1a73"
|
829 |
|
|
+ "\u1a7c\u1a85\u1a8e\u1a97\u1aa0\u1aa9\u1ab2\u1abb\u1ac4\u1acd"
|
830 |
|
|
+ "\u1ad6\u1adf\u1ae8\u1af1\u1afa\u1b03\u1b0c\u1b15\u1b1e\u1b27"
|
831 |
|
|
+ "\u1b30\u1b39\u1b42\u1b4a\u1b52\u1b58\u1b60\u1b68\u1b70\u1b76"
|
832 |
|
|
+ "\u1b7e\u1b88\u1b8f\u1b96\u1b9d\u1ba8\u1bb0\u1bb8\u1bc0\u1bc8"
|
833 |
|
|
+ "\u1bd0\u1bd7\u1bde\u1be8\u1bf2\u1bfd\u1c07\u1c14\u1c18\u1c1f"
|
834 |
|
|
+ "\u1c24\u1c2a\u1c2f\u1c35\u1c3d\u1c49";
|
835 |
|
|
|
836 |
|
|
|
837 |
|
|
/**
|
838 |
|
|
* The name of each glyph in the Adobe Glyph List for New Fonts
|
839 |
|
|
* (AGLFN). The name of the n-th glyph starts at position
|
840 |
|
|
* AGLFN_NAME_OFFSET.charAt(n). It ends before the following
|
841 |
|
|
* slash (slashes cannot be part of a PostScript name, which
|
842 |
|
|
* is why we use it for separation).
|
843 |
|
|
*
|
844 |
|
|
* <p>Generated from the Adobe Glyph List for New Fonts, version 1.1
|
845 |
|
|
* of 17 April 2003.
|
846 |
|
|
*
|
847 |
|
|
* @see <a href=
|
848 |
|
|
* "http://partners.adobe.com/asn/tech/type/aglfn13.txt" >Adobe
|
849 |
|
|
* Glyph List for New Fonts</a>
|
850 |
|
|
*/
|
851 |
|
|
private static final String AGLFN_NAMES
|
852 |
|
|
= "/space/exclam/quotedbl/numbersign/dollar/percent/ampersand/q"
|
853 |
|
|
+ "uotesingle/parenleft/parenright/asterisk/plus/comma/hyphen/p"
|
854 |
|
|
+ "eriod/slash/zero/one/two/three/four/five/six/seven/eight/nin"
|
855 |
|
|
+ "e/colon/semicolon/less/equal/greater/question/at/A/B/C/D/E/F"
|
856 |
|
|
+ "/G/H/I/J/K/L/M/N/O/P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/backsla"
|
857 |
|
|
+ "sh/bracketright/asciicircum/underscore/grave/a/b/c/d/e/f/g/h"
|
858 |
|
|
+ "/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/braceleft/bar/bracerigh"
|
859 |
|
|
+ "t/asciitilde/exclamdown/cent/sterling/currency/yen/brokenbar"
|
860 |
|
|
+ "/section/dieresis/copyright/ordfeminine/guillemotleft/logica"
|
861 |
|
|
+ "lnot/registered/macron/degree/plusminus/acute/mu/paragraph/p"
|
862 |
|
|
+ "eriodcentered/cedilla/ordmasculine/guillemotright/onequarter"
|
863 |
|
|
+ "/onehalf/threequarters/questiondown/Agrave/Aacute/Acircumfle"
|
864 |
|
|
+ "x/Atilde/Adieresis/Aring/AE/Ccedilla/Egrave/Eacute/Ecircumfl"
|
865 |
|
|
+ "ex/Edieresis/Igrave/Iacute/Icircumflex/Idieresis/Eth/Ntilde/"
|
866 |
|
|
+ "Ograve/Oacute/Ocircumflex/Otilde/Odieresis/multiply/Oslash/U"
|
867 |
|
|
+ "grave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn/germandbls/a"
|
868 |
|
|
+ "grave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla/"
|
869 |
|
|
+ "egrave/eacute/ecircumflex/edieresis/igrave/iacute/icircumfle"
|
870 |
|
|
+ "x/idieresis/eth/ntilde/ograve/oacute/ocircumflex/otilde/odie"
|
871 |
|
|
+ "resis/divide/oslash/ugrave/uacute/ucircumflex/udieresis/yacu"
|
872 |
|
|
+ "te/thorn/ydieresis/Amacron/amacron/Abreve/abreve/Aogonek/aog"
|
873 |
|
|
+ "onek/Cacute/cacute/Ccircumflex/ccircumflex/Cdotaccent/cdotac"
|
874 |
|
|
+ "cent/Ccaron/ccaron/Dcaron/dcaron/Dcroat/dcroat/Emacron/emacr"
|
875 |
|
|
+ "on/Ebreve/ebreve/Edotaccent/edotaccent/Eogonek/eogonek/Ecaro"
|
876 |
|
|
+ "n/ecaron/Gcircumflex/gcircumflex/Gbreve/gbreve/Gdotaccent/gd"
|
877 |
|
|
+ "otaccent/Gcommaaccent/gcommaaccent/Hcircumflex/hcircumflex/H"
|
878 |
|
|
+ "bar/hbar/Itilde/itilde/Imacron/imacron/Ibreve/ibreve/Iogonek"
|
879 |
|
|
+ "/iogonek/Idotaccent/dotlessi/IJ/ij/Jcircumflex/jcircumflex/K"
|
880 |
|
|
+ "commaaccent/kcommaaccent/kgreenlandic/Lacute/lacute/Lcommaac"
|
881 |
|
|
+ "cent/lcommaaccent/Lcaron/lcaron/Ldot/ldot/Lslash/lslash/Nacu"
|
882 |
|
|
+ "te/nacute/Ncommaaccent/ncommaaccent/Ncaron/ncaron/napostroph"
|
883 |
|
|
+ "e/Eng/eng/Omacron/omacron/Obreve/obreve/Ohungarumlaut/ohunga"
|
884 |
|
|
+ "rumlaut/OE/oe/Racute/racute/Rcommaaccent/rcommaaccent/Rcaron"
|
885 |
|
|
+ "/rcaron/Sacute/sacute/Scircumflex/scircumflex/Scedilla/scedi"
|
886 |
|
|
+ "lla/Scaron/scaron/Tcommaaccent/tcommaaccent/Tcaron/tcaron/Tb"
|
887 |
|
|
+ "ar/tbar/Utilde/utilde/Umacron/umacron/Ubreve/ubreve/Uring/ur"
|
888 |
|
|
+ "ing/Uhungarumlaut/uhungarumlaut/Uogonek/uogonek/Wcircumflex/"
|
889 |
|
|
+ "wcircumflex/Ycircumflex/ycircumflex/Ydieresis/Zacute/zacute/"
|
890 |
|
|
+ "Zdotaccent/zdotaccent/Zcaron/zcaron/longs/florin/Ohorn/ohorn"
|
891 |
|
|
+ "/Uhorn/uhorn/Gcaron/gcaron/Aringacute/aringacute/AEacute/aea"
|
892 |
|
|
+ "cute/Oslashacute/oslashacute/Scommaaccent/scommaaccent/afii5"
|
893 |
|
|
+ "7929/afii64937/circumflex/caron/breve/dotaccent/ring/ogonek/"
|
894 |
|
|
+ "tilde/hungarumlaut/gravecomb/acutecomb/tildecomb/hookaboveco"
|
895 |
|
|
+ "mb/dotbelowcomb/tonos/dieresistonos/Alphatonos/anoteleia/Eps"
|
896 |
|
|
+ "ilontonos/Etatonos/Iotatonos/Omicrontonos/Upsilontonos/Omega"
|
897 |
|
|
+ "tonos/iotadieresistonos/Alpha/Beta/Gamma/Epsilon/Zeta/Eta/Th"
|
898 |
|
|
+ "eta/Iota/Kappa/Lambda/Mu/Nu/Xi/Omicron/Pi/Rho/Sigma/Tau/Upsi"
|
899 |
|
|
+ "lon/Phi/Chi/Psi/Iotadieresis/Upsilondieresis/alphatonos/epsi"
|
900 |
|
|
+ "lontonos/etatonos/iotatonos/upsilondieresistonos/alpha/beta/"
|
901 |
|
|
+ "gamma/delta/epsilon/zeta/eta/theta/iota/kappa/lambda/nu/xi/o"
|
902 |
|
|
+ "micron/pi/rho/sigma1/sigma/tau/upsilon/phi/chi/psi/omega/iot"
|
903 |
|
|
+ "adieresis/upsilondieresis/omicrontonos/upsilontonos/omegaton"
|
904 |
|
|
+ "os/theta1/Upsilon1/phi1/omega1/afii10023/afii10051/afii10052"
|
905 |
|
|
+ "/afii10053/afii10054/afii10055/afii10056/afii10057/afii10058"
|
906 |
|
|
+ "/afii10059/afii10060/afii10061/afii10062/afii10145/afii10017"
|
907 |
|
|
+ "/afii10018/afii10019/afii10020/afii10021/afii10022/afii10024"
|
908 |
|
|
+ "/afii10025/afii10026/afii10027/afii10028/afii10029/afii10030"
|
909 |
|
|
+ "/afii10031/afii10032/afii10033/afii10034/afii10035/afii10036"
|
910 |
|
|
+ "/afii10037/afii10038/afii10039/afii10040/afii10041/afii10042"
|
911 |
|
|
+ "/afii10043/afii10044/afii10045/afii10046/afii10047/afii10048"
|
912 |
|
|
+ "/afii10049/afii10065/afii10066/afii10067/afii10068/afii10069"
|
913 |
|
|
+ "/afii10070/afii10072/afii10073/afii10074/afii10075/afii10076"
|
914 |
|
|
+ "/afii10077/afii10078/afii10079/afii10080/afii10081/afii10082"
|
915 |
|
|
+ "/afii10083/afii10084/afii10085/afii10086/afii10087/afii10088"
|
916 |
|
|
+ "/afii10089/afii10090/afii10091/afii10092/afii10093/afii10094"
|
917 |
|
|
+ "/afii10095/afii10096/afii10097/afii10071/afii10099/afii10100"
|
918 |
|
|
+ "/afii10101/afii10102/afii10103/afii10104/afii10105/afii10106"
|
919 |
|
|
+ "/afii10107/afii10108/afii10109/afii10110/afii10193/afii10146"
|
920 |
|
|
+ "/afii10194/afii10147/afii10195/afii10148/afii10196/afii10050"
|
921 |
|
|
+ "/afii10098/afii10846/afii57799/afii57801/afii57800/afii57802"
|
922 |
|
|
+ "/afii57793/afii57794/afii57795/afii57798/afii57797/afii57806"
|
923 |
|
|
+ "/afii57796/afii57807/afii57839/afii57645/afii57841/afii57842"
|
924 |
|
|
+ "/afii57804/afii57803/afii57658/afii57664/afii57665/afii57666"
|
925 |
|
|
+ "/afii57667/afii57668/afii57669/afii57670/afii57671/afii57672"
|
926 |
|
|
+ "/afii57673/afii57674/afii57675/afii57676/afii57677/afii57678"
|
927 |
|
|
+ "/afii57679/afii57680/afii57681/afii57682/afii57683/afii57684"
|
928 |
|
|
+ "/afii57685/afii57686/afii57687/afii57688/afii57689/afii57690"
|
929 |
|
|
+ "/afii57716/afii57717/afii57718/afii57388/afii57403/afii57407"
|
930 |
|
|
+ "/afii57409/afii57410/afii57411/afii57412/afii57413/afii57414"
|
931 |
|
|
+ "/afii57415/afii57416/afii57417/afii57418/afii57419/afii57420"
|
932 |
|
|
+ "/afii57421/afii57422/afii57423/afii57424/afii57425/afii57426"
|
933 |
|
|
+ "/afii57427/afii57428/afii57429/afii57430/afii57431/afii57432"
|
934 |
|
|
+ "/afii57433/afii57434/afii57440/afii57441/afii57442/afii57443"
|
935 |
|
|
+ "/afii57444/afii57445/afii57446/afii57470/afii57448/afii57449"
|
936 |
|
|
+ "/afii57450/afii57451/afii57452/afii57453/afii57454/afii57455"
|
937 |
|
|
+ "/afii57456/afii57457/afii57458/afii57392/afii57393/afii57394"
|
938 |
|
|
+ "/afii57395/afii57396/afii57397/afii57398/afii57399/afii57400"
|
939 |
|
|
+ "/afii57401/afii57381/afii63167/afii57511/afii57506/afii57507"
|
940 |
|
|
+ "/afii57512/afii57513/afii57508/afii57505/afii57509/afii57514"
|
941 |
|
|
+ "/afii57519/afii57534/Wgrave/wgrave/Wacute/wacute/Wdieresis/w"
|
942 |
|
|
+ "dieresis/Ygrave/ygrave/afii61664/afii301/afii299/afii300/fig"
|
943 |
|
|
+ "uredash/endash/emdash/afii00208/underscoredbl/quoteleft/quot"
|
944 |
|
|
+ "eright/quotesinglbase/quotereversed/quotedblleft/quotedblrig"
|
945 |
|
|
+ "ht/quotedblbase/dagger/daggerdbl/bullet/onedotenleader/twodo"
|
946 |
|
|
+ "tenleader/ellipsis/afii61573/afii61574/afii61575/perthousand"
|
947 |
|
|
+ "/minute/second/guilsinglleft/guilsinglright/exclamdbl/fracti"
|
948 |
|
|
+ "on/colonmonetary/franc/lira/peseta/afii57636/dong/Euro/afii6"
|
949 |
|
|
+ "1248/Ifraktur/afii61289/afii61352/weierstrass/Rfraktur/presc"
|
950 |
|
|
+ "ription/trademark/Omega/estimated/aleph/onethird/twothirds/o"
|
951 |
|
|
+ "neeighth/threeeighths/fiveeighths/seveneighths/arrowleft/arr"
|
952 |
|
|
+ "owup/arrowright/arrowdown/arrowboth/arrowupdn/arrowupdnbse/c"
|
953 |
|
|
+ "arriagereturn/arrowdblleft/arrowdblup/arrowdblright/arrowdbl"
|
954 |
|
|
+ "down/arrowdblboth/universal/partialdiff/existential/emptyset"
|
955 |
|
|
+ "/Delta/gradient/element/notelement/suchthat/product/summatio"
|
956 |
|
|
+ "n/minus/asteriskmath/radical/proportional/infinity/orthogona"
|
957 |
|
|
+ "l/angle/logicaland/logicalor/intersection/union/integral/the"
|
958 |
|
|
+ "refore/similar/congruent/approxequal/notequal/equivalence/le"
|
959 |
|
|
+ "ssequal/greaterequal/propersubset/propersuperset/notsubset/r"
|
960 |
|
|
+ "eflexsubset/reflexsuperset/circleplus/circlemultiply/perpend"
|
961 |
|
|
+ "icular/dotmath/house/revlogicalnot/integraltp/integralbt/ang"
|
962 |
|
|
+ "leleft/angleright/SF100000/SF110000/SF010000/SF030000/SF0200"
|
963 |
|
|
+ "00/SF040000/SF080000/SF090000/SF060000/SF070000/SF050000/SF4"
|
964 |
|
|
+ "30000/SF240000/SF510000/SF520000/SF390000/SF220000/SF210000/"
|
965 |
|
|
+ "SF250000/SF500000/SF490000/SF380000/SF280000/SF270000/SF2600"
|
966 |
|
|
+ "00/SF360000/SF370000/SF420000/SF190000/SF200000/SF230000/SF4"
|
967 |
|
|
+ "70000/SF480000/SF410000/SF450000/SF460000/SF400000/SF540000/"
|
968 |
|
|
+ "SF530000/SF440000/upblock/dnblock/block/lfblock/rtblock/ltsh"
|
969 |
|
|
+ "ade/shade/dkshade/filledbox/H22073/H18543/H18551/filledrect/"
|
970 |
|
|
+ "triagup/triagrt/triagdn/triaglf/lozenge/circle/H18533/invbul"
|
971 |
|
|
+ "let/invcircle/openbullet/smileface/invsmileface/sun/female/m"
|
972 |
|
|
+ "ale/spade/club/heart/diamond/musicalnote/musicalnotedbl/";
|
973 |
|
|
|
974 |
|
|
|
975 |
|
|
/**
|
976 |
|
|
* Determines the name of a glyph according to the Adobe Glyph List
|
977 |
|
|
* for New Fonts (AGLFN). Because all glyphs in AGLFN correspond to
|
978 |
|
|
* a precomposed Unicode codepoint, the mismatch between characters
|
979 |
|
|
* and glyphs is not an issue here.
|
980 |
|
|
*
|
981 |
|
|
* @param c the Unicode codepoint that corresponds to the glyph, for
|
982 |
|
|
* example <code>0x010a</code> for <code>LATIN CAPITAL LETTER C WITH
|
983 |
|
|
* DOT ABOVE</code>.
|
984 |
|
|
*
|
985 |
|
|
* @return the glyph name, for example <code>Cdotaccent</code>. If
|
986 |
|
|
* the glyph is not in the <i>Adobe Glyph List for New Fonts</i>,
|
987 |
|
|
* <code>null</code> is returned.
|
988 |
|
|
*
|
989 |
|
|
* @see <a href=
|
990 |
|
|
* "http://partners.adobe.com/asn/tech/type/aglfn13.txt" >Adobe
|
991 |
|
|
* Glyph List for New Fonts (AGLFN), version 1.1 of April 17,
|
992 |
|
|
* 2003</a>
|
993 |
|
|
*
|
994 |
|
|
* @see <a href=
|
995 |
|
|
* "http://partners.adobe.com/asn/developer/type/unicodegn.html#6"
|
996 |
|
|
* >Adobe’s guidelines related to Unicode</a>
|
997 |
|
|
*/
|
998 |
|
|
private static String getAGLFNName(char c)
|
999 |
|
|
{
|
1000 |
|
|
int min, max, mid;
|
1001 |
|
|
char midChar;
|
1002 |
|
|
|
1003 |
|
|
/* Performs a binary search in the sorted array (actually, a
|
1004 |
|
|
* String) of glyphs in the Adobe Glyph List for New Fonts.
|
1005 |
|
|
*
|
1006 |
|
|
* A good compiler might be able to optimize a call to charAt for
|
1007 |
|
|
* a static final String, but this routine is probably not that
|
1008 |
|
|
* critical to performance.
|
1009 |
|
|
*/
|
1010 |
|
|
min = 0;
|
1011 |
|
|
max = AGLFN_GLYPHS.length() - 1;
|
1012 |
|
|
mid = max >> 1;
|
1013 |
|
|
midChar = AGLFN_GLYPHS.charAt(mid);
|
1014 |
|
|
do
|
1015 |
|
|
{
|
1016 |
|
|
if (midChar == c)
|
1017 |
|
|
break;
|
1018 |
|
|
else if (midChar < c)
|
1019 |
|
|
min = mid + 1;
|
1020 |
|
|
else
|
1021 |
|
|
max = mid;
|
1022 |
|
|
mid = (min + max) >> 1;
|
1023 |
|
|
midChar = AGLFN_GLYPHS.charAt(mid);
|
1024 |
|
|
}
|
1025 |
|
|
while (min < max);
|
1026 |
|
|
|
1027 |
|
|
if (midChar != c)
|
1028 |
|
|
return null;
|
1029 |
|
|
|
1030 |
|
|
int pos = AGLFN_NAME_OFFSET.charAt(mid);
|
1031 |
|
|
return AGLFN_NAMES.substring(pos, AGLFN_NAMES.indexOf('/', pos));
|
1032 |
|
|
}
|
1033 |
|
|
|
1034 |
|
|
|
1035 |
|
|
/**
|
1036 |
|
|
* Returns the PostScript name of a glyph, given the sequence of
|
1037 |
|
|
* Unicode characters that is required to produce the glyph. The
|
1038 |
|
|
* returned name follows Adobe’s glyph naming recommendations
|
1039 |
|
|
* in order to allow searching and indexing of the produced
|
1040 |
|
|
* PostScript and PDF.
|
1041 |
|
|
*
|
1042 |
|
|
* <p>Some examples:
|
1043 |
|
|
* <ul><li><code>U+0041</code> gives <code>A</code>;</li>
|
1044 |
|
|
* <li><code>U+011D</code> gives <code>gcircumflex</code>;</li>
|
1045 |
|
|
* <li><code>U+007A U+0302</code> gives <code>z_uni0302</code>;</li>
|
1046 |
|
|
* <li><code>U+D807 U+DC42</code> (an UTF-16 escape sequence)
|
1047 |
|
|
* gives <code>u11C42</code>;</li>
|
1048 |
|
|
* </ul>.
|
1049 |
|
|
*
|
1050 |
|
|
* <p>The routine does <i>not</i> bring sequences in any canonical
|
1051 |
|
|
* form. Therefore, the result for <code>U+0067 U+0302</code> (the
|
1052 |
|
|
* decomposition of <code>U+011D</code>) will be
|
1053 |
|
|
* <code>g_uni0302</code>, not <code>gcircumflex</code>.
|
1054 |
|
|
*
|
1055 |
|
|
* @see <a href=
|
1056 |
|
|
* "http://partners.adobe.com/asn/tech/type/unicodegn.jsp" >Unicode
|
1057 |
|
|
* and Glyph Names</a> and <a href=
|
1058 |
|
|
* "http://partners.adobe.com/asn/tech/type/glyphnamelimits.jsp"
|
1059 |
|
|
* >Glyph Names and Current Implementations</a>
|
1060 |
|
|
*/
|
1061 |
|
|
private static String getGlyphName(char[] chars)
|
1062 |
|
|
{
|
1063 |
|
|
char c;
|
1064 |
|
|
String name;
|
1065 |
|
|
int numChars;
|
1066 |
|
|
boolean hasSurrogates = false;
|
1067 |
|
|
|
1068 |
|
|
if ((chars == null) || ((numChars = chars.length) == 0))
|
1069 |
|
|
return ".notdef";
|
1070 |
|
|
|
1071 |
|
|
/* The vast majority of cases will be just a single character.
|
1072 |
|
|
* Therefore, we have a special code path for this case.
|
1073 |
|
|
*/
|
1074 |
|
|
if (numChars == 1)
|
1075 |
|
|
{
|
1076 |
|
|
c = chars[0];
|
1077 |
|
|
name = getAGLFNName(c);
|
1078 |
|
|
if (name != null)
|
1079 |
|
|
return name;
|
1080 |
|
|
}
|
1081 |
|
|
|
1082 |
|
|
CPStringBuilder buf = new CPStringBuilder(numChars * 8);
|
1083 |
|
|
for (int i = 0; i < numChars; i++)
|
1084 |
|
|
{
|
1085 |
|
|
if (i > 0)
|
1086 |
|
|
buf.append('_');
|
1087 |
|
|
c = chars[i];
|
1088 |
|
|
|
1089 |
|
|
/* handle surrogate pairs */
|
1090 |
|
|
if (c >> 10 == 0x36) // U+D800 .. U+DBFF: High surrogate
|
1091 |
|
|
{
|
1092 |
|
|
/* Adobe recommends using the 'u' prefix only for
|
1093 |
|
|
* characters outside the Unicode Basic Multilingual Plane,
|
1094 |
|
|
* because Acrobat 4 and 5 understand only the "uni" prefix.
|
1095 |
|
|
* The 'u' prefix will be supported by Acrobat 6 and later.
|
1096 |
|
|
*
|
1097 |
|
|
* For further information, please refer to this page:
|
1098 |
|
|
* http://partners.adobe.com/asn/tech/type/glyphnamelimits.jsp#3
|
1099 |
|
|
*/
|
1100 |
|
|
int ucs4 = (((c & 0x3ff) << 10) | (chars[++i] & 0x3ff)) + 0x10000;
|
1101 |
|
|
buf.append('u');
|
1102 |
|
|
buf.append(Integer.toHexString(ucs4).toUpperCase());
|
1103 |
|
|
}
|
1104 |
|
|
else
|
1105 |
|
|
{
|
1106 |
|
|
/* Try the Adobe Glyph List. */
|
1107 |
|
|
name = getAGLFNName(c);
|
1108 |
|
|
if (name != null)
|
1109 |
|
|
buf.append(name);
|
1110 |
|
|
else
|
1111 |
|
|
{
|
1112 |
|
|
char nibble;
|
1113 |
|
|
buf.append("uni");
|
1114 |
|
|
nibble = (char) (((c >> 12) & 0xf) + 0x30);
|
1115 |
|
|
if (nibble > 0x39)
|
1116 |
|
|
nibble += 7;
|
1117 |
|
|
buf.append(nibble);
|
1118 |
|
|
nibble = (char) (((c >> 8) & 0xf) + 0x30);
|
1119 |
|
|
if (nibble > 0x39)
|
1120 |
|
|
nibble += 7;
|
1121 |
|
|
buf.append(nibble);
|
1122 |
|
|
nibble = (char) (((c >> 4) & 0xf) + 0x30);
|
1123 |
|
|
if (nibble > 0x39)
|
1124 |
|
|
nibble += 7;
|
1125 |
|
|
buf.append(nibble);
|
1126 |
|
|
nibble = (char) (((c >> 0) & 0xf) + 0x30);
|
1127 |
|
|
if (nibble > 0x39)
|
1128 |
|
|
nibble += 7;
|
1129 |
|
|
buf.append(nibble);
|
1130 |
|
|
}
|
1131 |
|
|
}
|
1132 |
|
|
}
|
1133 |
|
|
return buf.toString();
|
1134 |
|
|
}
|
1135 |
|
|
}
|