1 /***************************************************************************/ 2 /* */ 3 /* pfrload.h */ 4 /* */ 5 /* FreeType PFR loader (specification). */ 6 /* */ 7 /* Copyright 2002 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 __PFRLOAD_H__ 20 #define __PFRLOAD_H__ 21 22 #include "pfrobjs.h" 23 #include FT_INTERNAL_STREAM_H 24 25 26 FT_BEGIN_HEADER 27 28 #ifdef PFR_CONFIG_NO_CHECKS 29 #define PFR_CHECK( x ) do { } while ( 0 ) 30 #else 31 #define PFR_CHECK( x ) do \ 32 { \ 33 if ( p + (x) > limit ) \ 34 goto Too_Short; \ 35 } while ( 0 ) 36 #endif 37 38 #define PFR_NEXT_BYTE( p ) FT_NEXT_BYTE( p ) 39 #define PFR_NEXT_INT8( p ) FT_NEXT_CHAR( p ) 40 #define PFR_NEXT_SHORT( p ) FT_NEXT_SHORT( p ) 41 #define PFR_NEXT_USHORT( p ) FT_NEXT_USHORT( p ) 42 #define PFR_NEXT_LONG( p ) FT_NEXT_OFF3( p ) 43 #define PFR_NEXT_ULONG( p ) FT_NEXT_UOFF3( p ) 44 45 46 /* handling extra items */ 47 48 typedef FT_Error 49 (*PFR_ExtraItem_ParseFunc)( FT_Byte* p, 50 FT_Byte* limit, 51 FT_Pointer data ); 52 53 typedef struct PFR_ExtraItemRec_ 54 { 55 FT_UInt type; 56 PFR_ExtraItem_ParseFunc parser; 57 58 } PFR_ExtraItemRec; 59 60 typedef const struct PFR_ExtraItemRec_* PFR_ExtraItem; 61 62 63 FT_LOCAL( FT_Error ) 64 pfr_extra_items_skip( FT_Byte* *pp, 65 FT_Byte* limit ); 66 67 FT_LOCAL( FT_Error ) 68 pfr_extra_items_parse( FT_Byte* *pp, 69 FT_Byte* limit, 70 PFR_ExtraItem item_list, 71 FT_Pointer item_data ); 72 73 74 /* load a PFR header */ 75 FT_LOCAL( FT_Error ) 76 pfr_header_load( PFR_Header header, 77 FT_Stream stream ); 78 79 /* check a PFR header */ 80 FT_LOCAL( FT_Bool ) 81 pfr_header_check( PFR_Header header ); 82 83 84 /* return number of logical fonts in this file */ 85 FT_LOCAL( FT_Error ) 86 pfr_log_font_count( FT_Stream stream, 87 FT_UInt32 log_section_offset, 88 FT_UInt *acount ); 89 90 /* load a pfr logical font entry */ 91 FT_LOCAL( FT_Error ) 92 pfr_log_font_load( PFR_LogFont log_font, 93 FT_Stream stream, 94 FT_UInt face_index, 95 FT_UInt32 section_offset, 96 FT_Bool size_increment ); 97 98 99 /* load a physical font entry */ 100 FT_LOCAL( FT_Error ) 101 pfr_phy_font_load( PFR_PhyFont phy_font, 102 FT_Stream stream, 103 FT_UInt32 offset, 104 FT_UInt32 size ); 105 106 /* finalize a physical font */ 107 FT_LOCAL( void ) 108 pfr_phy_font_done( PFR_PhyFont phy_font, 109 FT_Memory memory ); 110 111 /* */ 112 113 FT_END_HEADER 114 115 #endif /* __PFRLOAD_H__ */ 116 117 118 /* END */ 119