update for HEAD-2003050101
[reactos.git] / lib / freetype / include / freetype / internal / psnames.h
1 /***************************************************************************/
2 /*                                                                         */
3 /*  psnames.h                                                              */
4 /*                                                                         */
5 /*    High-level interface for the `PSNames' module (in charge of          */
6 /*    various functions related to Postscript glyph names conversion).     */
7 /*                                                                         */
8 /*  Copyright 1996-2001, 2002 by                                           */
9 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
10 /*                                                                         */
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.                                        */
16 /*                                                                         */
17 /***************************************************************************/
18
19
20 #ifndef __PSNAMES_H__
21 #define __PSNAMES_H__
22
23
24 #include <ft2build.h>
25 #include FT_FREETYPE_H
26
27
28 FT_BEGIN_HEADER
29
30
31   /*************************************************************************/
32   /*                                                                       */
33   /* <FuncType>                                                            */
34   /*    PS_Unicode_Value_Func                                              */
35   /*                                                                       */
36   /* <Description>                                                         */
37   /*    A function used to return the Unicode index corresponding to a     */
38   /*    given glyph name.                                                  */
39   /*                                                                       */
40   /* <Input>                                                               */
41   /*    glyph_name :: The glyph name.                                      */
42   /*                                                                       */
43   /* <Return>                                                              */
44   /*    The Unicode character index resp. the non-Unicode value 0xFFFF if  */
45   /*    the glyph name has no known Unicode meaning.                       */
46   /*                                                                       */
47   /* <Note>                                                                */
48   /*    This function is able to map several different glyph names to the  */
49   /*    same Unicode value, according to the rules defined in the Adobe    */
50   /*    Glyph List table.                                                  */
51   /*                                                                       */
52   /*    This function will not be compiled if the configuration macro      */
53   /*    FT_CONFIG_OPTION_ADOBE_GLYPH_LIST is undefined.                    */
54   /*                                                                       */
55   typedef FT_UInt32
56   (*PS_Unicode_Value_Func)( const char*  glyph_name );
57
58
59   /*************************************************************************/
60   /*                                                                       */
61   /* <FuncType>                                                            */
62   /*    PS_Unicode_Index_Func                                              */
63   /*                                                                       */
64   /* <Description>                                                         */
65   /*    A function used to return the glyph index corresponding to a given */
66   /*    Unicode value.                                                     */
67   /*                                                                       */
68   /* <Input>                                                               */
69   /*    num_glyphs  :: The number of glyphs in the face.                   */
70   /*                                                                       */
71   /*    glyph_names :: An array of glyph name pointers.                    */
72   /*                                                                       */
73   /*    unicode     :: The Unicode value.                                  */
74   /*                                                                       */
75   /* <Return>                                                              */
76   /*    The glyph index resp. 0xFFFF if no glyph corresponds to this       */
77   /*    Unicode value.                                                     */
78   /*                                                                       */
79   /* <Note>                                                                */
80   /*    This function is able to recognize several glyph names per Unicode */
81   /*    value, according to the Adobe Glyph List.                          */
82   /*                                                                       */
83   /*    This function will not be compiled if the configuration macro      */
84   /*    FT_CONFIG_OPTION_ADOBE_GLYPH_LIST is undefined.                    */
85   /*                                                                       */
86   typedef FT_UInt
87   (*PS_Unicode_Index_Func)( FT_UInt       num_glyphs,
88                             const char**  glyph_names,
89                             FT_ULong      unicode );
90
91
92   /*************************************************************************/
93   /*                                                                       */
94   /* <FuncType>                                                            */
95   /*    PS_Macintosh_Name_Func                                             */
96   /*                                                                       */
97   /* <Description>                                                         */
98   /*    A function used to return the glyph name corresponding to an Apple */
99   /*    glyph name index.                                                  */
100   /*                                                                       */
101   /* <Input>                                                               */
102   /*    name_index :: The index of the Mac name.                           */
103   /*                                                                       */
104   /* <Return>                                                              */
105   /*    The glyph name, or 0 if the index is invalid.                      */
106   /*                                                                       */
107   /* <Note>                                                                */
108   /*    This function will not be compiled if the configuration macro      */
109   /*    FT_CONFIG_OPTION_POSTSCRIPT_NAMES is undefined.                    */
110   /*                                                                       */
111   typedef const char*
112   (*PS_Macintosh_Name_Func)( FT_UInt  name_index );
113
114
115   typedef const char*
116   (*PS_Adobe_Std_Strings_Func)( FT_UInt  string_index );
117
118
119   typedef struct  PS_UniMap_
120   {
121     FT_UInt  unicode;
122     FT_UInt  glyph_index;
123
124   } PS_UniMap;
125
126
127   /*************************************************************************/
128   /*                                                                       */
129   /* <Struct>                                                              */
130   /*    PS_Unicodes                                                        */
131   /*                                                                       */
132   /* <Description>                                                         */
133   /*    A simple table used to map Unicode values to glyph indices.  It is */
134   /*    built by the PS_Build_Unicodes table according to the glyphs       */
135   /*    present in a font file.                                            */
136   /*                                                                       */
137   /* <Fields>                                                              */
138   /*    num_codes :: The number of glyphs in the font that match a given   */
139   /*                 Unicode value.                                        */
140   /*                                                                       */
141   /*    unicodes  :: An array of unicode values, sorted in increasing      */
142   /*                 order.                                                */
143   /*                                                                       */
144   /*    gindex    :: An array of glyph indices, corresponding to each      */
145   /*                 Unicode value.                                        */
146   /*                                                                       */
147   /* <Note>                                                                */
148   /*    Use the function PS_Lookup_Unicode() to retrieve the glyph index   */
149   /*    corresponding to a given Unicode character code.                   */
150   /*                                                                       */
151   typedef struct  PS_Unicodes_
152   {
153     FT_UInt     num_maps;
154     PS_UniMap*  maps;
155
156   } PS_Unicodes;
157
158
159   typedef FT_Error
160   (*PS_Build_Unicodes_Func)( FT_Memory     memory,
161                              FT_UInt       num_glyphs,
162                              const char**  glyph_names,
163                              PS_Unicodes*  unicodes );
164
165   typedef FT_UInt
166   (*PS_Lookup_Unicode_Func)( PS_Unicodes*  unicodes,
167                              FT_UInt       unicode );
168
169   typedef FT_ULong
170   (*PS_Next_Unicode_Func)( PS_Unicodes*  unicodes,
171                            FT_ULong      unicode );
172
173
174   /*************************************************************************/
175   /*                                                                       */
176   /* <Struct>                                                              */
177   /*    PSNames_Interface                                                  */
178   /*                                                                       */
179   /* <Description>                                                         */
180   /*    This structure defines the PSNames interface.                      */
181   /*                                                                       */
182   /* <Fields>                                                              */
183   /*    unicode_value         :: A function used to convert a glyph name   */
184   /*                             into a Unicode character code.            */
185   /*                                                                       */
186   /*    build_unicodes        :: A function which builds up the Unicode    */
187   /*                             mapping table.                            */
188   /*                                                                       */
189   /*    lookup_unicode        :: A function used to return the glyph index */
190   /*                             corresponding to a given Unicode          */
191   /*                             character.                                */
192   /*                                                                       */
193   /*    macintosh_name        :: A function used to return the standard    */
194   /*                             Apple glyph Postscript name corresponding */
195   /*                             to a given string index (used by the      */
196   /*                             TrueType `post' table).                   */
197   /*                                                                       */
198   /*    adobe_std_strings     :: A function that returns a pointer to a    */
199   /*                             Adobe Standard String for a given SID.    */
200   /*                                                                       */
201   /*    adobe_std_encoding    :: A table of 256 unsigned shorts that maps  */
202   /*                             character codes in the Adobe Standard     */
203   /*                             Encoding to SIDs.                         */
204   /*                                                                       */
205   /*    adobe_expert_encoding :: A table of 256 unsigned shorts that maps  */
206   /*                             character codes in the Adobe Expert       */
207   /*                             Encoding to SIDs.                         */
208   /*                                                                       */
209   /* <Note>                                                                */
210   /*    `unicode_value' and `unicode_index' will be set to 0 if the        */
211   /*    configuration macro FT_CONFIG_OPTION_ADOBE_GLYPH_LIST is           */
212   /*    undefined.                                                         */
213   /*                                                                       */
214   /*    `macintosh_name' will be set to 0 if the configuration macro       */
215   /*    FT_CONFIG_OPTION_POSTSCRIPT_NAMES is undefined.                    */
216   /*                                                                       */
217   typedef struct  PSNames_Interface_
218   {
219     PS_Unicode_Value_Func      unicode_value;
220     PS_Build_Unicodes_Func     build_unicodes;
221     PS_Lookup_Unicode_Func     lookup_unicode;
222     PS_Macintosh_Name_Func     macintosh_name;
223
224     PS_Adobe_Std_Strings_Func  adobe_std_strings;
225     const unsigned short*      adobe_std_encoding;
226     const unsigned short*      adobe_expert_encoding;
227
228     PS_Next_Unicode_Func       next_unicode;
229
230   } PSNames_Interface;
231
232
233   typedef PSNames_Interface*  PSNames_Service;
234
235
236 FT_END_HEADER
237
238 #endif /* __PSNAMES_H__ */
239
240
241 /* END */