modules/freetype2/include/ftgxval.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /***************************************************************************/
michael@0 2 /* */
michael@0 3 /* ftgxval.h */
michael@0 4 /* */
michael@0 5 /* FreeType API for validating TrueTypeGX/AAT tables (specification). */
michael@0 6 /* */
michael@0 7 /* Copyright 2004-2006, 2013 by */
michael@0 8 /* Masatake YAMATO, Redhat K.K, */
michael@0 9 /* David Turner, Robert Wilhelm, and Werner Lemberg. */
michael@0 10 /* */
michael@0 11 /* This file is part of the FreeType project, and may only be used, */
michael@0 12 /* modified, and distributed under the terms of the FreeType project */
michael@0 13 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */
michael@0 14 /* this file you indicate that you have read the license and */
michael@0 15 /* understand and accept it fully. */
michael@0 16 /* */
michael@0 17 /***************************************************************************/
michael@0 18
michael@0 19 /***************************************************************************/
michael@0 20 /* */
michael@0 21 /* gxvalid is derived from both gxlayout module and otvalid module. */
michael@0 22 /* Development of gxlayout is supported by the Information-technology */
michael@0 23 /* Promotion Agency(IPA), Japan. */
michael@0 24 /* */
michael@0 25 /***************************************************************************/
michael@0 26
michael@0 27
michael@0 28 #ifndef __FTGXVAL_H__
michael@0 29 #define __FTGXVAL_H__
michael@0 30
michael@0 31 #include <ft2build.h>
michael@0 32 #include FT_FREETYPE_H
michael@0 33
michael@0 34 #ifdef FREETYPE_H
michael@0 35 #error "freetype.h of FreeType 1 has been loaded!"
michael@0 36 #error "Please fix the directory search order for header files"
michael@0 37 #error "so that freetype.h of FreeType 2 is found first."
michael@0 38 #endif
michael@0 39
michael@0 40
michael@0 41 FT_BEGIN_HEADER
michael@0 42
michael@0 43
michael@0 44 /*************************************************************************/
michael@0 45 /* */
michael@0 46 /* <Section> */
michael@0 47 /* gx_validation */
michael@0 48 /* */
michael@0 49 /* <Title> */
michael@0 50 /* TrueTypeGX/AAT Validation */
michael@0 51 /* */
michael@0 52 /* <Abstract> */
michael@0 53 /* An API to validate TrueTypeGX/AAT tables. */
michael@0 54 /* */
michael@0 55 /* <Description> */
michael@0 56 /* This section contains the declaration of functions to validate */
michael@0 57 /* some TrueTypeGX tables (feat, mort, morx, bsln, just, kern, opbd, */
michael@0 58 /* trak, prop, lcar). */
michael@0 59 /* */
michael@0 60 /*************************************************************************/
michael@0 61
michael@0 62
michael@0 63 /*************************************************************************/
michael@0 64 /* */
michael@0 65 /* */
michael@0 66 /* Warning: Use FT_VALIDATE_XXX to validate a table. */
michael@0 67 /* Following definitions are for gxvalid developers. */
michael@0 68 /* */
michael@0 69 /* */
michael@0 70 /*************************************************************************/
michael@0 71
michael@0 72 #define FT_VALIDATE_feat_INDEX 0
michael@0 73 #define FT_VALIDATE_mort_INDEX 1
michael@0 74 #define FT_VALIDATE_morx_INDEX 2
michael@0 75 #define FT_VALIDATE_bsln_INDEX 3
michael@0 76 #define FT_VALIDATE_just_INDEX 4
michael@0 77 #define FT_VALIDATE_kern_INDEX 5
michael@0 78 #define FT_VALIDATE_opbd_INDEX 6
michael@0 79 #define FT_VALIDATE_trak_INDEX 7
michael@0 80 #define FT_VALIDATE_prop_INDEX 8
michael@0 81 #define FT_VALIDATE_lcar_INDEX 9
michael@0 82 #define FT_VALIDATE_GX_LAST_INDEX FT_VALIDATE_lcar_INDEX
michael@0 83
michael@0 84
michael@0 85 /*************************************************************************
michael@0 86 *
michael@0 87 * @macro:
michael@0 88 * FT_VALIDATE_GX_LENGTH
michael@0 89 *
michael@0 90 * @description:
michael@0 91 * The number of tables checked in this module. Use it as a parameter
michael@0 92 * for the `table-length' argument of function @FT_TrueTypeGX_Validate.
michael@0 93 */
michael@0 94 #define FT_VALIDATE_GX_LENGTH (FT_VALIDATE_GX_LAST_INDEX + 1)
michael@0 95
michael@0 96 /* */
michael@0 97
michael@0 98 /* Up to 0x1000 is used by otvalid.
michael@0 99 Ox2xxx is reserved for feature OT extension. */
michael@0 100 #define FT_VALIDATE_GX_START 0x4000
michael@0 101 #define FT_VALIDATE_GX_BITFIELD( tag ) \
michael@0 102 ( FT_VALIDATE_GX_START << FT_VALIDATE_##tag##_INDEX )
michael@0 103
michael@0 104
michael@0 105 /**********************************************************************
michael@0 106 *
michael@0 107 * @enum:
michael@0 108 * FT_VALIDATE_GXXXX
michael@0 109 *
michael@0 110 * @description:
michael@0 111 * A list of bit-field constants used with @FT_TrueTypeGX_Validate to
michael@0 112 * indicate which TrueTypeGX/AAT Type tables should be validated.
michael@0 113 *
michael@0 114 * @values:
michael@0 115 * FT_VALIDATE_feat ::
michael@0 116 * Validate `feat' table.
michael@0 117 *
michael@0 118 * FT_VALIDATE_mort ::
michael@0 119 * Validate `mort' table.
michael@0 120 *
michael@0 121 * FT_VALIDATE_morx ::
michael@0 122 * Validate `morx' table.
michael@0 123 *
michael@0 124 * FT_VALIDATE_bsln ::
michael@0 125 * Validate `bsln' table.
michael@0 126 *
michael@0 127 * FT_VALIDATE_just ::
michael@0 128 * Validate `just' table.
michael@0 129 *
michael@0 130 * FT_VALIDATE_kern ::
michael@0 131 * Validate `kern' table.
michael@0 132 *
michael@0 133 * FT_VALIDATE_opbd ::
michael@0 134 * Validate `opbd' table.
michael@0 135 *
michael@0 136 * FT_VALIDATE_trak ::
michael@0 137 * Validate `trak' table.
michael@0 138 *
michael@0 139 * FT_VALIDATE_prop ::
michael@0 140 * Validate `prop' table.
michael@0 141 *
michael@0 142 * FT_VALIDATE_lcar ::
michael@0 143 * Validate `lcar' table.
michael@0 144 *
michael@0 145 * FT_VALIDATE_GX ::
michael@0 146 * Validate all TrueTypeGX tables (feat, mort, morx, bsln, just, kern,
michael@0 147 * opbd, trak, prop and lcar).
michael@0 148 *
michael@0 149 */
michael@0 150
michael@0 151 #define FT_VALIDATE_feat FT_VALIDATE_GX_BITFIELD( feat )
michael@0 152 #define FT_VALIDATE_mort FT_VALIDATE_GX_BITFIELD( mort )
michael@0 153 #define FT_VALIDATE_morx FT_VALIDATE_GX_BITFIELD( morx )
michael@0 154 #define FT_VALIDATE_bsln FT_VALIDATE_GX_BITFIELD( bsln )
michael@0 155 #define FT_VALIDATE_just FT_VALIDATE_GX_BITFIELD( just )
michael@0 156 #define FT_VALIDATE_kern FT_VALIDATE_GX_BITFIELD( kern )
michael@0 157 #define FT_VALIDATE_opbd FT_VALIDATE_GX_BITFIELD( opbd )
michael@0 158 #define FT_VALIDATE_trak FT_VALIDATE_GX_BITFIELD( trak )
michael@0 159 #define FT_VALIDATE_prop FT_VALIDATE_GX_BITFIELD( prop )
michael@0 160 #define FT_VALIDATE_lcar FT_VALIDATE_GX_BITFIELD( lcar )
michael@0 161
michael@0 162 #define FT_VALIDATE_GX ( FT_VALIDATE_feat | \
michael@0 163 FT_VALIDATE_mort | \
michael@0 164 FT_VALIDATE_morx | \
michael@0 165 FT_VALIDATE_bsln | \
michael@0 166 FT_VALIDATE_just | \
michael@0 167 FT_VALIDATE_kern | \
michael@0 168 FT_VALIDATE_opbd | \
michael@0 169 FT_VALIDATE_trak | \
michael@0 170 FT_VALIDATE_prop | \
michael@0 171 FT_VALIDATE_lcar )
michael@0 172
michael@0 173
michael@0 174 /* */
michael@0 175
michael@0 176 /**********************************************************************
michael@0 177 *
michael@0 178 * @function:
michael@0 179 * FT_TrueTypeGX_Validate
michael@0 180 *
michael@0 181 * @description:
michael@0 182 * Validate various TrueTypeGX tables to assure that all offsets and
michael@0 183 * indices are valid. The idea is that a higher-level library that
michael@0 184 * actually does the text layout can access those tables without
michael@0 185 * error checking (which can be quite time consuming).
michael@0 186 *
michael@0 187 * @input:
michael@0 188 * face ::
michael@0 189 * A handle to the input face.
michael@0 190 *
michael@0 191 * validation_flags ::
michael@0 192 * A bit field that specifies the tables to be validated. See
michael@0 193 * @FT_VALIDATE_GXXXX for possible values.
michael@0 194 *
michael@0 195 * table_length ::
michael@0 196 * The size of the `tables' array. Normally, @FT_VALIDATE_GX_LENGTH
michael@0 197 * should be passed.
michael@0 198 *
michael@0 199 * @output:
michael@0 200 * tables ::
michael@0 201 * The array where all validated sfnt tables are stored.
michael@0 202 * The array itself must be allocated by a client.
michael@0 203 *
michael@0 204 * @return:
michael@0 205 * FreeType error code. 0~means success.
michael@0 206 *
michael@0 207 * @note:
michael@0 208 * This function only works with TrueTypeGX fonts, returning an error
michael@0 209 * otherwise.
michael@0 210 *
michael@0 211 * After use, the application should deallocate the buffers pointed to by
michael@0 212 * each `tables' element, by calling @FT_TrueTypeGX_Free. A NULL value
michael@0 213 * indicates that the table either doesn't exist in the font, the
michael@0 214 * application hasn't asked for validation, or the validator doesn't have
michael@0 215 * the ability to validate the sfnt table.
michael@0 216 */
michael@0 217 FT_EXPORT( FT_Error )
michael@0 218 FT_TrueTypeGX_Validate( FT_Face face,
michael@0 219 FT_UInt validation_flags,
michael@0 220 FT_Bytes tables[FT_VALIDATE_GX_LENGTH],
michael@0 221 FT_UInt table_length );
michael@0 222
michael@0 223
michael@0 224 /* */
michael@0 225
michael@0 226 /**********************************************************************
michael@0 227 *
michael@0 228 * @function:
michael@0 229 * FT_TrueTypeGX_Free
michael@0 230 *
michael@0 231 * @description:
michael@0 232 * Free the buffer allocated by TrueTypeGX validator.
michael@0 233 *
michael@0 234 * @input:
michael@0 235 * face ::
michael@0 236 * A handle to the input face.
michael@0 237 *
michael@0 238 * table ::
michael@0 239 * The pointer to the buffer allocated by
michael@0 240 * @FT_TrueTypeGX_Validate.
michael@0 241 *
michael@0 242 * @note:
michael@0 243 * This function must be used to free the buffer allocated by
michael@0 244 * @FT_TrueTypeGX_Validate only.
michael@0 245 */
michael@0 246 FT_EXPORT( void )
michael@0 247 FT_TrueTypeGX_Free( FT_Face face,
michael@0 248 FT_Bytes table );
michael@0 249
michael@0 250
michael@0 251 /* */
michael@0 252
michael@0 253 /**********************************************************************
michael@0 254 *
michael@0 255 * @enum:
michael@0 256 * FT_VALIDATE_CKERNXXX
michael@0 257 *
michael@0 258 * @description:
michael@0 259 * A list of bit-field constants used with @FT_ClassicKern_Validate
michael@0 260 * to indicate the classic kern dialect or dialects. If the selected
michael@0 261 * type doesn't fit, @FT_ClassicKern_Validate regards the table as
michael@0 262 * invalid.
michael@0 263 *
michael@0 264 * @values:
michael@0 265 * FT_VALIDATE_MS ::
michael@0 266 * Handle the `kern' table as a classic Microsoft kern table.
michael@0 267 *
michael@0 268 * FT_VALIDATE_APPLE ::
michael@0 269 * Handle the `kern' table as a classic Apple kern table.
michael@0 270 *
michael@0 271 * FT_VALIDATE_CKERN ::
michael@0 272 * Handle the `kern' as either classic Apple or Microsoft kern table.
michael@0 273 */
michael@0 274 #define FT_VALIDATE_MS ( FT_VALIDATE_GX_START << 0 )
michael@0 275 #define FT_VALIDATE_APPLE ( FT_VALIDATE_GX_START << 1 )
michael@0 276
michael@0 277 #define FT_VALIDATE_CKERN ( FT_VALIDATE_MS | FT_VALIDATE_APPLE )
michael@0 278
michael@0 279
michael@0 280 /* */
michael@0 281
michael@0 282 /**********************************************************************
michael@0 283 *
michael@0 284 * @function:
michael@0 285 * FT_ClassicKern_Validate
michael@0 286 *
michael@0 287 * @description:
michael@0 288 * Validate classic (16-bit format) kern table to assure that the offsets
michael@0 289 * and indices are valid. The idea is that a higher-level library that
michael@0 290 * actually does the text layout can access those tables without error
michael@0 291 * checking (which can be quite time consuming).
michael@0 292 *
michael@0 293 * The `kern' table validator in @FT_TrueTypeGX_Validate deals with both
michael@0 294 * the new 32-bit format and the classic 16-bit format, while
michael@0 295 * FT_ClassicKern_Validate only supports the classic 16-bit format.
michael@0 296 *
michael@0 297 * @input:
michael@0 298 * face ::
michael@0 299 * A handle to the input face.
michael@0 300 *
michael@0 301 * validation_flags ::
michael@0 302 * A bit field that specifies the dialect to be validated. See
michael@0 303 * @FT_VALIDATE_CKERNXXX for possible values.
michael@0 304 *
michael@0 305 * @output:
michael@0 306 * ckern_table ::
michael@0 307 * A pointer to the kern table.
michael@0 308 *
michael@0 309 * @return:
michael@0 310 * FreeType error code. 0~means success.
michael@0 311 *
michael@0 312 * @note:
michael@0 313 * After use, the application should deallocate the buffers pointed to by
michael@0 314 * `ckern_table', by calling @FT_ClassicKern_Free. A NULL value
michael@0 315 * indicates that the table doesn't exist in the font.
michael@0 316 */
michael@0 317 FT_EXPORT( FT_Error )
michael@0 318 FT_ClassicKern_Validate( FT_Face face,
michael@0 319 FT_UInt validation_flags,
michael@0 320 FT_Bytes *ckern_table );
michael@0 321
michael@0 322
michael@0 323 /* */
michael@0 324
michael@0 325 /**********************************************************************
michael@0 326 *
michael@0 327 * @function:
michael@0 328 * FT_ClassicKern_Free
michael@0 329 *
michael@0 330 * @description:
michael@0 331 * Free the buffer allocated by classic Kern validator.
michael@0 332 *
michael@0 333 * @input:
michael@0 334 * face ::
michael@0 335 * A handle to the input face.
michael@0 336 *
michael@0 337 * table ::
michael@0 338 * The pointer to the buffer that is allocated by
michael@0 339 * @FT_ClassicKern_Validate.
michael@0 340 *
michael@0 341 * @note:
michael@0 342 * This function must be used to free the buffer allocated by
michael@0 343 * @FT_ClassicKern_Validate only.
michael@0 344 */
michael@0 345 FT_EXPORT( void )
michael@0 346 FT_ClassicKern_Free( FT_Face face,
michael@0 347 FT_Bytes table );
michael@0 348
michael@0 349
michael@0 350 /* */
michael@0 351
michael@0 352
michael@0 353 FT_END_HEADER
michael@0 354
michael@0 355 #endif /* __FTGXVAL_H__ */
michael@0 356
michael@0 357
michael@0 358 /* END */

mercurial