1 /**************************************************************************** 2 * 3 * afmparse.h 4 * 5 * AFM parser (specification). 6 * 7 * Copyright (C) 2006-2020 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 AFMPARSE_H_ 20 #define AFMPARSE_H_ 21 22 23 #include <freetype/internal/psaux.h> 24 25 26 FT_BEGIN_HEADER 27 28 29 FT_LOCAL( FT_Error ) 30 afm_parser_init( AFM_Parser parser, 31 FT_Memory memory, 32 FT_Byte* base, 33 FT_Byte* limit ); 34 35 36 FT_LOCAL( void ) 37 afm_parser_done( AFM_Parser parser ); 38 39 40 FT_LOCAL( FT_Error ) 41 afm_parser_parse( AFM_Parser parser ); 42 43 44 enum AFM_ValueType_ 45 { 46 AFM_VALUE_TYPE_STRING, 47 AFM_VALUE_TYPE_NAME, 48 AFM_VALUE_TYPE_FIXED, /* real number */ 49 AFM_VALUE_TYPE_INTEGER, 50 AFM_VALUE_TYPE_BOOL, 51 AFM_VALUE_TYPE_INDEX /* glyph index */ 52 }; 53 54 55 typedef struct AFM_ValueRec_ 56 { 57 enum AFM_ValueType_ type; 58 union 59 { 60 char* s; 61 FT_Fixed f; 62 FT_Int i; 63 FT_UInt u; 64 FT_Bool b; 65 66 } u; 67 68 } AFM_ValueRec, *AFM_Value; 69 70 #define AFM_MAX_ARGUMENTS 5 71 72 FT_LOCAL( FT_Int ) 73 afm_parser_read_vals( AFM_Parser parser, 74 AFM_Value vals, 75 FT_Int n ); 76 77 /* read the next key from the next line or column */ 78 FT_LOCAL( char* ) 79 afm_parser_next_key( AFM_Parser parser, 80 FT_Bool line, 81 FT_Offset* len ); 82 83 FT_END_HEADER 84 85 #endif /* AFMPARSE_H_ */ 86 87 88 /* END */ 89