1 /***************************************************************************/
5 /* High-level interface for the `PSNames' module (in charge of */
6 /* various functions related to Postscript glyph names conversion). */
8 /* Copyright 1996-2000 by */
9 /* David Turner, Robert Wilhelm, and Werner Lemberg. */
11 /* This file is part of the FreeType project, and may only be used, */
12 /* modified, and distributed under the terms of the FreeType project */
13 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */
14 /* this file you indicate that you have read the license and */
15 /* understand and accept it fully. */
17 /***************************************************************************/
24 #include <freetype/freetype.h>
27 /*************************************************************************/
30 /* PS_Unicode_Value_Func */
33 /* A function used to return the Unicode index corresponding to a */
34 /* given glyph name. */
37 /* glyph_name :: The glyph name. */
40 /* The Unicode character index resp. the non-Unicode value 0xFFFF if */
41 /* the glyph name has no known Unicode meaning. */
44 /* This function is able to map several different glyph names to the */
45 /* same Unicode value, according to the rules defined in the Adobe */
46 /* Glyph List table. */
48 /* This function will not be compiled if the configuration macro */
49 /* FT_CONFIG_OPTION_ADOBE_GLYPH_LIST is undefined. */
51 typedef FT_ULong (*PS_Unicode_Value_Func)( const char* glyph_name );
54 /*************************************************************************/
57 /* PS_Unicode_Index_Func */
60 /* A function used to return the glyph index corresponding to a given */
64 /* num_glyphs :: The number of glyphs in the face. */
66 /* glyph_names :: An array of glyph name pointers. */
68 /* unicode :: The Unicode value. */
71 /* The glyph index resp. 0xFFFF if no glyph corresponds to this */
75 /* This function is able to recognize several glyph names per Unicode */
76 /* value, according to the Adobe Glyph List. */
78 /* This function will not be compiled if the configuration macro */
79 /* FT_CONFIG_OPTION_ADOBE_GLYPH_LIST is undefined. */
81 typedef FT_UInt (*PS_Unicode_Index_Func)( FT_UInt num_glyphs,
82 const char** glyph_names,
86 /*************************************************************************/
89 /* PS_Macintosh_Name_Func */
92 /* A function used to return the glyph name corresponding to an Apple */
93 /* glyph name index. */
96 /* name_index :: The index of the Mac name. */
99 /* The glyph name, or 0 if the index is invalid. */
102 /* This function will not be compiled if the configuration macro */
103 /* FT_CONFIG_OPTION_POSTSCRIPT_NAMES is undefined. */
105 typedef const char* (*PS_Macintosh_Name_Func)( FT_UInt name_index );
108 typedef const char* (*PS_Adobe_Std_Strings_Func)( FT_UInt string_index );
111 typedef struct PS_UniMap_
119 /*************************************************************************/
125 /* A simple table used to map Unicode values to glyph indices. It is */
126 /* built by the PS_Build_Unicodes table according to the glyphs */
127 /* present in a font file. */
130 /* num_codes :: The number of glyphs in the font that match a given */
133 /* unicodes :: An array of unicode values, sorted in increasing */
136 /* gindex :: An array of glyph indices, corresponding to each */
140 /* Use the function PS_Lookup_Unicode() to retrieve the glyph index */
141 /* corresponding to a given Unicode character code. */
143 typedef struct PS_Unicodes_
151 typedef FT_Error (*PS_Build_Unicodes_Func)( FT_Memory memory,
153 const char** glyph_names,
154 PS_Unicodes* unicodes );
156 typedef FT_UInt (*PS_Lookup_Unicode_Func)( PS_Unicodes* unicodes,
160 /*************************************************************************/
163 /* PSNames_Interface */
166 /* This structure defines the PSNames interface. */
169 /* unicode_value :: A function used to convert a glyph name */
170 /* into a Unicode character code. */
172 /* build_unicodes :: A function which builds up the Unicode */
175 /* lookup_unicode :: A function used to return the glyph index */
176 /* corresponding to a given Unicode */
179 /* macintosh_name :: A function used to return the standard */
180 /* Apple glyph Postscript name corresponding */
181 /* to a given string index (used by the */
182 /* TrueType `post' table). */
184 /* adobe_std_strings :: A function that returns a pointer to a */
185 /* Adobe Standard String for a given SID. */
187 /* adobe_std_encoding :: A table of 256 unsigned shorts that maps */
188 /* character codes in the Adobe Standard */
189 /* Encoding to SIDs. */
191 /* adobe_expert_encoding :: A table of 256 unsigned shorts that maps */
192 /* character codes in the Adobe Expert */
193 /* Encoding to SIDs. */
196 /* `unicode_value' and `unicode_index' will be set to 0 if the */
197 /* configuration macro FT_CONFIG_OPTION_ADOBE_GLYPH_LIST is */
200 /* `macintosh_name' will be set to 0 if the configuration macro */
201 /* FT_CONFIG_OPTION_POSTSCRIPT_NAMES is undefined. */
203 typedef struct PSNames_Interface_
205 PS_Unicode_Value_Func unicode_value;
206 PS_Build_Unicodes_Func build_unicodes;
207 PS_Lookup_Unicode_Func lookup_unicode;
208 PS_Macintosh_Name_Func macintosh_name;
210 PS_Adobe_Std_Strings_Func adobe_std_strings;
211 const unsigned short* adobe_std_encoding;
212 const unsigned short* adobe_expert_encoding;
217 #endif /* PSNAMES_H */