nuclear@0: /***************************************************************************/ nuclear@0: /* */ nuclear@0: /* ftoutln.h */ nuclear@0: /* */ nuclear@0: /* Support for the FT_Outline type used to store glyph shapes of */ nuclear@0: /* most scalable font formats (specification). */ nuclear@0: /* */ nuclear@0: /* Copyright 1996-2001, 2002, 2003, 2005, 2006, 2007, 2008, 2009, 2010 by */ nuclear@0: /* David Turner, Robert Wilhelm, and Werner Lemberg. */ nuclear@0: /* */ nuclear@0: /* This file is part of the FreeType project, and may only be used, */ nuclear@0: /* modified, and distributed under the terms of the FreeType project */ nuclear@0: /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ nuclear@0: /* this file you indicate that you have read the license and */ nuclear@0: /* understand and accept it fully. */ nuclear@0: /* */ nuclear@0: /***************************************************************************/ nuclear@0: nuclear@0: nuclear@0: #ifndef __FTOUTLN_H__ nuclear@0: #define __FTOUTLN_H__ nuclear@0: nuclear@0: nuclear@0: #include nuclear@0: #include FT_FREETYPE_H nuclear@0: nuclear@0: #ifdef FREETYPE_H nuclear@0: #error "freetype.h of FreeType 1 has been loaded!" nuclear@0: #error "Please fix the directory search order for header files" nuclear@0: #error "so that freetype.h of FreeType 2 is found first." nuclear@0: #endif nuclear@0: nuclear@0: nuclear@0: FT_BEGIN_HEADER nuclear@0: nuclear@0: nuclear@0: /*************************************************************************/ nuclear@0: /* */ nuclear@0: /*
*/ nuclear@0: /* outline_processing */ nuclear@0: /* */ nuclear@0: /* */ nuclear@0: /* Outline Processing */ nuclear@0: /* */ nuclear@0: /* <Abstract> */ nuclear@0: /* Functions to create, transform, and render vectorial glyph images. */ nuclear@0: /* */ nuclear@0: /* <Description> */ nuclear@0: /* This section contains routines used to create and destroy scalable */ nuclear@0: /* glyph images known as `outlines'. These can also be measured, */ nuclear@0: /* transformed, and converted into bitmaps and pixmaps. */ nuclear@0: /* */ nuclear@0: /* <Order> */ nuclear@0: /* FT_Outline */ nuclear@0: /* FT_OUTLINE_FLAGS */ nuclear@0: /* FT_Outline_New */ nuclear@0: /* FT_Outline_Done */ nuclear@0: /* FT_Outline_Copy */ nuclear@0: /* FT_Outline_Translate */ nuclear@0: /* FT_Outline_Transform */ nuclear@0: /* FT_Outline_Embolden */ nuclear@0: /* FT_Outline_Reverse */ nuclear@0: /* FT_Outline_Check */ nuclear@0: /* */ nuclear@0: /* FT_Outline_Get_CBox */ nuclear@0: /* FT_Outline_Get_BBox */ nuclear@0: /* */ nuclear@0: /* FT_Outline_Get_Bitmap */ nuclear@0: /* FT_Outline_Render */ nuclear@0: /* */ nuclear@0: /* FT_Outline_Decompose */ nuclear@0: /* FT_Outline_Funcs */ nuclear@0: /* FT_Outline_MoveTo_Func */ nuclear@0: /* FT_Outline_LineTo_Func */ nuclear@0: /* FT_Outline_ConicTo_Func */ nuclear@0: /* FT_Outline_CubicTo_Func */ nuclear@0: /* */ nuclear@0: /*************************************************************************/ nuclear@0: nuclear@0: nuclear@0: /*************************************************************************/ nuclear@0: /* */ nuclear@0: /* <Function> */ nuclear@0: /* FT_Outline_Decompose */ nuclear@0: /* */ nuclear@0: /* <Description> */ nuclear@0: /* Walk over an outline's structure to decompose it into individual */ nuclear@0: /* segments and Bézier arcs. This function also emits `move to' */ nuclear@0: /* operations to indicate the start of new contours in the outline. */ nuclear@0: /* */ nuclear@0: /* <Input> */ nuclear@0: /* outline :: A pointer to the source target. */ nuclear@0: /* */ nuclear@0: /* func_interface :: A table of `emitters', i.e., function pointers */ nuclear@0: /* called during decomposition to indicate path */ nuclear@0: /* operations. */ nuclear@0: /* */ nuclear@0: /* <InOut> */ nuclear@0: /* user :: A typeless pointer which is passed to each */ nuclear@0: /* emitter during the decomposition. It can be */ nuclear@0: /* used to store the state during the */ nuclear@0: /* decomposition. */ nuclear@0: /* */ nuclear@0: /* <Return> */ nuclear@0: /* FreeType error code. 0~means success. */ nuclear@0: /* */ nuclear@0: FT_EXPORT( FT_Error ) nuclear@0: FT_Outline_Decompose( FT_Outline* outline, nuclear@0: const FT_Outline_Funcs* func_interface, nuclear@0: void* user ); nuclear@0: nuclear@0: nuclear@0: /*************************************************************************/ nuclear@0: /* */ nuclear@0: /* <Function> */ nuclear@0: /* FT_Outline_New */ nuclear@0: /* */ nuclear@0: /* <Description> */ nuclear@0: /* Create a new outline of a given size. */ nuclear@0: /* */ nuclear@0: /* <Input> */ nuclear@0: /* library :: A handle to the library object from where the */ nuclear@0: /* outline is allocated. Note however that the new */ nuclear@0: /* outline will *not* necessarily be *freed*, when */ nuclear@0: /* destroying the library, by @FT_Done_FreeType. */ nuclear@0: /* */ nuclear@0: /* numPoints :: The maximal number of points within the outline. */ nuclear@0: /* */ nuclear@0: /* numContours :: The maximal number of contours within the outline. */ nuclear@0: /* */ nuclear@0: /* <Output> */ nuclear@0: /* anoutline :: A handle to the new outline. */ nuclear@0: /* */ nuclear@0: /* <Return> */ nuclear@0: /* FreeType error code. 0~means success. */ nuclear@0: /* */ nuclear@0: /* <Note> */ nuclear@0: /* The reason why this function takes a `library' parameter is simply */ nuclear@0: /* to use the library's memory allocator. */ nuclear@0: /* */ nuclear@0: FT_EXPORT( FT_Error ) nuclear@0: FT_Outline_New( FT_Library library, nuclear@0: FT_UInt numPoints, nuclear@0: FT_Int numContours, nuclear@0: FT_Outline *anoutline ); nuclear@0: nuclear@0: nuclear@0: FT_EXPORT( FT_Error ) nuclear@0: FT_Outline_New_Internal( FT_Memory memory, nuclear@0: FT_UInt numPoints, nuclear@0: FT_Int numContours, nuclear@0: FT_Outline *anoutline ); nuclear@0: nuclear@0: nuclear@0: /*************************************************************************/ nuclear@0: /* */ nuclear@0: /* <Function> */ nuclear@0: /* FT_Outline_Done */ nuclear@0: /* */ nuclear@0: /* <Description> */ nuclear@0: /* Destroy an outline created with @FT_Outline_New. */ nuclear@0: /* */ nuclear@0: /* <Input> */ nuclear@0: /* library :: A handle of the library object used to allocate the */ nuclear@0: /* outline. */ nuclear@0: /* */ nuclear@0: /* outline :: A pointer to the outline object to be discarded. */ nuclear@0: /* */ nuclear@0: /* <Return> */ nuclear@0: /* FreeType error code. 0~means success. */ nuclear@0: /* */ nuclear@0: /* <Note> */ nuclear@0: /* If the outline's `owner' field is not set, only the outline */ nuclear@0: /* descriptor will be released. */ nuclear@0: /* */ nuclear@0: /* The reason why this function takes an `library' parameter is */ nuclear@0: /* simply to use ft_mem_free(). */ nuclear@0: /* */ nuclear@0: FT_EXPORT( FT_Error ) nuclear@0: FT_Outline_Done( FT_Library library, nuclear@0: FT_Outline* outline ); nuclear@0: nuclear@0: nuclear@0: FT_EXPORT( FT_Error ) nuclear@0: FT_Outline_Done_Internal( FT_Memory memory, nuclear@0: FT_Outline* outline ); nuclear@0: nuclear@0: nuclear@0: /*************************************************************************/ nuclear@0: /* */ nuclear@0: /* <Function> */ nuclear@0: /* FT_Outline_Check */ nuclear@0: /* */ nuclear@0: /* <Description> */ nuclear@0: /* Check the contents of an outline descriptor. */ nuclear@0: /* */ nuclear@0: /* <Input> */ nuclear@0: /* outline :: A handle to a source outline. */ nuclear@0: /* */ nuclear@0: /* <Return> */ nuclear@0: /* FreeType error code. 0~means success. */ nuclear@0: /* */ nuclear@0: FT_EXPORT( FT_Error ) nuclear@0: FT_Outline_Check( FT_Outline* outline ); nuclear@0: nuclear@0: nuclear@0: /*************************************************************************/ nuclear@0: /* */ nuclear@0: /* <Function> */ nuclear@0: /* FT_Outline_Get_CBox */ nuclear@0: /* */ nuclear@0: /* <Description> */ nuclear@0: /* Return an outline's `control box'. The control box encloses all */ nuclear@0: /* the outline's points, including Bézier control points. Though it */ nuclear@0: /* coincides with the exact bounding box for most glyphs, it can be */ nuclear@0: /* slightly larger in some situations (like when rotating an outline */ nuclear@0: /* which contains Bézier outside arcs). */ nuclear@0: /* */ nuclear@0: /* Computing the control box is very fast, while getting the bounding */ nuclear@0: /* box can take much more time as it needs to walk over all segments */ nuclear@0: /* and arcs in the outline. To get the latter, you can use the */ nuclear@0: /* `ftbbox' component which is dedicated to this single task. */ nuclear@0: /* */ nuclear@0: /* <Input> */ nuclear@0: /* outline :: A pointer to the source outline descriptor. */ nuclear@0: /* */ nuclear@0: /* <Output> */ nuclear@0: /* acbox :: The outline's control box. */ nuclear@0: /* */ nuclear@0: FT_EXPORT( void ) nuclear@0: FT_Outline_Get_CBox( const FT_Outline* outline, nuclear@0: FT_BBox *acbox ); nuclear@0: nuclear@0: nuclear@0: /*************************************************************************/ nuclear@0: /* */ nuclear@0: /* <Function> */ nuclear@0: /* FT_Outline_Translate */ nuclear@0: /* */ nuclear@0: /* <Description> */ nuclear@0: /* Apply a simple translation to the points of an outline. */ nuclear@0: /* */ nuclear@0: /* <InOut> */ nuclear@0: /* outline :: A pointer to the target outline descriptor. */ nuclear@0: /* */ nuclear@0: /* <Input> */ nuclear@0: /* xOffset :: The horizontal offset. */ nuclear@0: /* */ nuclear@0: /* yOffset :: The vertical offset. */ nuclear@0: /* */ nuclear@0: FT_EXPORT( void ) nuclear@0: FT_Outline_Translate( const FT_Outline* outline, nuclear@0: FT_Pos xOffset, nuclear@0: FT_Pos yOffset ); nuclear@0: nuclear@0: nuclear@0: /*************************************************************************/ nuclear@0: /* */ nuclear@0: /* <Function> */ nuclear@0: /* FT_Outline_Copy */ nuclear@0: /* */ nuclear@0: /* <Description> */ nuclear@0: /* Copy an outline into another one. Both objects must have the */ nuclear@0: /* same sizes (number of points & number of contours) when this */ nuclear@0: /* function is called. */ nuclear@0: /* */ nuclear@0: /* <Input> */ nuclear@0: /* source :: A handle to the source outline. */ nuclear@0: /* */ nuclear@0: /* <Output> */ nuclear@0: /* target :: A handle to the target outline. */ nuclear@0: /* */ nuclear@0: /* <Return> */ nuclear@0: /* FreeType error code. 0~means success. */ nuclear@0: /* */ nuclear@0: FT_EXPORT( FT_Error ) nuclear@0: FT_Outline_Copy( const FT_Outline* source, nuclear@0: FT_Outline *target ); nuclear@0: nuclear@0: nuclear@0: /*************************************************************************/ nuclear@0: /* */ nuclear@0: /* <Function> */ nuclear@0: /* FT_Outline_Transform */ nuclear@0: /* */ nuclear@0: /* <Description> */ nuclear@0: /* Apply a simple 2x2 matrix to all of an outline's points. Useful */ nuclear@0: /* for applying rotations, slanting, flipping, etc. */ nuclear@0: /* */ nuclear@0: /* <InOut> */ nuclear@0: /* outline :: A pointer to the target outline descriptor. */ nuclear@0: /* */ nuclear@0: /* <Input> */ nuclear@0: /* matrix :: A pointer to the transformation matrix. */ nuclear@0: /* */ nuclear@0: /* <Note> */ nuclear@0: /* You can use @FT_Outline_Translate if you need to translate the */ nuclear@0: /* outline's points. */ nuclear@0: /* */ nuclear@0: FT_EXPORT( void ) nuclear@0: FT_Outline_Transform( const FT_Outline* outline, nuclear@0: const FT_Matrix* matrix ); nuclear@0: nuclear@0: nuclear@0: /*************************************************************************/ nuclear@0: /* */ nuclear@0: /* <Function> */ nuclear@0: /* FT_Outline_Embolden */ nuclear@0: /* */ nuclear@0: /* <Description> */ nuclear@0: /* Embolden an outline. The new outline will be at most 4~times */ nuclear@0: /* `strength' pixels wider and higher. You may think of the left and */ nuclear@0: /* bottom borders as unchanged. */ nuclear@0: /* */ nuclear@0: /* Negative `strength' values to reduce the outline thickness are */ nuclear@0: /* possible also. */ nuclear@0: /* */ nuclear@0: /* <InOut> */ nuclear@0: /* outline :: A handle to the target outline. */ nuclear@0: /* */ nuclear@0: /* <Input> */ nuclear@0: /* strength :: How strong the glyph is emboldened. Expressed in */ nuclear@0: /* 26.6 pixel format. */ nuclear@0: /* */ nuclear@0: /* <Return> */ nuclear@0: /* FreeType error code. 0~means success. */ nuclear@0: /* */ nuclear@0: /* <Note> */ nuclear@0: /* The used algorithm to increase or decrease the thickness of the */ nuclear@0: /* glyph doesn't change the number of points; this means that certain */ nuclear@0: /* situations like acute angles or intersections are sometimes */ nuclear@0: /* handled incorrectly. */ nuclear@0: /* */ nuclear@0: /* If you need `better' metrics values you should call */ nuclear@0: /* @FT_Outline_Get_CBox ot @FT_Outline_Get_BBox. */ nuclear@0: /* */ nuclear@0: /* Example call: */ nuclear@0: /* */ nuclear@0: /* { */ nuclear@0: /* FT_Load_Glyph( face, index, FT_LOAD_DEFAULT ); */ nuclear@0: /* if ( face->slot->format == FT_GLYPH_FORMAT_OUTLINE ) */ nuclear@0: /* FT_Outline_Embolden( &face->slot->outline, strength ); */ nuclear@0: /* } */ nuclear@0: /* */ nuclear@0: FT_EXPORT( FT_Error ) nuclear@0: FT_Outline_Embolden( FT_Outline* outline, nuclear@0: FT_Pos strength ); nuclear@0: nuclear@0: nuclear@0: /*************************************************************************/ nuclear@0: /* */ nuclear@0: /* <Function> */ nuclear@0: /* FT_Outline_Reverse */ nuclear@0: /* */ nuclear@0: /* <Description> */ nuclear@0: /* Reverse the drawing direction of an outline. This is used to */ nuclear@0: /* ensure consistent fill conventions for mirrored glyphs. */ nuclear@0: /* */ nuclear@0: /* <InOut> */ nuclear@0: /* outline :: A pointer to the target outline descriptor. */ nuclear@0: /* */ nuclear@0: /* <Note> */ nuclear@0: /* This function toggles the bit flag @FT_OUTLINE_REVERSE_FILL in */ nuclear@0: /* the outline's `flags' field. */ nuclear@0: /* */ nuclear@0: /* It shouldn't be used by a normal client application, unless it */ nuclear@0: /* knows what it is doing. */ nuclear@0: /* */ nuclear@0: FT_EXPORT( void ) nuclear@0: FT_Outline_Reverse( FT_Outline* outline ); nuclear@0: nuclear@0: nuclear@0: /*************************************************************************/ nuclear@0: /* */ nuclear@0: /* <Function> */ nuclear@0: /* FT_Outline_Get_Bitmap */ nuclear@0: /* */ nuclear@0: /* <Description> */ nuclear@0: /* Render an outline within a bitmap. The outline's image is simply */ nuclear@0: /* OR-ed to the target bitmap. */ nuclear@0: /* */ nuclear@0: /* <Input> */ nuclear@0: /* library :: A handle to a FreeType library object. */ nuclear@0: /* */ nuclear@0: /* outline :: A pointer to the source outline descriptor. */ nuclear@0: /* */ nuclear@0: /* <InOut> */ nuclear@0: /* abitmap :: A pointer to the target bitmap descriptor. */ nuclear@0: /* */ nuclear@0: /* <Return> */ nuclear@0: /* FreeType error code. 0~means success. */ nuclear@0: /* */ nuclear@0: /* <Note> */ nuclear@0: /* This function does NOT CREATE the bitmap, it only renders an */ nuclear@0: /* outline image within the one you pass to it! Consequently, the */ nuclear@0: /* various fields in `abitmap' should be set accordingly. */ nuclear@0: /* */ nuclear@0: /* It will use the raster corresponding to the default glyph format. */ nuclear@0: /* */ nuclear@0: /* The value of the `num_grays' field in `abitmap' is ignored. If */ nuclear@0: /* you select the gray-level rasterizer, and you want less than 256 */ nuclear@0: /* gray levels, you have to use @FT_Outline_Render directly. */ nuclear@0: /* */ nuclear@0: FT_EXPORT( FT_Error ) nuclear@0: FT_Outline_Get_Bitmap( FT_Library library, nuclear@0: FT_Outline* outline, nuclear@0: const FT_Bitmap *abitmap ); nuclear@0: nuclear@0: nuclear@0: /*************************************************************************/ nuclear@0: /* */ nuclear@0: /* <Function> */ nuclear@0: /* FT_Outline_Render */ nuclear@0: /* */ nuclear@0: /* <Description> */ nuclear@0: /* Render an outline within a bitmap using the current scan-convert. */ nuclear@0: /* This function uses an @FT_Raster_Params structure as an argument, */ nuclear@0: /* allowing advanced features like direct composition, translucency, */ nuclear@0: /* etc. */ nuclear@0: /* */ nuclear@0: /* <Input> */ nuclear@0: /* library :: A handle to a FreeType library object. */ nuclear@0: /* */ nuclear@0: /* outline :: A pointer to the source outline descriptor. */ nuclear@0: /* */ nuclear@0: /* <InOut> */ nuclear@0: /* params :: A pointer to an @FT_Raster_Params structure used to */ nuclear@0: /* describe the rendering operation. */ nuclear@0: /* */ nuclear@0: /* <Return> */ nuclear@0: /* FreeType error code. 0~means success. */ nuclear@0: /* */ nuclear@0: /* <Note> */ nuclear@0: /* You should know what you are doing and how @FT_Raster_Params works */ nuclear@0: /* to use this function. */ nuclear@0: /* */ nuclear@0: /* The field `params.source' will be set to `outline' before the scan */ nuclear@0: /* converter is called, which means that the value you give to it is */ nuclear@0: /* actually ignored. */ nuclear@0: /* */ nuclear@0: /* The gray-level rasterizer always uses 256 gray levels. If you */ nuclear@0: /* want less gray levels, you have to provide your own span callback. */ nuclear@0: /* See the @FT_RASTER_FLAG_DIRECT value of the `flags' field in the */ nuclear@0: /* @FT_Raster_Params structure for more details. */ nuclear@0: /* */ nuclear@0: FT_EXPORT( FT_Error ) nuclear@0: FT_Outline_Render( FT_Library library, nuclear@0: FT_Outline* outline, nuclear@0: FT_Raster_Params* params ); nuclear@0: nuclear@0: nuclear@0: /************************************************************************** nuclear@0: * nuclear@0: * @enum: nuclear@0: * FT_Orientation nuclear@0: * nuclear@0: * @description: nuclear@0: * A list of values used to describe an outline's contour orientation. nuclear@0: * nuclear@0: * The TrueType and PostScript specifications use different conventions nuclear@0: * to determine whether outline contours should be filled or unfilled. nuclear@0: * nuclear@0: * @values: nuclear@0: * FT_ORIENTATION_TRUETYPE :: nuclear@0: * According to the TrueType specification, clockwise contours must nuclear@0: * be filled, and counter-clockwise ones must be unfilled. nuclear@0: * nuclear@0: * FT_ORIENTATION_POSTSCRIPT :: nuclear@0: * According to the PostScript specification, counter-clockwise contours nuclear@0: * must be filled, and clockwise ones must be unfilled. nuclear@0: * nuclear@0: * FT_ORIENTATION_FILL_RIGHT :: nuclear@0: * This is identical to @FT_ORIENTATION_TRUETYPE, but is used to nuclear@0: * remember that in TrueType, everything that is to the right of nuclear@0: * the drawing direction of a contour must be filled. nuclear@0: * nuclear@0: * FT_ORIENTATION_FILL_LEFT :: nuclear@0: * This is identical to @FT_ORIENTATION_POSTSCRIPT, but is used to nuclear@0: * remember that in PostScript, everything that is to the left of nuclear@0: * the drawing direction of a contour must be filled. nuclear@0: * nuclear@0: * FT_ORIENTATION_NONE :: nuclear@0: * The orientation cannot be determined. That is, different parts of nuclear@0: * the glyph have different orientation. nuclear@0: * nuclear@0: */ nuclear@0: typedef enum FT_Orientation_ nuclear@0: { nuclear@0: FT_ORIENTATION_TRUETYPE = 0, nuclear@0: FT_ORIENTATION_POSTSCRIPT = 1, nuclear@0: FT_ORIENTATION_FILL_RIGHT = FT_ORIENTATION_TRUETYPE, nuclear@0: FT_ORIENTATION_FILL_LEFT = FT_ORIENTATION_POSTSCRIPT, nuclear@0: FT_ORIENTATION_NONE nuclear@0: nuclear@0: } FT_Orientation; nuclear@0: nuclear@0: nuclear@0: /************************************************************************** nuclear@0: * nuclear@0: * @function: nuclear@0: * FT_Outline_Get_Orientation nuclear@0: * nuclear@0: * @description: nuclear@0: * This function analyzes a glyph outline and tries to compute its nuclear@0: * fill orientation (see @FT_Orientation). This is done by computing nuclear@0: * the direction of each global horizontal and/or vertical extrema nuclear@0: * within the outline. nuclear@0: * nuclear@0: * Note that this will return @FT_ORIENTATION_TRUETYPE for empty nuclear@0: * outlines. nuclear@0: * nuclear@0: * @input: nuclear@0: * outline :: nuclear@0: * A handle to the source outline. nuclear@0: * nuclear@0: * @return: nuclear@0: * The orientation. nuclear@0: * nuclear@0: */ nuclear@0: FT_EXPORT( FT_Orientation ) nuclear@0: FT_Outline_Get_Orientation( FT_Outline* outline ); nuclear@0: nuclear@0: nuclear@0: /* */ nuclear@0: nuclear@0: nuclear@0: FT_END_HEADER nuclear@0: nuclear@0: #endif /* __FTOUTLN_H__ */ nuclear@0: nuclear@0: nuclear@0: /* END */ nuclear@0: nuclear@0: nuclear@0: /* Local Variables: */ nuclear@0: /* coding: utf-8 */ nuclear@0: /* End: */