]>
Commit | Line | Data |
---|---|---|
7407ac7f BB |
1 | /***************************************************************************/ |
2 | /* */ | |
3 | /* ftotval.h */ | |
4 | /* */ | |
5 | /* FreeType API for validating OpenType tables (specification). */ | |
6 | /* */ | |
7 | /* Copyright 2004, 2005, 2006, 2007 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 | /***************************************************************************/ | |
20 | /* */ | |
21 | /* */ | |
22 | /* Warning: This module might be moved to a different library in the */ | |
23 | /* future to avoid a tight dependency between FreeType and the */ | |
24 | /* OpenType specification. */ | |
25 | /* */ | |
26 | /* */ | |
27 | /***************************************************************************/ | |
28 | ||
29 | ||
30 | #ifndef __FTOTVAL_H__ | |
31 | #define __FTOTVAL_H__ | |
32 | ||
33 | #include <ft2build.h> | |
34 | #include FT_FREETYPE_H | |
35 | ||
36 | #ifdef FREETYPE_H | |
37 | #error "freetype.h of FreeType 1 has been loaded!" | |
38 | #error "Please fix the directory search order for header files" | |
39 | #error "so that freetype.h of FreeType 2 is found first." | |
40 | #endif | |
41 | ||
42 | ||
43 | FT_BEGIN_HEADER | |
44 | ||
45 | ||
46 | /*************************************************************************/ | |
47 | /* */ | |
48 | /* <Section> */ | |
49 | /* ot_validation */ | |
50 | /* */ | |
51 | /* <Title> */ | |
52 | /* OpenType Validation */ | |
53 | /* */ | |
54 | /* <Abstract> */ | |
55 | /* An API to validate OpenType tables. */ | |
56 | /* */ | |
57 | /* <Description> */ | |
58 | /* This section contains the declaration of functions to validate */ | |
59 | /* some OpenType tables (BASE, GDEF, GPOS, GSUB, JSTF, MATH). */ | |
60 | /* */ | |
61 | /*************************************************************************/ | |
62 | ||
63 | ||
64 | /********************************************************************** | |
65 | * | |
66 | * @enum: | |
67 | * FT_VALIDATE_OTXXX | |
68 | * | |
69 | * @description: | |
70 | * A list of bit-field constants used with @FT_OpenType_Validate to | |
71 | * indicate which OpenType tables should be validated. | |
72 | * | |
73 | * @values: | |
74 | * FT_VALIDATE_BASE :: | |
75 | * Validate BASE table. | |
76 | * | |
77 | * FT_VALIDATE_GDEF :: | |
78 | * Validate GDEF table. | |
79 | * | |
80 | * FT_VALIDATE_GPOS :: | |
81 | * Validate GPOS table. | |
82 | * | |
83 | * FT_VALIDATE_GSUB :: | |
84 | * Validate GSUB table. | |
85 | * | |
86 | * FT_VALIDATE_JSTF :: | |
87 | * Validate JSTF table. | |
88 | * | |
89 | * FT_VALIDATE_MATH :: | |
90 | * Validate MATH table. | |
91 | * | |
92 | * FT_VALIDATE_OT :: | |
93 | * Validate all OpenType tables (BASE, GDEF, GPOS, GSUB, JSTF, MATH). | |
94 | * | |
95 | */ | |
96 | #define FT_VALIDATE_BASE 0x0100 | |
97 | #define FT_VALIDATE_GDEF 0x0200 | |
98 | #define FT_VALIDATE_GPOS 0x0400 | |
99 | #define FT_VALIDATE_GSUB 0x0800 | |
100 | #define FT_VALIDATE_JSTF 0x1000 | |
101 | #define FT_VALIDATE_MATH 0x2000 | |
102 | ||
103 | #define FT_VALIDATE_OT FT_VALIDATE_BASE | \ | |
104 | FT_VALIDATE_GDEF | \ | |
105 | FT_VALIDATE_GPOS | \ | |
106 | FT_VALIDATE_GSUB | \ | |
107 | FT_VALIDATE_JSTF | \ | |
108 | FT_VALIDATE_MATH | |
109 | ||
110 | /* */ | |
111 | ||
112 | /********************************************************************** | |
113 | * | |
114 | * @function: | |
115 | * FT_OpenType_Validate | |
116 | * | |
117 | * @description: | |
118 | * Validate various OpenType tables to assure that all offsets and | |
119 | * indices are valid. The idea is that a higher-level library which | |
120 | * actually does the text layout can access those tables without | |
121 | * error checking (which can be quite time consuming). | |
122 | * | |
123 | * @input: | |
124 | * face :: | |
125 | * A handle to the input face. | |
126 | * | |
127 | * validation_flags :: | |
128 | * A bit field which specifies the tables to be validated. See | |
129 | * @FT_VALIDATE_OTXXX for possible values. | |
130 | * | |
131 | * @output: | |
132 | * BASE_table :: | |
133 | * A pointer to the BASE table. | |
134 | * | |
135 | * GDEF_table :: | |
136 | * A pointer to the GDEF table. | |
137 | * | |
138 | * GPOS_table :: | |
139 | * A pointer to the GPOS table. | |
140 | * | |
141 | * GSUB_table :: | |
142 | * A pointer to the GSUB table. | |
143 | * | |
144 | * JSTF_table :: | |
145 | * A pointer to the JSTF table. | |
146 | * | |
147 | * @return: | |
148 | * FreeType error code. 0~means success. | |
149 | * | |
150 | * @note: | |
151 | * This function only works with OpenType fonts, returning an error | |
152 | * otherwise. | |
153 | * | |
154 | * After use, the application should deallocate the five tables with | |
155 | * @FT_OpenType_Free. A NULL value indicates that the table either | |
156 | * doesn't exist in the font, or the application hasn't asked for | |
157 | * validation. | |
158 | */ | |
159 | FT_EXPORT( FT_Error ) | |
160 | FT_OpenType_Validate( FT_Face face, | |
161 | FT_UInt validation_flags, | |
162 | FT_Bytes *BASE_table, | |
163 | FT_Bytes *GDEF_table, | |
164 | FT_Bytes *GPOS_table, | |
165 | FT_Bytes *GSUB_table, | |
166 | FT_Bytes *JSTF_table ); | |
167 | ||
168 | /* */ | |
169 | ||
170 | /********************************************************************** | |
171 | * | |
172 | * @function: | |
173 | * FT_OpenType_Free | |
174 | * | |
175 | * @description: | |
176 | * Free the buffer allocated by OpenType validator. | |
177 | * | |
178 | * @input: | |
179 | * face :: | |
180 | * A handle to the input face. | |
181 | * | |
182 | * table :: | |
183 | * The pointer to the buffer that is allocated by | |
184 | * @FT_OpenType_Validate. | |
185 | * | |
186 | * @note: | |
187 | * This function must be used to free the buffer allocated by | |
188 | * @FT_OpenType_Validate only. | |
189 | */ | |
190 | FT_EXPORT( void ) | |
191 | FT_OpenType_Free( FT_Face face, | |
192 | FT_Bytes table ); | |
193 | ||
194 | ||
195 | /* */ | |
196 | ||
197 | ||
198 | FT_END_HEADER | |
199 | ||
200 | #endif /* __FTOTVAL_H__ */ | |
201 | ||
202 | ||
203 | /* END */ |