1 /***************************************************************************/ 2 /* */ 3 /* ftdriver.h */ 4 /* */ 5 /* FreeType font driver interface (specification). */ 6 /* */ 7 /* Copyright 1996-2001, 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 __FTDRIVER_H__ 20 #define __FTDRIVER_H__ 21 22 23 #include <ft2build.h> 24 #include FT_MODULE_H 25 26 27 FT_BEGIN_HEADER 28 29 30 typedef FT_Error 31 (*FT_Face_InitFunc)( FT_Stream stream, 32 FT_Face face, 33 FT_Int typeface_index, 34 FT_Int num_params, 35 FT_Parameter* parameters ); 36 37 typedef void 38 (*FT_Face_DoneFunc)( FT_Face face ); 39 40 41 typedef FT_Error 42 (*FT_Size_InitFunc)( FT_Size size ); 43 44 typedef void 45 (*FT_Size_DoneFunc)( FT_Size size ); 46 47 48 typedef FT_Error 49 (*FT_Slot_InitFunc)( FT_GlyphSlot slot ); 50 51 typedef void 52 (*FT_Slot_DoneFunc)( FT_GlyphSlot slot ); 53 54 55 typedef FT_Error 56 (*FT_Size_ResetPointsFunc)( FT_Size size, 57 FT_F26Dot6 char_width, 58 FT_F26Dot6 char_height, 59 FT_UInt horz_resolution, 60 FT_UInt vert_resolution ); 61 62 typedef FT_Error 63 (*FT_Size_ResetPixelsFunc)( FT_Size size, 64 FT_UInt pixel_width, 65 FT_UInt pixel_height ); 66 67 typedef FT_Error 68 (*FT_Slot_LoadFunc)( FT_GlyphSlot slot, 69 FT_Size size, 70 FT_UInt glyph_index, 71 FT_Int32 load_flags ); 72 73 74 typedef FT_UInt 75 (*FT_CharMap_CharIndexFunc)( FT_CharMap charmap, 76 FT_Long charcode ); 77 78 typedef FT_Long 79 (*FT_CharMap_CharNextFunc)( FT_CharMap charmap, 80 FT_Long charcode ); 81 82 typedef FT_Error 83 (*FT_Face_GetKerningFunc)( FT_Face face, 84 FT_UInt left_glyph, 85 FT_UInt right_glyph, 86 FT_Vector* kerning ); 87 88 89 typedef FT_Error 90 (*FT_Face_AttachFunc)( FT_Face face, 91 FT_Stream stream ); 92 93 94 typedef FT_Error 95 (*FT_Face_GetAdvancesFunc)( FT_Face face, 96 FT_UInt first, 97 FT_UInt count, 98 FT_Bool vertical, 99 FT_UShort* advances ); 100 101 102 /*************************************************************************/ 103 /* */ 104 /* <Struct> */ 105 /* FT_Driver_ClassRec */ 106 /* */ 107 /* <Description> */ 108 /* The font driver class. This structure mostly contains pointers to */ 109 /* driver methods. */ 110 /* */ 111 /* <Fields> */ 112 /* root :: The parent module. */ 113 /* */ 114 /* face_object_size :: The size of a face object in bytes. */ 115 /* */ 116 /* size_object_size :: The size of a size object in bytes. */ 117 /* */ 118 /* slot_object_size :: The size of a glyph object in bytes. */ 119 /* */ 120 /* init_face :: The format-specific face constructor. */ 121 /* */ 122 /* done_face :: The format-specific face destructor. */ 123 /* */ 124 /* init_size :: The format-specific size constructor. */ 125 /* */ 126 /* done_size :: The format-specific size destructor. */ 127 /* */ 128 /* init_slot :: The format-specific slot constructor. */ 129 /* */ 130 /* done_slot :: The format-specific slot destructor. */ 131 /* */ 132 /* set_char_sizes :: A handle to a function used to set the new */ 133 /* character size in points + resolution. Can be */ 134 /* set to 0 to indicate default behaviour. */ 135 /* */ 136 /* set_pixel_sizes :: A handle to a function used to set the new */ 137 /* character size in pixels. Can be set to 0 to */ 138 /* indicate default behaviour. */ 139 /* */ 140 /* load_glyph :: A function handle to load a given glyph image */ 141 /* in a slot. This field is mandatory! */ 142 /* */ 143 /* get_char_index :: A function handle to return the glyph index of */ 144 /* a given character for a given charmap. This */ 145 /* field is mandatory! */ 146 /* */ 147 /* get_kerning :: A function handle to return the unscaled */ 148 /* kerning for a given pair of glyphs. Can be */ 149 /* set to 0 if the format doesn't support */ 150 /* kerning. */ 151 /* */ 152 /* attach_file :: This function handle is used to read */ 153 /* additional data for a face from another */ 154 /* file/stream. For example, this can be used to */ 155 /* add data from AFM or PFM files on a Type 1 */ 156 /* face, or a CIDMap on a CID-keyed face. */ 157 /* */ 158 /* get_advances :: A function handle used to return the advances */ 159 /* of 'count' glyphs, starting at `index'. the */ 160 /* `vertical' flags must be set when vertical */ 161 /* advances are queried. The advances buffer is */ 162 /* caller-allocated. */ 163 /* */ 164 /* <Note> */ 165 /* Most function pointers, with the exception of `load_glyph' and */ 166 /* `get_char_index' can be set to 0 to indicate a default behaviour. */ 167 /* */ 168 typedef struct FT_Driver_ClassRec_ 169 { 170 FT_Module_Class root; 171 172 FT_Int face_object_size; 173 FT_Int size_object_size; 174 FT_Int slot_object_size; 175 176 FT_Face_InitFunc init_face; 177 FT_Face_DoneFunc done_face; 178 179 FT_Size_InitFunc init_size; 180 FT_Size_DoneFunc done_size; 181 182 FT_Slot_InitFunc init_slot; 183 FT_Slot_DoneFunc done_slot; 184 185 FT_Size_ResetPointsFunc set_char_sizes; 186 FT_Size_ResetPixelsFunc set_pixel_sizes; 187 188 FT_Slot_LoadFunc load_glyph; 189 190 FT_Face_GetKerningFunc get_kerning; 191 FT_Face_AttachFunc attach_file; 192 FT_Face_GetAdvancesFunc get_advances; 193 194 } FT_Driver_ClassRec, *FT_Driver_Class; 195 196 197 FT_END_HEADER 198 199 #endif /* __FTDRIVER_H__ */ 200 201 202 /* END */ 203