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