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