00001 /***************************************************************************/ 00002 /* */ 00003 /* ftotval.h */ 00004 /* */ 00005 /* FreeType API for validating OpenType tables (specification). */ 00006 /* */ 00007 /* Copyright 2004, 2005, 2006, 2007 by */ 00008 /* David Turner, Robert Wilhelm, and Werner Lemberg. */ 00009 /* */ 00010 /* This file is part of the FreeType project, and may only be used, */ 00011 /* modified, and distributed under the terms of the FreeType project */ 00012 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 00013 /* this file you indicate that you have read the license and */ 00014 /* understand and accept it fully. */ 00015 /* */ 00016 /***************************************************************************/ 00017 00018 00019 /***************************************************************************/ 00020 /* */ 00021 /* */ 00022 /* Warning: This module might be moved to a different library in the */ 00023 /* future to avoid a tight dependency between FreeType and the */ 00024 /* OpenType specification. */ 00025 /* */ 00026 /* */ 00027 /***************************************************************************/ 00028 00029 00030 #ifndef __FTOTVAL_H__ 00031 #define __FTOTVAL_H__ 00032 00033 #include <ft2build.h> 00034 #include FT_FREETYPE_H 00035 00036 #ifdef FREETYPE_H 00037 #error "freetype.h of FreeType 1 has been loaded!" 00038 #error "Please fix the directory search order for header files" 00039 #error "so that freetype.h of FreeType 2 is found first." 00040 #endif 00041 00042 00043 FT_BEGIN_HEADER 00044 00045 00046 /*************************************************************************/ 00047 /* */ 00048 /* <Section> */ 00049 /* ot_validation */ 00050 /* */ 00051 /* <Title> */ 00052 /* OpenType Validation */ 00053 /* */ 00054 /* <Abstract> */ 00055 /* An API to validate OpenType tables. */ 00056 /* */ 00057 /* <Description> */ 00058 /* This section contains the declaration of functions to validate */ 00059 /* some OpenType tables (BASE, GDEF, GPOS, GSUB, JSTF, MATH). */ 00060 /* */ 00061 /*************************************************************************/ 00062 00063 00064 /********************************************************************** 00065 * 00066 * @enum: 00067 * FT_VALIDATE_OTXXX 00068 * 00069 * @description: 00070 * A list of bit-field constants used with @FT_OpenType_Validate to 00071 * indicate which OpenType tables should be validated. 00072 * 00073 * @values: 00074 * FT_VALIDATE_BASE :: 00075 * Validate BASE table. 00076 * 00077 * FT_VALIDATE_GDEF :: 00078 * Validate GDEF table. 00079 * 00080 * FT_VALIDATE_GPOS :: 00081 * Validate GPOS table. 00082 * 00083 * FT_VALIDATE_GSUB :: 00084 * Validate GSUB table. 00085 * 00086 * FT_VALIDATE_JSTF :: 00087 * Validate JSTF table. 00088 * 00089 * FT_VALIDATE_MATH :: 00090 * Validate MATH table. 00091 * 00092 * FT_VALIDATE_OT :: 00093 * Validate all OpenType tables (BASE, GDEF, GPOS, GSUB, JSTF, MATH). 00094 * 00095 */ 00096 #define FT_VALIDATE_BASE 0x0100 00097 #define FT_VALIDATE_GDEF 0x0200 00098 #define FT_VALIDATE_GPOS 0x0400 00099 #define FT_VALIDATE_GSUB 0x0800 00100 #define FT_VALIDATE_JSTF 0x1000 00101 #define FT_VALIDATE_MATH 0x2000 00102 00103 #define FT_VALIDATE_OT FT_VALIDATE_BASE | \ 00104 FT_VALIDATE_GDEF | \ 00105 FT_VALIDATE_GPOS | \ 00106 FT_VALIDATE_GSUB | \ 00107 FT_VALIDATE_JSTF | \ 00108 FT_VALIDATE_MATH 00109 00110 /* */ 00111 00112 /********************************************************************** 00113 * 00114 * @function: 00115 * FT_OpenType_Validate 00116 * 00117 * @description: 00118 * Validate various OpenType tables to assure that all offsets and 00119 * indices are valid. The idea is that a higher-level library which 00120 * actually does the text layout can access those tables without 00121 * error checking (which can be quite time consuming). 00122 * 00123 * @input: 00124 * face :: 00125 * A handle to the input face. 00126 * 00127 * validation_flags :: 00128 * A bit field which specifies the tables to be validated. See 00129 * @FT_VALIDATE_OTXXX for possible values. 00130 * 00131 * @output: 00132 * BASE_table :: 00133 * A pointer to the BASE table. 00134 * 00135 * GDEF_table :: 00136 * A pointer to the GDEF table. 00137 * 00138 * GPOS_table :: 00139 * A pointer to the GPOS table. 00140 * 00141 * GSUB_table :: 00142 * A pointer to the GSUB table. 00143 * 00144 * JSTF_table :: 00145 * A pointer to the JSTF table. 00146 * 00147 * @return: 00148 * FreeType error code. 0~means success. 00149 * 00150 * @note: 00151 * This function only works with OpenType fonts, returning an error 00152 * otherwise. 00153 * 00154 * After use, the application should deallocate the five tables with 00155 * @FT_OpenType_Free. A NULL value indicates that the table either 00156 * doesn't exist in the font, or the application hasn't asked for 00157 * validation. 00158 */ 00159 FT_EXPORT( FT_Error ) 00160 FT_OpenType_Validate( FT_Face face, 00161 FT_UInt validation_flags, 00162 FT_Bytes *BASE_table, 00163 FT_Bytes *GDEF_table, 00164 FT_Bytes *GPOS_table, 00165 FT_Bytes *GSUB_table, 00166 FT_Bytes *JSTF_table ); 00167 00168 /* */ 00169 00170 /********************************************************************** 00171 * 00172 * @function: 00173 * FT_OpenType_Free 00174 * 00175 * @description: 00176 * Free the buffer allocated by OpenType validator. 00177 * 00178 * @input: 00179 * face :: 00180 * A handle to the input face. 00181 * 00182 * table :: 00183 * The pointer to the buffer that is allocated by 00184 * @FT_OpenType_Validate. 00185 * 00186 * @note: 00187 * This function must be used to free the buffer allocated by 00188 * @FT_OpenType_Validate only. 00189 */ 00190 FT_EXPORT( void ) 00191 FT_OpenType_Free( FT_Face face, 00192 FT_Bytes table ); 00193 00194 00195 /* */ 00196 00197 00198 FT_END_HEADER 00199 00200 #endif /* __FTOTVAL_H__ */ 00201 00202 00203 /* END */