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