1 /***************************************************************************/
5 /* FreeType charmap cache (specification). */
7 /* Copyright 2000-2001, 2003 by */
8 /* David Turner, Robert Wilhelm, and Werner Lemberg. */
10 /* This file is part of the FreeType project, and may only be used, */
11 /* modified, and distributed under the terms of the FreeType project */
12 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */
13 /* this file you indicate that you have read the license and */
14 /* understand and accept it fully. */
16 /***************************************************************************/
29 /*************************************************************************/
34 /*************************************************************************/
36 /*************************************************************************/
42 /* An opaque handle used to manager a charmap cache. This cache is */
43 /* to hold character codes -> glyph indices mappings. */
45 typedef struct FTC_CMapCacheRec_* FTC_CMapCache;
48 /*************************************************************************/
54 /* A handle to an @FTC_CMapDescRec structure used to describe a given */
55 /* charmap in a charmap cache. */
57 /* Each @FTC_CMapDesc describes which charmap (of which @FTC_FaceID) */
58 /* we want to use in @FTC_CMapCache_Lookup. */
60 typedef struct FTC_CMapDescRec_* FTC_CMapDesc;
63 /*************************************************************************/
69 /* The list of valid @FTC_CMapDesc types. They indicate how we want */
70 /* to address a charmap within an @FTC_FaceID. */
73 /* FTC_CMAP_BY_INDEX :: */
74 /* Address a charmap by its index in the corresponding @FT_Face. */
76 /* FTC_CMAP_BY_ENCODING :: */
77 /* Use a @FT_Face charmap that corresponds to a given encoding. */
79 /* FTC_CMAP_BY_ID :: */
80 /* Use an @FT_Face charmap that corresponds to a given */
81 /* (platform,encoding) ID. See @FTC_CMapIdRec. */
83 typedef enum FTC_CMapType_
85 FTC_CMAP_BY_INDEX = 0,
86 FTC_CMAP_BY_ENCODING = 1,
92 /*************************************************************************/
98 /* A short structure to identify a charmap by a (platform,encoding) */
102 /* platform :: The platform ID. */
104 /* encoding :: The encoding ID. */
106 typedef struct FTC_CMapIdRec_
114 /*************************************************************************/
117 /* FTC_CMapDescRec */
120 /* A structure to describe a given charmap to @FTC_CMapCache. */
123 /* face_id :: @FTC_FaceID of the face this charmap belongs to. */
125 /* type :: The type of charmap, see @FTC_CMapType. */
127 /* u.index :: For @FTC_CMAP_BY_INDEX types, this is the charmap */
128 /* index (within a @FT_Face) we want to use. */
130 /* u.encoding :: For @FTC_CMAP_BY_ENCODING types, this is the charmap */
131 /* encoding we want to use. see @FT_Encoding. */
133 /* u.id :: For @FTC_CMAP_BY_ID types, this is the */
134 /* (platform,encoding) pair we want to use. see */
135 /* @FTC_CMapIdRec and @FT_CharMapRec. */
137 typedef struct FTC_CMapDescRec_
145 FT_Encoding encoding;
153 /*************************************************************************/
156 /* FTC_CMapCache_New */
159 /* Creates a new charmap cache. */
162 /* manager :: A handle to the cache manager. */
165 /* acache :: A new cache handle. NULL in case of error. */
168 /* FreeType error code. 0 means success. */
171 /* Like all other caches, this one will be destroyed with the cache */
174 FT_EXPORT( FT_Error )
175 FTC_CMapCache_New( FTC_Manager manager,
176 FTC_CMapCache *acache );
179 /*************************************************************************/
182 /* FTC_CMapCache_Lookup */
185 /* Translates a character code into a glyph index, using the charmap */
189 /* cache :: A charmap cache handle. */
191 /* cmap_desc :: A charmap descriptor handle. */
193 /* char_code :: The character code (in the corresponding charmap). */
196 /* Glyph index. 0 means "no glyph". */
199 /* This function doesn't return @FTC_Node handles, since there is no */
200 /* real use for them with typical uses of charmaps. */
203 FTC_CMapCache_Lookup( FTC_CMapCache cache,
204 FTC_CMapDesc cmap_desc,
205 FT_UInt32 char_code );
213 #endif /* __FTCCMAP_H__ */