tizen 2.3.1 release
[framework/graphics/freetype.git] / include / ftotval.h
1 /***************************************************************************/
2 /*                                                                         */
3 /*  ftotval.h                                                              */
4 /*                                                                         */
5 /*    FreeType API for validating OpenType tables (specification).         */
6 /*                                                                         */
7 /*  Copyright 2004-2007, 2013, 2014 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   /* <Order>                                                               */
62   /*    FT_OpenType_Validate                                               */
63   /*    FT_OpenType_Free                                                   */
64   /*                                                                       */
65   /*    FT_VALIDATE_OTXXX                                                  */
66   /*                                                                       */
67   /*************************************************************************/
68
69
70  /**********************************************************************
71   *
72   * @enum:
73   *    FT_VALIDATE_OTXXX
74   *
75   * @description:
76   *    A list of bit-field constants used with @FT_OpenType_Validate to
77   *    indicate which OpenType tables should be validated.
78   *
79   * @values:
80   *    FT_VALIDATE_BASE ::
81   *      Validate BASE table.
82   *
83   *    FT_VALIDATE_GDEF ::
84   *      Validate GDEF table.
85   *
86   *    FT_VALIDATE_GPOS ::
87   *      Validate GPOS table.
88   *
89   *    FT_VALIDATE_GSUB ::
90   *      Validate GSUB table.
91   *
92   *    FT_VALIDATE_JSTF ::
93   *      Validate JSTF table.
94   *
95   *    FT_VALIDATE_MATH ::
96   *      Validate MATH table.
97   *
98   *    FT_VALIDATE_OT ::
99   *      Validate all OpenType tables (BASE, GDEF, GPOS, GSUB, JSTF, MATH).
100   *
101   */
102 #define FT_VALIDATE_BASE  0x0100
103 #define FT_VALIDATE_GDEF  0x0200
104 #define FT_VALIDATE_GPOS  0x0400
105 #define FT_VALIDATE_GSUB  0x0800
106 #define FT_VALIDATE_JSTF  0x1000
107 #define FT_VALIDATE_MATH  0x2000
108
109 #define FT_VALIDATE_OT  FT_VALIDATE_BASE | \
110                         FT_VALIDATE_GDEF | \
111                         FT_VALIDATE_GPOS | \
112                         FT_VALIDATE_GSUB | \
113                         FT_VALIDATE_JSTF | \
114                         FT_VALIDATE_MATH
115
116  /**********************************************************************
117   *
118   * @function:
119   *    FT_OpenType_Validate
120   *
121   * @description:
122   *    Validate various OpenType tables to assure that all offsets and
123   *    indices are valid.  The idea is that a higher-level library that
124   *    actually does the text layout can access those tables without
125   *    error checking (which can be quite time consuming).
126   *
127   * @input:
128   *    face ::
129   *       A handle to the input face.
130   *
131   *    validation_flags ::
132   *       A bit field that specifies the tables to be validated.  See
133   *       @FT_VALIDATE_OTXXX for possible values.
134   *
135   * @output:
136   *    BASE_table ::
137   *       A pointer to the BASE table.
138   *
139   *    GDEF_table ::
140   *       A pointer to the GDEF table.
141   *
142   *    GPOS_table ::
143   *       A pointer to the GPOS table.
144   *
145   *    GSUB_table ::
146   *       A pointer to the GSUB table.
147   *
148   *    JSTF_table ::
149   *       A pointer to the JSTF table.
150   *
151   * @return:
152   *   FreeType error code.  0~means success.
153   *
154   * @note:
155   *   This function only works with OpenType fonts, returning an error
156   *   otherwise.
157   *
158   *   After use, the application should deallocate the five tables with
159   *   @FT_OpenType_Free.  A NULL value indicates that the table either
160   *   doesn't exist in the font, or the application hasn't asked for
161   *   validation.
162   */
163   FT_EXPORT( FT_Error )
164   FT_OpenType_Validate( FT_Face    face,
165                         FT_UInt    validation_flags,
166                         FT_Bytes  *BASE_table,
167                         FT_Bytes  *GDEF_table,
168                         FT_Bytes  *GPOS_table,
169                         FT_Bytes  *GSUB_table,
170                         FT_Bytes  *JSTF_table );
171
172  /**********************************************************************
173   *
174   * @function:
175   *    FT_OpenType_Free
176   *
177   * @description:
178   *    Free the buffer allocated by OpenType validator.
179   *
180   * @input:
181   *    face ::
182   *       A handle to the input face.
183   *
184   *    table ::
185   *       The pointer to the buffer that is allocated by
186   *       @FT_OpenType_Validate.
187   *
188   * @note:
189   *   This function must be used to free the buffer allocated by
190   *   @FT_OpenType_Validate only.
191   */
192   FT_EXPORT( void )
193   FT_OpenType_Free( FT_Face   face,
194                     FT_Bytes  table );
195
196   /* */
197
198
199 FT_END_HEADER
200
201 #endif /* __FTOTVAL_H__ */
202
203
204 /* END */