4 |
/* */ |
/* */ |
5 |
/* FreeType charmap cache (specification). */ |
/* FreeType charmap cache (specification). */ |
6 |
/* */ |
/* */ |
7 |
/* Copyright 2000-2001, 2003 by */ |
/* Copyright 2000-2001, 2003, 2005 by */ |
8 |
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ |
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ |
9 |
/* */ |
/* */ |
10 |
/* This file is part of the FreeType project, and may only be used, */ |
/* This file is part of the FreeType project, and may only be used, */ |
29 |
/*************************************************************************/ |
/*************************************************************************/ |
30 |
/* */ |
/* */ |
31 |
/* <Section> */ |
/* <Section> */ |
32 |
/* cache_subsystem */ |
/* cache_subsystem */ |
33 |
/* */ |
/* */ |
34 |
/*************************************************************************/ |
/*************************************************************************/ |
35 |
|
|
36 |
/*************************************************************************/ |
/************************************************************************* |
37 |
/* */ |
* |
38 |
/* @type: */ |
* @type: |
39 |
/* FTC_CMapCache */ |
* FTC_CMapCache |
40 |
/* */ |
* |
41 |
/* @description: */ |
* @description: |
42 |
/* An opaque handle used to manager a charmap cache. This cache is */ |
* An opaque handle used to manager a charmap cache. This cache is to |
43 |
/* to hold character codes -> glyph indices mappings. */ |
* hold character codes -> glyph indices mappings. |
44 |
/* */ |
* |
45 |
|
*/ |
46 |
typedef struct FTC_CMapCacheRec_* FTC_CMapCache; |
typedef struct FTC_CMapCacheRec_* FTC_CMapCache; |
47 |
|
|
48 |
|
|
49 |
/*************************************************************************/ |
/************************************************************************* |
50 |
/* */ |
* |
51 |
/* @type: */ |
* @type: |
52 |
/* FTC_CMapDesc */ |
* FTC_CMapDesc |
53 |
/* */ |
* |
54 |
/* @description: */ |
* @description: |
55 |
/* A handle to an @FTC_CMapDescRec structure used to describe a given */ |
* A handle to an @FTC_CMapDescRec structure used to describe a given |
56 |
/* charmap in a charmap cache. */ |
* charmap in a charmap cache. |
57 |
/* */ |
* |
58 |
/* Each @FTC_CMapDesc describes which charmap (of which @FTC_FaceID) */ |
* Each @FTC_CMapDesc describes which charmap (of which @FTC_FaceID) we |
59 |
/* we want to use in @FTC_CMapCache_Lookup. */ |
* want to use in @FTC_CMapCache_Lookup. |
60 |
/* */ |
* |
61 |
|
*/ |
62 |
typedef struct FTC_CMapDescRec_* FTC_CMapDesc; |
typedef struct FTC_CMapDescRec_* FTC_CMapDesc; |
63 |
|
|
64 |
|
|
65 |
/*************************************************************************/ |
/************************************************************************* |
66 |
/* */ |
* |
67 |
/* @enum: */ |
* @enum: |
68 |
/* FTC_CMapType */ |
* FTC_CMapType |
69 |
/* */ |
* |
70 |
/* @description: */ |
* @description: |
71 |
/* The list of valid @FTC_CMapDesc types. They indicate how we want */ |
* The list of valid @FTC_CMapDesc types. They indicate how we want to |
72 |
/* to address a charmap within an @FTC_FaceID. */ |
* address a charmap within an @FTC_FaceID. |
73 |
/* */ |
* |
74 |
/* @values: */ |
* @values: |
75 |
/* FTC_CMAP_BY_INDEX :: */ |
* FTC_CMAP_BY_INDEX :: |
76 |
/* Address a charmap by its index in the corresponding @FT_Face. */ |
* Address a charmap by its index in the corresponding @FT_Face. |
77 |
/* */ |
* |
78 |
/* FTC_CMAP_BY_ENCODING :: */ |
* FTC_CMAP_BY_ENCODING :: |
79 |
/* Use a @FT_Face charmap that corresponds to a given encoding. */ |
* Use a @FT_Face charmap that corresponds to a given encoding. |
80 |
/* */ |
* |
81 |
/* FTC_CMAP_BY_ID :: */ |
* FTC_CMAP_BY_ID :: |
82 |
/* Use an @FT_Face charmap that corresponds to a given */ |
* Use an @FT_Face charmap that corresponds to a given |
83 |
/* (platform,encoding) ID. See @FTC_CMapIdRec. */ |
* (platform,encoding) ID. See @FTC_CMapIdRec. |
84 |
/* */ |
* |
85 |
|
*/ |
86 |
typedef enum FTC_CMapType_ |
typedef enum FTC_CMapType_ |
87 |
{ |
{ |
88 |
FTC_CMAP_BY_INDEX = 0, |
FTC_CMAP_BY_INDEX = 0, |
92 |
} FTC_CMapType; |
} FTC_CMapType; |
93 |
|
|
94 |
|
|
95 |
/*************************************************************************/ |
/************************************************************************* |
96 |
/* */ |
* |
97 |
/* @struct: */ |
* @struct: |
98 |
/* FTC_CMapIdRec */ |
* FTC_CMapIdRec |
99 |
/* */ |
* |
100 |
/* @description: */ |
* @description: |
101 |
/* A short structure to identify a charmap by a (platform,encoding) */ |
* A short structure to identify a charmap by a (platform,encoding) pair |
102 |
/* pair of values. */ |
* of values. |
103 |
/* */ |
* |
104 |
/* @fields: */ |
* @fields: |
105 |
/* platform :: The platform ID. */ |
* platform :: |
106 |
/* */ |
* The platform ID. |
107 |
/* encoding :: The encoding ID. */ |
* |
108 |
/* */ |
* encoding :: |
109 |
|
* The encoding ID. |
110 |
|
* |
111 |
|
*/ |
112 |
typedef struct FTC_CMapIdRec_ |
typedef struct FTC_CMapIdRec_ |
113 |
{ |
{ |
114 |
FT_UInt platform; |
FT_UInt platform; |
117 |
} FTC_CMapIdRec; |
} FTC_CMapIdRec; |
118 |
|
|
119 |
|
|
120 |
/*************************************************************************/ |
/************************************************************************* |
121 |
/* */ |
* |
122 |
/* @struct: */ |
* @struct: |
123 |
/* FTC_CMapDescRec */ |
* FTC_CMapDescRec |
124 |
/* */ |
* |
125 |
/* @description: */ |
* @description: |
126 |
/* A structure to describe a given charmap to @FTC_CMapCache. */ |
* A structure to describe a given charmap to @FTC_CMapCache. |
127 |
/* */ |
* |
128 |
/* @fields: */ |
* @fields: |
129 |
/* face_id :: @FTC_FaceID of the face this charmap belongs to. */ |
* face_id :: |
130 |
/* */ |
* @FTC_FaceID of the face this charmap belongs to. |
131 |
/* type :: The type of charmap, see @FTC_CMapType. */ |
* |
132 |
/* */ |
* type :: |
133 |
/* u.index :: For @FTC_CMAP_BY_INDEX types, this is the charmap */ |
* The type of charmap, see @FTC_CMapType. |
134 |
/* index (within a @FT_Face) we want to use. */ |
* |
135 |
/* */ |
* u.index :: |
136 |
/* u.encoding :: For @FTC_CMAP_BY_ENCODING types, this is the charmap */ |
* For @FTC_CMAP_BY_INDEX types, this is the charmap index (within a |
137 |
/* encoding we want to use. see @FT_Encoding. */ |
* @FT_Face) we want to use. |
138 |
/* */ |
* |
139 |
/* u.id :: For @FTC_CMAP_BY_ID types, this is the */ |
* u.encoding :: |
140 |
/* (platform,encoding) pair we want to use. see */ |
* For @FTC_CMAP_BY_ENCODING types, this is the charmap encoding we |
141 |
/* @FTC_CMapIdRec and @FT_CharMapRec. */ |
* want to use. see @FT_Encoding. |
142 |
/* */ |
* |
143 |
|
* u.id :: |
144 |
|
* For @FTC_CMAP_BY_ID types, this is the (platform,encoding) pair we |
145 |
|
* want to use. see @FTC_CMapIdRec and @FT_CharMapRec. |
146 |
|
* |
147 |
|
*/ |
148 |
typedef struct FTC_CMapDescRec_ |
typedef struct FTC_CMapDescRec_ |
149 |
{ |
{ |
150 |
FTC_FaceID face_id; |
FTC_FaceID face_id; |
161 |
} FTC_CMapDescRec; |
} FTC_CMapDescRec; |
162 |
|
|
163 |
|
|
164 |
/*************************************************************************/ |
/************************************************************************* |
165 |
/* */ |
* |
166 |
/* @function: */ |
* @function: |
167 |
/* FTC_CMapCache_New */ |
* FTC_CMapCache_New |
168 |
/* */ |
* |
169 |
/* @description: */ |
* @description: |
170 |
/* Creates a new charmap cache. */ |
* Creates a new charmap cache. |
171 |
/* */ |
* |
172 |
/* @input: */ |
* @input: |
173 |
/* manager :: A handle to the cache manager. */ |
* manager :: |
174 |
/* */ |
* A handle to the cache manager. |
175 |
/* @output: */ |
* |
176 |
/* acache :: A new cache handle. NULL in case of error. */ |
* @output: |
177 |
/* */ |
* acache :: |
178 |
/* @return: */ |
* A new cache handle. NULL in case of error. |
179 |
/* FreeType error code. 0 means success. */ |
* |
180 |
/* */ |
* @return: |
181 |
/* @note: */ |
* FreeType error code. 0 means success. |
182 |
/* Like all other caches, this one will be destroyed with the cache */ |
* |
183 |
/* manager. */ |
* @note: |
184 |
/* */ |
* Like all other caches, this one will be destroyed with the cache |
185 |
|
* manager. |
186 |
|
* |
187 |
|
*/ |
188 |
FT_EXPORT( FT_Error ) |
FT_EXPORT( FT_Error ) |
189 |
FTC_CMapCache_New( FTC_Manager manager, |
FTC_CMapCache_New( FTC_Manager manager, |
190 |
FTC_CMapCache *acache ); |
FTC_CMapCache *acache ); |
191 |
|
|
192 |
|
|
193 |
/*************************************************************************/ |
/************************************************************************* |
194 |
/* */ |
* |
195 |
/* @function: */ |
* @function: |
196 |
/* FTC_CMapCache_Lookup */ |
* FTC_CMapCache_Lookup |
197 |
/* */ |
* |
198 |
/* @description: */ |
* @description: |
199 |
/* Translates a character code into a glyph index, using the charmap */ |
* Translates a character code into a glyph index, using the charmap |
200 |
/* cache. */ |
* cache. |
201 |
/* */ |
* |
202 |
/* @input: */ |
* @input: |
203 |
/* cache :: A charmap cache handle. */ |
* cache :: |
204 |
/* */ |
* A charmap cache handle. |
205 |
/* cmap_desc :: A charmap descriptor handle. */ |
* |
206 |
/* */ |
* cmap_desc :: |
207 |
/* char_code :: The character code (in the corresponding charmap). */ |
* A charmap descriptor handle. |
208 |
/* */ |
* |
209 |
/* @return: */ |
* char_code :: |
210 |
/* Glyph index. 0 means "no glyph". */ |
* The character code (in the corresponding charmap). |
211 |
/* */ |
* |
212 |
/* @note: */ |
* @return: |
213 |
/* This function doesn't return @FTC_Node handles, since there is no */ |
* Glyph index. 0 means `no glyph'. |
214 |
/* real use for them with typical uses of charmaps. */ |
* |
215 |
/* */ |
* @note: |
216 |
|
* This function doesn't return @FTC_Node handles, since there is no |
217 |
|
* real use for them with typical uses of charmaps. |
218 |
|
* |
219 |
|
*/ |
220 |
FT_EXPORT( FT_UInt ) |
FT_EXPORT( FT_UInt ) |
221 |
FTC_CMapCache_Lookup( FTC_CMapCache cache, |
FTC_CMapCache_Lookup( FTC_CMapCache cache, |
222 |
FTC_CMapDesc cmap_desc, |
FTC_CMapDesc cmap_desc, |