1 /***************************************************************************/ 2 /* */ 3 /* ftvalid.h */ 4 /* */ 5 /* FreeType validation support (specification). */ 6 /* */ 7 /* Copyright 2004-2018 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 #ifndef FTVALID_H_ 20 #define FTVALID_H_ 21 22 #include <ft2build.h> 23 #include FT_CONFIG_STANDARD_LIBRARY_H /* for ft_setjmp and ft_longjmp */ 24 25 26 FT_BEGIN_HEADER 27 28 29 /*************************************************************************/ 30 /*************************************************************************/ 31 /*************************************************************************/ 32 /**** ****/ 33 /**** ****/ 34 /**** V A L I D A T I O N ****/ 35 /**** ****/ 36 /**** ****/ 37 /*************************************************************************/ 38 /*************************************************************************/ 39 /*************************************************************************/ 40 41 /* handle to a validation object */ 42 typedef struct FT_ValidatorRec_ volatile* FT_Validator; 43 44 45 /*************************************************************************/ 46 /* */ 47 /* There are three distinct validation levels defined here: */ 48 /* */ 49 /* FT_VALIDATE_DEFAULT :: */ 50 /* A table that passes this validation level can be used reliably by */ 51 /* FreeType. It generally means that all offsets have been checked to */ 52 /* prevent out-of-bound reads, that array counts are correct, etc. */ 53 /* */ 54 /* FT_VALIDATE_TIGHT :: */ 55 /* A table that passes this validation level can be used reliably and */ 56 /* doesn't contain invalid data. For example, a charmap table that */ 57 /* returns invalid glyph indices will not pass, even though it can */ 58 /* be used with FreeType in default mode (the library will simply */ 59 /* return an error later when trying to load the glyph). */ 60 /* */ 61 /* It also checks that fields which must be a multiple of 2, 4, or 8, */ 62 /* don't have incorrect values, etc. */ 63 /* */ 64 /* FT_VALIDATE_PARANOID :: */ 65 /* Only for font debugging. Checks that a table follows the */ 66 /* specification by 100%. Very few fonts will be able to pass this */ 67 /* level anyway but it can be useful for certain tools like font */ 68 /* editors/converters. */ 69 /* */ 70 typedef enum FT_ValidationLevel_ 71 { 72 FT_VALIDATE_DEFAULT = 0, 73 FT_VALIDATE_TIGHT, 74 FT_VALIDATE_PARANOID 75 76 } FT_ValidationLevel; 77 78 79 #if defined( _MSC_VER ) /* Visual C++ (and Intel C++) */ 80 /* We disable the warning `structure was padded due to */ 81 /* __declspec(align())' in order to compile cleanly with */ 82 /* the maximum level of warnings. */ 83 #pragma warning( push ) 84 #pragma warning( disable : 4324 ) 85 #endif /* _MSC_VER */ 86 87 /* validator structure */ 88 typedef struct FT_ValidatorRec_ 89 { | 1 /**************************************************************************** 2 * 3 * ftvalid.h 4 * 5 * FreeType validation support (specification). 6 * 7 * Copyright (C) 2004-2019 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 #ifndef FTVALID_H_ 20 #define FTVALID_H_ 21 22 #include <ft2build.h> 23 #include FT_CONFIG_STANDARD_LIBRARY_H /* for ft_setjmp and ft_longjmp */ 24 25 26 FT_BEGIN_HEADER 27 28 29 /*************************************************************************/ 30 /*************************************************************************/ 31 /*************************************************************************/ 32 /**** ****/ 33 /**** ****/ 34 /**** V A L I D A T I O N ****/ 35 /**** ****/ 36 /**** ****/ 37 /*************************************************************************/ 38 /*************************************************************************/ 39 /*************************************************************************/ 40 41 /* handle to a validation object */ 42 typedef struct FT_ValidatorRec_ volatile* FT_Validator; 43 44 45 /************************************************************************** 46 * 47 * There are three distinct validation levels defined here: 48 * 49 * FT_VALIDATE_DEFAULT :: 50 * A table that passes this validation level can be used reliably by 51 * FreeType. It generally means that all offsets have been checked to 52 * prevent out-of-bound reads, that array counts are correct, etc. 53 * 54 * FT_VALIDATE_TIGHT :: 55 * A table that passes this validation level can be used reliably and 56 * doesn't contain invalid data. For example, a charmap table that 57 * returns invalid glyph indices will not pass, even though it can be 58 * used with FreeType in default mode (the library will simply return an 59 * error later when trying to load the glyph). 60 * 61 * It also checks that fields which must be a multiple of 2, 4, or 8, 62 * don't have incorrect values, etc. 63 * 64 * FT_VALIDATE_PARANOID :: 65 * Only for font debugging. Checks that a table follows the 66 * specification by 100%. Very few fonts will be able to pass this level 67 * anyway but it can be useful for certain tools like font 68 * editors/converters. 69 */ 70 typedef enum FT_ValidationLevel_ 71 { 72 FT_VALIDATE_DEFAULT = 0, 73 FT_VALIDATE_TIGHT, 74 FT_VALIDATE_PARANOID 75 76 } FT_ValidationLevel; 77 78 79 #if defined( _MSC_VER ) /* Visual C++ (and Intel C++) */ 80 /* We disable the warning `structure was padded due to */ 81 /* __declspec(align())' in order to compile cleanly with */ 82 /* the maximum level of warnings. */ 83 #pragma warning( push ) 84 #pragma warning( disable : 4324 ) 85 #endif /* _MSC_VER */ 86 87 /* validator structure */ 88 typedef struct FT_ValidatorRec_ 89 { |