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