* src/psnames/pstables.h, src/psnames/psmodule.c, src/tools/glnames.py:

fixed a bug in 'glnames.py' that prevented it from generating correct
	glyph names table. This resulted in the unavailability of certain glyphs
	like "Cacute", "cacute" and "lslash" in Unicode charmaps, even if these
	were present in the font (causing problems for Polish users).
This commit is contained in:
David Turner 2001-10-08 21:18:11 +00:00
parent f70cf971a8
commit b246a5efd6
4 changed files with 277 additions and 230 deletions

View File

@ -1,3 +1,12 @@
2001-10-08 David Turner <david@freetype.org>
* src/psnames/pstables.h, src/psnames/psmodule.c, src/tools/glnames.py:
fixed a bug in 'glnames.py' that prevented it from generating correct
glyph names table. This resulted in the unavailability of certain glyphs
like "Cacute", "cacute" and "lslash" in Unicode charmaps, even if these
were present in the font (causing problems for Polish users).
2001-10-07 Richard Barber <rich@solutionuk.com>
* src/cache/ftlru.c (FT_Lru_Lookup_Node): fixed a bug that prevented

View File

@ -115,11 +115,11 @@
/* now, look up the glyph in the Adobe Glyph List */
for ( n = 0; n < NUM_ADOBE_GLYPHS; n++ )
{
const char* name = t1_standard_glyphs[n];
const char* name = sid_standard_names[n];
if ( first == name[0] && strcmp( glyph_name, name ) == 0 )
return names_to_unicode[n];
return ps_names_to_unicode[n];
}
/* not found, there is probably no Unicode value for this glyph name */
@ -173,7 +173,7 @@
{
uni_char = PS_Unicode_Value( gname );
if ( uni_char && uni_char != 0xFFFF )
if ( uni_char != 0 && uni_char != 0xFFFF )
{
map->unicode = uni_char;
map->glyph_index = n;
@ -247,14 +247,14 @@
if ( name_index >= 258 )
name_index = 0;
return standard_glyph_names[mac_standard_names[name_index]];
return ps_glyph_names[mac_standard_names[name_index]];
}
static const char*
PS_Standard_Strings( FT_UInt sid )
{
return ( sid < NUM_STD_GLYPHS ? t1_standard_glyphs[sid] : 0 );
return ( sid < NUM_SID_GLYPHS ? sid_standard_names[sid] : 0 );
}

View File

@ -1,6 +1,6 @@
/***************************************************************************/
/* */
/* pstables.h */
/* c:\david\source\freetype\freetype2\src\psnames\pstables.h */
/* */
/* PostScript glyph names (specification only). */
/* */
@ -19,39 +19,13 @@
/* this file has been generated automatically -- do not edit! */
static const char* const standard_glyph_names[] =
static const char* const ps_glyph_names[] =
{
".notdef",
".null",
"CR",
"notequal",
"infinity",
"lessequal",
"greaterequal",
"partialdiff",
"summation",
"product",
"pi",
"integral",
"Omega",
"radical",
"approxequal",
"Delta",
"nbspace",
"lozenge",
"periodcentered",
"nonmarkingreturn",
"nonbreakingspace",
"apple",
"lslash",
"franc",
"Gbreve",
"gbreve",
"Idot",
"Scedilla",
"scedilla",
"Cacute",
"cacute",
"Ccaron",
"ccaron",
"dmacron",
".notdef",
"space",
"exclam",
@ -166,7 +140,7 @@
"endash",
"dagger",
"daggerdbl",
"periodcenter",
"periodcentered",
"paragraph",
"bullet",
"quotesinglbase",
@ -198,7 +172,7 @@
"ordmasculine",
"ae",
"dotlessi",
"Islash",
"lslash",
"oslash",
"oe",
"germandbls",
@ -425,7 +399,7 @@
"OEsmall",
"Oslashsmall",
"Ugravesmall",
"Uacautesmall",
"Uacutesmall",
"Ucircumflexsmall",
"Udieresissmall",
"Yacutesmall",
@ -455,12 +429,16 @@
"Aogonek",
"Aringacute",
"Beta",
"Cacute",
"Caron",
"Ccaron",
"Ccircumflex",
"Cdotaccent",
"Chi",
"Dcaron",
"Dcroat",
"Delta",
"Delta",
"Dieresis",
"DieresisAcute",
"DieresisGrave",
@ -476,6 +454,7 @@
"Etatonos",
"Euro",
"Gamma",
"Gbreve",
"Gcaron",
"Gcircumflex",
"Gcommaaccent",
@ -517,6 +496,8 @@
"Ohorn",
"Ohungarumlaut",
"Omacron",
"Omega",
"Omega",
"Omegatonos",
"Omicron",
"Omicrontonos",
@ -570,6 +551,8 @@
"SF530000",
"SF540000",
"Sacute",
"Scedilla",
"Scedilla",
"Scircumflex",
"Scommaaccent",
"Sigma",
@ -579,7 +562,6 @@
"Tcommaaccent",
"Tcommaaccent",
"Theta",
"Uacutesmall",
"Ubreve",
"Uhorn",
"Uhungarumlaut",
@ -858,6 +840,7 @@
"angleright",
"anoteleia",
"aogonek",
"approxequal",
"aringacute",
"arrowboth",
"arrowdblboth",
@ -889,7 +872,9 @@
"bracketrightbt",
"bracketrightex",
"bracketrighttp",
"cacute",
"carriagereturn",
"ccaron",
"ccircumflex",
"cdotaccent",
"chi",
@ -939,13 +924,16 @@
"female",
"filledbox",
"filledrect",
"franc",
"gamma",
"gbreve",
"gcaron",
"gcircumflex",
"gcommaaccent",
"gdotaccent",
"gradient",
"gravecomb",
"greaterequal",
"hbar",
"hcircumflex",
"heart",
@ -954,6 +942,8 @@
"ibreve",
"ij",
"imacron",
"infinity",
"integral",
"integralbt",
"integralex",
"integraltp",
@ -976,12 +966,14 @@
"lcaron",
"lcommaaccent",
"ldot",
"lessequal",
"lfblock",
"lira",
"ll",
"logicaland",
"logicalor",
"longs",
"lozenge",
"ltshade",
"male",
"minute",
@ -992,6 +984,7 @@
"ncaron",
"ncommaaccent",
"notelement",
"notequal",
"notsubset",
"nu",
"obreve",
@ -1012,17 +1005,21 @@
"parenrightbt",
"parenrightex",
"parenrighttp",
"partialdiff",
"perpendicular",
"peseta",
"phi",
"phi1",
"pi",
"prescription",
"product",
"propersubset",
"propersuperset",
"proportional",
"psi",
"quotereversed",
"racute",
"radical",
"radicalex",
"rcaron",
"rcommaaccent",
@ -1034,6 +1031,8 @@
"rho",
"rtblock",
"sacute",
"scedilla",
"scedilla",
"scircumflex",
"scommaaccent",
"second",
@ -1044,6 +1043,7 @@
"smileface",
"spade",
"suchthat",
"summation",
"sun",
"tau",
"tbar",
@ -1090,18 +1090,17 @@
#endif /* FT_CONFIG_OPTION_ADOBE_GLYPH_LIST */
0
NULL
};
static const char* const * const t1_standard_glyphs =
standard_glyph_names + 31;
static const char* const * const sid_standard_names = ps_glyph_names + 5;
#define NUM_STD_GLYPHS 391
#define NUM_SID_GLYPHS 391
#ifdef FT_CONFIG_OPTION_ADOBE_GLYPH_LIST
#define NUM_ADOBE_GLYPHS 1032
#define NUM_ADOBE_GLYPHS 1058
#else
#define NUM_ADOBE_GLYPHS 391
#endif
@ -1109,9 +1108,35 @@
static const unsigned short mac_standard_names[259] =
{
31,
5,
0,
1,
6,
7,
8,
9,
10,
11,
12,
109,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26,
27,
28,
29,
30,
31,
32,
33,
34,
@ -1119,7 +1144,7 @@
36,
37,
38,
135,
39,
40,
41,
42,
@ -1150,7 +1175,7 @@
67,
68,
69,
70,
129,
71,
72,
73,
@ -1176,186 +1201,162 @@
93,
94,
95,
155,
96,
97,
98,
99,
100,
101,
178,
180,
182,
183,
191,
194,
200,
205,
208,
206,
207,
210,
209,
211,
212,
215,
213,
214,
216,
219,
217,
218,
220,
221,
224,
222,
223,
225,
227,
230,
228,
229,
117,
166,
102,
103,
104,
105,
106,
107,
108,
109,
110,
111,
112,
113,
114,
115,
116,
117,
118,
119,
120,
121,
122,
123,
124,
125,
126,
204,
206,
208,
209,
217,
220,
226,
231,
234,
232,
233,
236,
235,
237,
238,
241,
239,
240,
242,
245,
243,
244,
246,
247,
250,
248,
249,
251,
253,
256,
254,
255,
143,
192,
128,
129,
133,
147,
146,
180,
196,
201,
184,
156,
162,
120,
154,
170,
175,
158,
130,
136,
2,
169,
172,
143,
146,
3,
187,
161,
4,
5,
131,
183,
105,
157,
6,
7,
8,
9,
10,
170,
174,
144,
148,
11,
175,
178,
154,
127,
182,
149,
152,
128,
101,
156,
12,
132,
106,
13,
14,
137,
151,
152,
111,
125,
126,
15,
205,
207,
222,
173,
179,
181,
196,
147,
153,
116,
142,
168,
136,
150,
96,
39,
190,
110,
124,
70,
13,
164,
16,
258,
229,
130,
232,
203,
104,
108,
112,
113,
114,
115,
118,
119,
122,
123,
127,
177,
184,
176,
185,
186,
187,
188,
189,
190,
192,
193,
17,
195,
198,
199,
201,
150,
131,
132,
133,
134,
135,
137,
138,
139,
140,
141,
144,
17,
148,
149,
153,
203,
210,
202,
211,
212,
213,
214,
215,
216,
218,
219,
18,
221,
224,
225,
227,
176,
157,
158,
159,
160,
161,
163,
164,
145,
151,
197,
226,
204,
233,
165,
166,
159,
172,
202,
231,
162,
167,
171,
173,
155,
169,
174,
160,
163,
168,
18,
19,
223,
252,
230,
259,
191,
185,
198,
228,
257,
188,
193,
197,
199,
181,
195,
200,
186,
189,
194,
20,
21,
22,
@ -1365,14 +1366,12 @@
26,
27,
28,
29,
30,
0
};
static const unsigned short names_to_unicode[1033] =
static const unsigned short ps_names_to_unicode[1059] =
{
0,
0x0020,
@ -1488,7 +1487,7 @@
0x2013,
0x2020,
0x2021,
0,
0x00B7,
0x00B6,
0x2022,
0x201A,
@ -1520,7 +1519,7 @@
0x00BA,
0x00E6,
0x0131,
0,
0x0142,
0x00F8,
0x0153,
0x00DF,
@ -1747,7 +1746,7 @@
0xF6FA,
0xF7F8,
0xF7F9,
0,
0xF7FA,
0xF7FB,
0xF7FC,
0xF7FD,
@ -1777,12 +1776,16 @@
0x0104,
0x01FA,
0x0392,
0x0106,
0xF6CA,
0x010C,
0x0108,
0x010A,
0x03A7,
0x010E,
0x0110,
0x2206,
0x2206,
0xF6CB,
0xF6CC,
0xF6CD,
@ -1798,6 +1801,7 @@
0x0389,
0x20AC,
0x0393,
0x011E,
0x01E6,
0x011C,
0x0122,
@ -1839,6 +1843,8 @@
0x01A0,
0x0150,
0x014C,
0x2126,
0x2126,
0x038F,
0x039F,
0x038C,
@ -1892,6 +1898,8 @@
0x256B,
0x256A,
0x015A,
0x015E,
0x015E,
0x015C,
0x0218,
0x03A3,
@ -1901,7 +1909,6 @@
0x0162,
0x0162,
0x0398,
0xF7FA,
0x016C,
0x01AF,
0x0170,
@ -2180,6 +2187,7 @@
0x232A,
0x0387,
0x0105,
0x2248,
0x01FB,
0x2194,
0x21D4,
@ -2211,7 +2219,9 @@
0xF8FB,
0xF8FA,
0xF8F9,
0x0107,
0x21B5,
0x010D,
0x0109,
0x010B,
0x03C7,
@ -2261,13 +2271,16 @@
0x2640,
0x25A0,
0x25AC,
0x20A3,
0x03B3,
0x011F,
0x01E7,
0x011D,
0x0123,
0x0121,
0x2207,
0x0300,
0x2265,
0x0127,
0x0125,
0x2665,
@ -2276,6 +2289,8 @@
0x012D,
0x0133,
0x012B,
0x221E,
0x222B,
0x2321,
0xF8F5,
0x2320,
@ -2298,12 +2313,14 @@
0x013E,
0x013C,
0x0140,
0x2264,
0x258C,
0x20A4,
0xF6C0,
0x2227,
0x2228,
0x017F,
0x25CA,
0x2591,
0x2642,
0x2032,
@ -2314,6 +2331,7 @@
0x0148,
0x0146,
0x2209,
0x2260,
0x2284,
0x03BD,
0x014F,
@ -2334,17 +2352,21 @@
0xF8F8,
0xF8F7,
0xF8F6,
0x2202,
0x22A5,
0x20A7,
0x03C6,
0x03D5,
0x03C0,
0x211E,
0x220F,
0x2282,
0x2283,
0x221D,
0x03C8,
0x201B,
0x0155,
0x221A,
0xF8E5,
0x0159,
0x0157,
@ -2356,6 +2378,8 @@
0x03C1,
0x2590,
0x015B,
0x015F,
0x015F,
0x015D,
0x0219,
0x2033,
@ -2366,6 +2390,7 @@
0x263A,
0x2660,
0x220B,
0x2211,
0x263C,
0x03C4,
0x0167,
@ -2855,7 +2880,7 @@
312,
0,
0,
312,
313,
0,
0,
314,

View File

@ -33,10 +33,13 @@ import sys, string
# This table is used to name the glyph according to the Macintosh
# specification. It is used by the TrueType Postscript names table
#
# see http://fonts.apple.com/TTRefMan/RM06/Chap6post.html
# for the official list
#
mac_standard_names = \
[
# 0
".notdef", ".null", "CR", "space", "exclam",
".notdef", ".null", "nonmarkingreturn", "space", "exclam",
"quotedbl", "numbersign", "dollar", "percent", "ampersand",
# 10
@ -104,7 +107,7 @@ mac_standard_names = \
"radical", "florin", "approxequal", "Delta", "guillemotleft",
# 170
"guillemotright", "ellipsis", "nbspace", "Agrave", "Atilde",
"guillemotright", "ellipsis", "nonbreakingspace", "Agrave", "Atilde",
"Otilde", "OE", "oe", "endash", "emdash",
# 180
@ -137,12 +140,16 @@ mac_standard_names = \
"onequarter", "threequarters", "franc", "Gbreve", "gbreve",
# 250
"Idot", "Scedilla", "scedilla", "Cacute", "cacute",
"Ccaron", "ccaron", "dmacron"
"Idotaccent", "Scedilla", "scedilla", "Cacute", "cacute",
"Ccaron", "ccaron", "dcroat"
]
t1_standard_strings = \
# the list of standard "SID" glyph names. For the official list,
# see Annex A of document at
# http://partners.adobe.com/asn/developer/pdfs/tn/5176.CFF.pdf
#
sid_standard_names = \
[
# 0
".notdef", "space", "exclam", "quotedbl", "numbersign",
@ -189,7 +196,7 @@ t1_standard_strings = \
"quotedblleft", "guillemotleft", "guilsinglleft", "guilsinglright", "fi",
# 110
"fl", "endash", "dagger", "daggerdbl", "periodcenter",
"fl", "endash", "dagger", "daggerdbl", "periodcentered",
"paragraph", "bullet", "quotesinglbase", "quotedblbase", "quotedblright",
# 120
@ -202,7 +209,7 @@ t1_standard_strings = \
# 140
"Lslash", "Oslash", "OE", "ordmasculine", "ae",
"dotlessi", "Islash", "oslash", "oe", "germandbls",
"dotlessi", "lslash", "oslash", "oe", "germandbls",
# 150
"onesuperior", "logicalnot", "mu", "trademark", "Eth",
@ -309,7 +316,7 @@ t1_standard_strings = \
"Odieresissmall",
# 370
"OEsmall", "Oslashsmall", "Ugravesmall", "Uacautesmall",
"OEsmall", "Oslashsmall", "Ugravesmall", "Uacutesmall",
"Ucircumflexsmall",
"Udieresissmall", "Yacutesmall", "Thornsmall", "Ydieresissmall",
"001.000",
@ -323,6 +330,9 @@ t1_standard_strings = \
]
# this table maps character code of the Adobe Standard Type 1
# encoding to glyph indexes in the sid_standard_names table
#
t1_standard_encoding = \
[
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@ -359,6 +369,9 @@ t1_standard_encoding = \
]
# this table maps character code of the Adobe Expert Type 1
# encoding to glyph indexes in the sid_standard_names table
#
t1_expert_encoding = \
[
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@ -381,7 +394,7 @@ t1_expert_encoding = \
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 304, 305, 306, 0, 0, 307, 308, 309, 310,
311, 0, 312, 0, 0, 312, 0, 0, 314, 315,
311, 0, 312, 0, 0, 313, 0, 0, 314, 315,
0, 0, 316, 317, 318, 0, 0, 0, 158, 155,
163, 319, 320, 321, 322, 323, 324, 325, 0, 0,
@ -1459,8 +1472,8 @@ t1_bias = 0
glyph_list = []
def the_adobe_glyph_list():
"""return the list of glyph names in the adobe list"""
def adobe_glyph_names():
"""return the list of glyph names from the adobe list"""
lines = string.split( adobe_glyph_list, '\n' )
glyphs = []
@ -1474,8 +1487,8 @@ def the_adobe_glyph_list():
return glyphs
def the_adobe_glyphs():
"""return the list of unicode values"""
def adobe_glyph_values():
"""return the list of glyph names and their unicode values"""
lines = string.split( adobe_glyph_list, '\n' )
glyphs = []
@ -1516,7 +1529,7 @@ def dump_mac_indices( file, t1_bias ):
count = 0
for name in mac_standard_names:
try:
t1_index = t1_standard_strings.index( name )
t1_index = sid_standard_names.index( name )
write( " " + repr( t1_bias + t1_index ) + ",\n" )
except:
write( " " + repr( count ) + ",\n" )
@ -1533,7 +1546,7 @@ def dump_glyph_list( file, glyph_list, adobe_extra ):
name_list = []
write( " static const char* const standard_glyph_names[] =\n" )
write( " static const char* const ps_glyph_names[] =\n" )
write( " {\n" )
for name in glyph_list:
@ -1551,7 +1564,7 @@ def dump_glyph_list( file, glyph_list, adobe_extra ):
write( "\n" )
write( "#endif /* FT_CONFIG_OPTION_ADOBE_GLYPH_LIST */\n" )
write( "\n" )
write( " 0\n" )
write( " NULL\n" )
write( " };\n" )
write( "\n" )
write( "\n" )
@ -1564,16 +1577,16 @@ def dump_unicode_values( file, base_list, adobe_list ):
write = file.write
adobe_glyphs, uni_values = the_adobe_glyphs()
glyph_names, uni_values = adobe_glyph_values()
write( "\n" )
write( " static const unsigned short names_to_unicode[" + \
write( " static const unsigned short ps_names_to_unicode[" + \
repr( len( base_list ) + len( adobe_list ) + 1 ) + "] =\n" )
write( " {\n" )
for name in base_list:
try:
index = adobe_glyphs.index( name )
index = glyph_names.index( name )
write( " 0x" + uni_values[index] + ",\n" )
except:
write( " 0,\n" )
@ -1584,7 +1597,7 @@ def dump_unicode_values( file, base_list, adobe_list ):
for name in adobe_list:
try:
index = adobe_glyphs.index( name )
index = glyph_names.index( name )
write( " 0x" + uni_values[index] + ",\n" )
except:
write( " 0,\n" )
@ -1625,16 +1638,16 @@ def main():
file = open( sys.argv[1], "w\n" )
write = file.write
count_sid = len( t1_standard_strings )
count_sid = len( sid_standard_names )
# build mac index table & supplemental glyph names
mac_list = count_extra_glyphs( mac_standard_names, t1_standard_strings )
mac_list = count_extra_glyphs( mac_standard_names, adobe_glyph_names() )
count_mac = len( mac_list )
t1_bias = count_mac
base_list = mac_list + t1_standard_strings
base_list = mac_list + sid_standard_names
# build adobe unicode index table & supplemental glyph names
adobe_list = the_adobe_glyph_list()
adobe_list = adobe_glyph_names()
adobe_list = count_extra_glyphs( adobe_list, base_list )
count_adobe = len( adobe_list )
@ -1646,7 +1659,7 @@ def main():
write( "/* */\n" )
write( "/* PostScript glyph names (specification only). */\n" )
write( "/* */\n" )
write( "/* Copyright 2000 by */\n" )
write( "/* Copyright 2000-2001 by */\n" )
write( "/* David Turner, Robert Wilhelm, and Werner Lemberg. */\n" )
write( "/* */\n" )
write( "/* This file is part of the FreeType project, and may only be used, */\n" )
@ -1666,12 +1679,12 @@ def main():
name_list = dump_glyph_list( file, base_list, adobe_list )
# dump t1_standard_list
write( " static const char* const * const t1_standard_glyphs = " \
+ "standard_glyph_names + " + repr( t1_bias ) + ";\n" )
write( " static const char* const * const sid_standard_names = " \
+ "ps_glyph_names + " + repr( t1_bias ) + ";\n" )
write( "\n" )
write( "\n" )
write( "#define NUM_STD_GLYPHS " + repr( len( t1_standard_strings ) ) + "\n" )
write( "#define NUM_SID_GLYPHS " + repr( len( sid_standard_names ) ) + "\n" )
write( "\n" )
write( "#ifdef FT_CONFIG_OPTION_ADOBE_GLYPH_LIST\n" )
write( "#define NUM_ADOBE_GLYPHS " + \