1 /***************************************************************************/
5 /* FreeType renderer modules public interface (specification). */
7 /* Copyright 1996-2018 by */
8 /* David Turner, Robert Wilhelm, and Werner Lemberg. */
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. */
16 /***************************************************************************/
31 /*************************************************************************/
34 /* module_management */
36 /*************************************************************************/
39 /* create a new glyph object */
41 (*FT_Glyph_InitFunc
)( FT_Glyph glyph
,
44 /* destroys a given glyph object */
46 (*FT_Glyph_DoneFunc
)( FT_Glyph glyph
);
49 (*FT_Glyph_TransformFunc
)( FT_Glyph glyph
,
50 const FT_Matrix
* matrix
,
51 const FT_Vector
* delta
);
54 (*FT_Glyph_GetBBoxFunc
)( FT_Glyph glyph
,
58 (*FT_Glyph_CopyFunc
)( FT_Glyph source
,
62 (*FT_Glyph_PrepareFunc
)( FT_Glyph glyph
,
66 #define FT_Glyph_Init_Func FT_Glyph_InitFunc
67 #define FT_Glyph_Done_Func FT_Glyph_DoneFunc
68 #define FT_Glyph_Transform_Func FT_Glyph_TransformFunc
69 #define FT_Glyph_BBox_Func FT_Glyph_GetBBoxFunc
70 #define FT_Glyph_Copy_Func FT_Glyph_CopyFunc
71 #define FT_Glyph_Prepare_Func FT_Glyph_PrepareFunc
74 struct FT_Glyph_Class_
77 FT_Glyph_Format glyph_format
;
79 FT_Glyph_InitFunc glyph_init
;
80 FT_Glyph_DoneFunc glyph_done
;
81 FT_Glyph_CopyFunc glyph_copy
;
82 FT_Glyph_TransformFunc glyph_transform
;
83 FT_Glyph_GetBBoxFunc glyph_bbox
;
84 FT_Glyph_PrepareFunc glyph_prepare
;
89 (*FT_Renderer_RenderFunc
)( FT_Renderer renderer
,
92 const FT_Vector
* origin
);
95 (*FT_Renderer_TransformFunc
)( FT_Renderer renderer
,
97 const FT_Matrix
* matrix
,
98 const FT_Vector
* delta
);
102 (*FT_Renderer_GetCBoxFunc
)( FT_Renderer renderer
,
108 (*FT_Renderer_SetModeFunc
)( FT_Renderer renderer
,
110 FT_Pointer mode_ptr
);
112 /* deprecated identifiers */
113 #define FTRenderer_render FT_Renderer_RenderFunc
114 #define FTRenderer_transform FT_Renderer_TransformFunc
115 #define FTRenderer_getCBox FT_Renderer_GetCBoxFunc
116 #define FTRenderer_setMode FT_Renderer_SetModeFunc
119 /*************************************************************************/
122 /* FT_Renderer_Class */
125 /* The renderer module class descriptor. */
128 /* root :: The root @FT_Module_Class fields. */
130 /* glyph_format :: The glyph image format this renderer handles. */
132 /* render_glyph :: A method used to render the image that is in a */
133 /* given glyph slot into a bitmap. */
135 /* transform_glyph :: A method used to transform the image that is in */
136 /* a given glyph slot. */
138 /* get_glyph_cbox :: A method used to access the glyph's cbox. */
140 /* set_mode :: A method used to pass additional parameters. */
142 /* raster_class :: For @FT_GLYPH_FORMAT_OUTLINE renderers only. */
143 /* This is a pointer to its raster's class. */
145 typedef struct FT_Renderer_Class_
147 FT_Module_Class root
;
149 FT_Glyph_Format glyph_format
;
151 FT_Renderer_RenderFunc render_glyph
;
152 FT_Renderer_TransformFunc transform_glyph
;
153 FT_Renderer_GetCBoxFunc get_glyph_cbox
;
154 FT_Renderer_SetModeFunc set_mode
;
156 FT_Raster_Funcs
* raster_class
;
161 /*************************************************************************/
164 /* FT_Get_Renderer */
167 /* Retrieve the current renderer for a given glyph format. */
170 /* library :: A handle to the library object. */
172 /* format :: The glyph format. */
175 /* A renderer handle. 0~if none found. */
178 /* An error will be returned if a module already exists by that name, */
179 /* or if the module requires a version of FreeType that is too great. */
181 /* To add a new renderer, simply use @FT_Add_Module. To retrieve a */
182 /* renderer by its name, use @FT_Get_Module. */
184 FT_EXPORT( FT_Renderer
)
185 FT_Get_Renderer( FT_Library library
,
186 FT_Glyph_Format format
);
189 /*************************************************************************/
192 /* FT_Set_Renderer */
195 /* Set the current renderer to use, and set additional mode. */
198 /* library :: A handle to the library object. */
201 /* renderer :: A handle to the renderer object. */
203 /* num_params :: The number of additional parameters. */
205 /* parameters :: Additional parameters. */
208 /* FreeType error code. 0~means success. */
211 /* In case of success, the renderer will be used to convert glyph */
212 /* images in the renderer's known format into bitmaps. */
214 /* This doesn't change the current renderer for other formats. */
216 /* Currently, no FreeType renderer module uses `parameters'; you */
217 /* should thus always pass NULL as the value. */
219 FT_EXPORT( FT_Error
)
220 FT_Set_Renderer( FT_Library library
,
221 FT_Renderer renderer
,
223 FT_Parameter
* parameters
);
230 #endif /* FTRENDER_H_ */