1
/***************************************************************************/
5
/* Support for the FT_Outline type used to store glyph shapes of */
6
/* most scalable font formats (specification). */
8
/* Copyright 1996-2001, 2002, 2003 by */
9
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
11
/* This file is part of the FreeType project, and may only be used, */
12
/* modified, and distributed under the terms of the FreeType project */
13
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
14
/* this file you indicate that you have read the license and */
15
/* understand and accept it fully. */
17
/***************************************************************************/
25
#include FT_FREETYPE_H
28
#error "freetype.h of FreeType 1 has been loaded!"
29
#error "Please fix the directory search order for header files"
30
#error "so that freetype.h of FreeType 2 is found first."
37
/*************************************************************************/
40
/* outline_processing */
43
/* Outline Processing */
46
/* Functions to create, transform, and render vectorial glyph images. */
49
/* This section contains routines used to create and destroy scalable */
50
/* glyph images known as `outlines'. These can also be measured, */
51
/* transformed, and converted into bitmaps and pixmaps. */
55
/* FT_OUTLINE_FLAGS */
59
/* FT_Outline_Translate */
60
/* FT_Outline_Transform */
61
/* FT_Outline_Reverse */
62
/* FT_Outline_Check */
64
/* FT_Outline_Get_CBox */
65
/* FT_Outline_Get_BBox */
67
/* FT_Outline_Get_Bitmap */
68
/* FT_Outline_Render */
70
/* FT_Outline_Decompose */
71
/* FT_Outline_Funcs */
72
/* FT_Outline_MoveTo_Func */
73
/* FT_Outline_LineTo_Func */
74
/* FT_Outline_ConicTo_Func */
75
/* FT_Outline_CubicTo_Func */
77
/*************************************************************************/
80
/*************************************************************************/
83
/* FT_Outline_Decompose */
86
/* Walks over an outline's structure to decompose it into individual */
87
/* segments and Bezier arcs. This function is also able to emit */
88
/* `move to' and `close to' operations to indicate the start and end */
89
/* of new contours in the outline. */
92
/* outline :: A pointer to the source target. */
94
/* func_interface :: A table of `emitters', i.e,. function pointers */
95
/* called during decomposition to indicate path */
99
/* user :: A typeless pointer which is passed to each */
100
/* emitter during the decomposition. It can be */
101
/* used to store the state during the */
105
/* FreeType error code. 0 means sucess. */
107
FT_EXPORT( FT_Error )
108
FT_Outline_Decompose( FT_Outline* outline,
109
const FT_Outline_Funcs* func_interface,
113
/*************************************************************************/
119
/* Creates a new outline of a given size. */
122
/* library :: A handle to the library object from where the */
123
/* outline is allocated. Note however that the new */
124
/* outline will NOT necessarily be FREED, when */
125
/* destroying the library, by FT_Done_FreeType(). */
127
/* numPoints :: The maximal number of points within the outline. */
129
/* numContours :: The maximal number of contours within the outline. */
132
/* anoutline :: A handle to the new outline. NULL in case of */
136
/* FreeType error code. 0 means success. */
139
/* The reason why this function takes a `library' parameter is simply */
140
/* to use the library's memory allocator. */
142
FT_EXPORT( FT_Error )
143
FT_Outline_New( FT_Library library,
146
FT_Outline *anoutline );
149
FT_EXPORT( FT_Error )
150
FT_Outline_New_Internal( FT_Memory memory,
153
FT_Outline *anoutline );
156
/*************************************************************************/
159
/* FT_Outline_Done */
162
/* Destroys an outline created with FT_Outline_New(). */
165
/* library :: A handle of the library object used to allocate the */
168
/* outline :: A pointer to the outline object to be discarded. */
171
/* FreeType error code. 0 means success. */
174
/* If the outline's `owner' field is not set, only the outline */
175
/* descriptor will be released. */
177
/* The reason why this function takes an `library' parameter is */
178
/* simply to use FT_Free(). */
180
FT_EXPORT( FT_Error )
181
FT_Outline_Done( FT_Library library,
182
FT_Outline* outline );
185
FT_EXPORT( FT_Error )
186
FT_Outline_Done_Internal( FT_Memory memory,
187
FT_Outline* outline );
190
/*************************************************************************/
193
/* FT_Outline_Check */
196
/* Check the contents of an outline descriptor. */
199
/* outline :: A handle to a source outline. */
202
/* FreeType error code. 0 means success. */
204
FT_EXPORT( FT_Error )
205
FT_Outline_Check( FT_Outline* outline );
208
/*************************************************************************/
211
/* FT_Outline_Get_CBox */
214
/* Returns an outline's `control box'. The control box encloses all */
215
/* the outline's points, including Bezier control points. Though it */
216
/* coincides with the exact bounding box for most glyphs, it can be */
217
/* slightly larger in some situations (like when rotating an outline */
218
/* which contains Bezier outside arcs). */
220
/* Computing the control box is very fast, while getting the bounding */
221
/* box can take much more time as it needs to walk over all segments */
222
/* and arcs in the outline. To get the latter, you can use the */
223
/* `ftbbox' component which is dedicated to this single task. */
226
/* outline :: A pointer to the source outline descriptor. */
229
/* acbox :: The outline's control box. */
232
FT_Outline_Get_CBox( FT_Outline* outline,
236
/*************************************************************************/
239
/* FT_Outline_Translate */
242
/* Applies a simple translation to the points of an outline. */
245
/* outline :: A pointer to the target outline descriptor. */
248
/* xOffset :: The horizontal offset. */
250
/* yOffset :: The vertical offset. */
253
FT_Outline_Translate( FT_Outline* outline,
258
/*************************************************************************/
261
/* FT_Outline_Copy */
264
/* Copies an outline into another one. Both objects must have the */
265
/* same sizes (number of points & number of contours) when this */
266
/* function is called. */
269
/* source :: A handle to the source outline. */
272
/* target :: A handle to the target outline. */
275
/* FreeType error code. 0 means success. */
277
FT_EXPORT( FT_Error )
278
FT_Outline_Copy( FT_Outline* source,
279
FT_Outline *target );
282
/*************************************************************************/
285
/* FT_Outline_Transform */
288
/* Applies a simple 2x2 matrix to all of an outline's points. Useful */
289
/* for applying rotations, slanting, flipping, etc. */
292
/* outline :: A pointer to the target outline descriptor. */
295
/* matrix :: A pointer to the transformation matrix. */
298
/* You can use FT_Outline_Translate() if you need to translate the */
299
/* outline's points. */
302
FT_Outline_Transform( FT_Outline* outline,
306
/*************************************************************************/
309
/* FT_Outline_Reverse */
312
/* Reverses the drawing direction of an outline. This is used to */
313
/* ensure consistent fill conventions for mirrored glyphs. */
316
/* outline :: A pointer to the target outline descriptor. */
319
/* This functions toggles the bit flag `FT_OUTLINE_REVERSE_FILL' in */
320
/* the outline's `flags' field. */
322
/* It shouldn't be used by a normal client application, unless it */
323
/* knows what it is doing. */
326
FT_Outline_Reverse( FT_Outline* outline );
329
/*************************************************************************/
332
/* FT_Outline_Get_Bitmap */
335
/* Renders an outline within a bitmap. The outline's image is simply */
336
/* OR-ed to the target bitmap. */
339
/* library :: A handle to a FreeType library object. */
341
/* outline :: A pointer to the source outline descriptor. */
344
/* abitmap :: A pointer to the target bitmap descriptor. */
347
/* FreeType error code. 0 means success. */
350
/* This function does NOT CREATE the bitmap, it only renders an */
351
/* outline image within the one you pass to it! */
353
/* It will use the raster correponding to the default glyph format. */
355
FT_EXPORT( FT_Error )
356
FT_Outline_Get_Bitmap( FT_Library library,
358
FT_Bitmap *abitmap );
361
/*************************************************************************/
364
/* FT_Outline_Render */
367
/* Renders an outline within a bitmap using the current scan-convert. */
368
/* This functions uses an FT_Raster_Params structure as an argument, */
369
/* allowing advanced features like direct composition, translucency, */
373
/* library :: A handle to a FreeType library object. */
375
/* outline :: A pointer to the source outline descriptor. */
378
/* params :: A pointer to a FT_Raster_Params structure used to */
379
/* describe the rendering operation. */
382
/* FreeType error code. 0 means success. */
385
/* You should know what you are doing and how FT_Raster_Params works */
386
/* to use this function. */
388
/* The field `params.source' will be set to `outline' before the scan */
389
/* converter is called, which means that the value you give to it is */
390
/* actually ignored. */
392
FT_EXPORT( FT_Error )
393
FT_Outline_Render( FT_Library library,
395
FT_Raster_Params* params );
398
/**************************************************************************
404
* A list of values used to describe an outline's contour orientation.
406
* The TrueType and Postscript specifications use different conventions
407
* to determine whether outline contours should be filled or unfilled.
410
* FT_ORIENTATION_TRUETYPE ::
411
* According to the TrueType specification, clockwise contours must
412
* be filled, and counter-clockwise ones must be unfilled.
414
* FT_ORIENTATION_POSTSCRIPT ::
415
* According to the Postscript specification, counter-clockwise contours
416
* must be filled, and clockwise ones must be unfilled.
418
* FT_ORIENTATION_FILL_RIGHT ::
419
* This is identical to @FT_ORIENTATION_TRUETYPE, but is used to
420
* remember that in TrueType, everything that is to the right of
421
* the drawing direction of a contour must be filled.
423
* FT_ORIENTATION_FILL_LEFT ::
424
* This is identical to @FT_ORIENTATION_POSTSCRIPT, but is used to
425
* remember that in Postscript, everything that is to the left of
426
* the drawing direction of a contour must be filled.
430
FT_ORIENTATION_TRUETYPE = 0,
431
FT_ORIENTATION_POSTSCRIPT = 1,
432
FT_ORIENTATION_FILL_RIGHT = FT_ORIENTATION_TRUETYPE,
433
FT_ORIENTATION_FILL_LEFT = FT_ORIENTATION_POSTSCRIPT
438
/**************************************************************************
441
* FT_Outline_Get_Orientation
444
* This function analyzes a glyph outline and tries to compute its
445
* fill orientation (see @FT_Orientation). This is done by computing
446
* the direction of each global horizontal and/or vertical extrema
447
* within the outline.
449
* Note that this will return @FT_ORIENTATION_TRUETYPE for empty
454
* A handle to the source outline.
460
FT_EXPORT( FT_Orientation )
461
FT_Outline_Get_Orientation( FT_Outline* outline );
469
#endif /* __FTOUTLN_H__ */