1 /****************************************************************************
5 * FreeType renderer modules public interface (specification).
7 * Copyright (C) 1996-2020 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.
23 #include <freetype/ftmodapi.h>
24 #include <freetype/ftglyph.h>
30 /**************************************************************************
38 /* create a new glyph object */
40 (*FT_Glyph_InitFunc)( FT_Glyph glyph,
43 /* destroys a given glyph object */
45 (*FT_Glyph_DoneFunc)( FT_Glyph glyph );
48 (*FT_Glyph_TransformFunc)( FT_Glyph glyph,
49 const FT_Matrix* matrix,
50 const FT_Vector* delta );
53 (*FT_Glyph_GetBBoxFunc)( FT_Glyph glyph,
57 (*FT_Glyph_CopyFunc)( FT_Glyph source,
61 (*FT_Glyph_PrepareFunc)( FT_Glyph glyph,
65 #define FT_Glyph_Init_Func FT_Glyph_InitFunc
66 #define FT_Glyph_Done_Func FT_Glyph_DoneFunc
67 #define FT_Glyph_Transform_Func FT_Glyph_TransformFunc
68 #define FT_Glyph_BBox_Func FT_Glyph_GetBBoxFunc
69 #define FT_Glyph_Copy_Func FT_Glyph_CopyFunc
70 #define FT_Glyph_Prepare_Func FT_Glyph_PrepareFunc
73 struct FT_Glyph_Class_
76 FT_Glyph_Format glyph_format;
78 FT_Glyph_InitFunc glyph_init;
79 FT_Glyph_DoneFunc glyph_done;
80 FT_Glyph_CopyFunc glyph_copy;
81 FT_Glyph_TransformFunc glyph_transform;
82 FT_Glyph_GetBBoxFunc glyph_bbox;
83 FT_Glyph_PrepareFunc glyph_prepare;
88 (*FT_Renderer_RenderFunc)( FT_Renderer renderer,
91 const FT_Vector* origin );
94 (*FT_Renderer_TransformFunc)( FT_Renderer renderer,
96 const FT_Matrix* matrix,
97 const FT_Vector* delta );
101 (*FT_Renderer_GetCBoxFunc)( FT_Renderer renderer,
107 (*FT_Renderer_SetModeFunc)( FT_Renderer renderer,
109 FT_Pointer mode_ptr );
111 /* deprecated identifiers */
112 #define FTRenderer_render FT_Renderer_RenderFunc
113 #define FTRenderer_transform FT_Renderer_TransformFunc
114 #define FTRenderer_getCBox FT_Renderer_GetCBoxFunc
115 #define FTRenderer_setMode FT_Renderer_SetModeFunc
118 /**************************************************************************
124 * The renderer module class descriptor.
128 * The root @FT_Module_Class fields.
131 * The glyph image format this renderer handles.
134 * A method used to render the image that is in a given glyph slot into
138 * A method used to transform the image that is in a given glyph slot.
141 * A method used to access the glyph's cbox.
144 * A method used to pass additional parameters.
147 * For @FT_GLYPH_FORMAT_OUTLINE renderers only. This is a pointer to
148 * its raster's class.
150 typedef struct FT_Renderer_Class_
152 FT_Module_Class root;
154 FT_Glyph_Format glyph_format;
156 FT_Renderer_RenderFunc render_glyph;
157 FT_Renderer_TransformFunc transform_glyph;
158 FT_Renderer_GetCBoxFunc get_glyph_cbox;
159 FT_Renderer_SetModeFunc set_mode;
161 FT_Raster_Funcs* raster_class;
166 /**************************************************************************
172 * Retrieve the current renderer for a given glyph format.
176 * A handle to the library object.
182 * A renderer handle. 0~if none found.
185 * An error will be returned if a module already exists by that name, or
186 * if the module requires a version of FreeType that is too great.
188 * To add a new renderer, simply use @FT_Add_Module. To retrieve a
189 * renderer by its name, use @FT_Get_Module.
191 FT_EXPORT( FT_Renderer )
192 FT_Get_Renderer( FT_Library library,
193 FT_Glyph_Format format );
196 /**************************************************************************
202 * Set the current renderer to use, and set additional mode.
206 * A handle to the library object.
210 * A handle to the renderer object.
213 * The number of additional parameters.
216 * Additional parameters.
219 * FreeType error code. 0~means success.
222 * In case of success, the renderer will be used to convert glyph images
223 * in the renderer's known format into bitmaps.
225 * This doesn't change the current renderer for other formats.
227 * Currently, no FreeType renderer module uses `parameters`; you should
228 * thus always pass `NULL` as the value.
230 FT_EXPORT( FT_Error )
231 FT_Set_Renderer( FT_Library library,
232 FT_Renderer renderer,
234 FT_Parameter* parameters );
241 #endif /* FTRENDER_H_ */