ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

ftoutln.h
Go to the documentation of this file.
00001 /***************************************************************************/
00002 /*                                                                         */
00003 /*  ftoutln.h                                                              */
00004 /*                                                                         */
00005 /*    Support for the FT_Outline type used to store glyph shapes of        */
00006 /*    most scalable font formats (specification).                          */
00007 /*                                                                         */
00008 /*  Copyright 1996-2001, 2002, 2003, 2005, 2006, 2007, 2008, 2009, 2010 by */
00009 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
00010 /*                                                                         */
00011 /*  This file is part of the FreeType project, and may only be used,       */
00012 /*  modified, and distributed under the terms of the FreeType project      */
00013 /*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
00014 /*  this file you indicate that you have read the license and              */
00015 /*  understand and accept it fully.                                        */
00016 /*                                                                         */
00017 /***************************************************************************/
00018 
00019 
00020 #ifndef __FTOUTLN_H__
00021 #define __FTOUTLN_H__
00022 
00023 
00024 #include <ft2build.h>
00025 #include FT_FREETYPE_H
00026 
00027 #ifdef FREETYPE_H
00028 #error "freetype.h of FreeType 1 has been loaded!"
00029 #error "Please fix the directory search order for header files"
00030 #error "so that freetype.h of FreeType 2 is found first."
00031 #endif
00032 
00033 
00034 FT_BEGIN_HEADER
00035 
00036 
00037   /*************************************************************************/
00038   /*                                                                       */
00039   /* <Section>                                                             */
00040   /*    outline_processing                                                 */
00041   /*                                                                       */
00042   /* <Title>                                                               */
00043   /*    Outline Processing                                                 */
00044   /*                                                                       */
00045   /* <Abstract>                                                            */
00046   /*    Functions to create, transform, and render vectorial glyph images. */
00047   /*                                                                       */
00048   /* <Description>                                                         */
00049   /*    This section contains routines used to create and destroy scalable */
00050   /*    glyph images known as `outlines'.  These can also be measured,     */
00051   /*    transformed, and converted into bitmaps and pixmaps.               */
00052   /*                                                                       */
00053   /* <Order>                                                               */
00054   /*    FT_Outline                                                         */
00055   /*    FT_OUTLINE_FLAGS                                                   */
00056   /*    FT_Outline_New                                                     */
00057   /*    FT_Outline_Done                                                    */
00058   /*    FT_Outline_Copy                                                    */
00059   /*    FT_Outline_Translate                                               */
00060   /*    FT_Outline_Transform                                               */
00061   /*    FT_Outline_Embolden                                                */
00062   /*    FT_Outline_Reverse                                                 */
00063   /*    FT_Outline_Check                                                   */
00064   /*                                                                       */
00065   /*    FT_Outline_Get_CBox                                                */
00066   /*    FT_Outline_Get_BBox                                                */
00067   /*                                                                       */
00068   /*    FT_Outline_Get_Bitmap                                              */
00069   /*    FT_Outline_Render                                                  */
00070   /*                                                                       */
00071   /*    FT_Outline_Decompose                                               */
00072   /*    FT_Outline_Funcs                                                   */
00073   /*    FT_Outline_MoveTo_Func                                             */
00074   /*    FT_Outline_LineTo_Func                                             */
00075   /*    FT_Outline_ConicTo_Func                                            */
00076   /*    FT_Outline_CubicTo_Func                                            */
00077   /*                                                                       */
00078   /*************************************************************************/
00079 
00080 
00081   /*************************************************************************/
00082   /*                                                                       */
00083   /* <Function>                                                            */
00084   /*    FT_Outline_Decompose                                               */
00085   /*                                                                       */
00086   /* <Description>                                                         */
00087   /*    Walk over an outline's structure to decompose it into individual   */
00088   /*    segments and Bézier arcs.  This function also emits `move to'      */
00089   /*    operations to indicate the start of new contours in the outline.   */
00090   /*                                                                       */
00091   /* <Input>                                                               */
00092   /*    outline        :: A pointer to the source target.                  */
00093   /*                                                                       */
00094   /*    func_interface :: A table of `emitters', i.e., function pointers   */
00095   /*                      called during decomposition to indicate path     */
00096   /*                      operations.                                      */
00097   /*                                                                       */
00098   /* <InOut>                                                               */
00099   /*    user           :: A typeless pointer which is passed to each       */
00100   /*                      emitter during the decomposition.  It can be     */
00101   /*                      used to store the state during the               */
00102   /*                      decomposition.                                   */
00103   /*                                                                       */
00104   /* <Return>                                                              */
00105   /*    FreeType error code.  0~means success.                             */
00106   /*                                                                       */
00107   FT_EXPORT( FT_Error )
00108   FT_Outline_Decompose( FT_Outline*              outline,
00109                         const FT_Outline_Funcs*  func_interface,
00110                         void*                    user );
00111 
00112 
00113   /*************************************************************************/
00114   /*                                                                       */
00115   /* <Function>                                                            */
00116   /*    FT_Outline_New                                                     */
00117   /*                                                                       */
00118   /* <Description>                                                         */
00119   /*    Create a new outline of a given size.                              */
00120   /*                                                                       */
00121   /* <Input>                                                               */
00122   /*    library     :: A handle to the library object from where the       */
00123   /*                   outline is allocated.  Note however that the new    */
00124   /*                   outline will *not* necessarily be *freed*, when     */
00125   /*                   destroying the library, by @FT_Done_FreeType.       */
00126   /*                                                                       */
00127   /*    numPoints   :: The maximal number of points within the outline.    */
00128   /*                                                                       */
00129   /*    numContours :: The maximal number of contours within the outline.  */
00130   /*                                                                       */
00131   /* <Output>                                                              */
00132   /*    anoutline   :: A handle to the new outline.                        */
00133   /*                                                                       */
00134   /* <Return>                                                              */
00135   /*    FreeType error code.  0~means success.                             */
00136   /*                                                                       */
00137   /* <Note>                                                                */
00138   /*    The reason why this function takes a `library' parameter is simply */
00139   /*    to use the library's memory allocator.                             */
00140   /*                                                                       */
00141   FT_EXPORT( FT_Error )
00142   FT_Outline_New( FT_Library   library,
00143                   FT_UInt      numPoints,
00144                   FT_Int       numContours,
00145                   FT_Outline  *anoutline );
00146 
00147 
00148   FT_EXPORT( FT_Error )
00149   FT_Outline_New_Internal( FT_Memory    memory,
00150                            FT_UInt      numPoints,
00151                            FT_Int       numContours,
00152                            FT_Outline  *anoutline );
00153 
00154 
00155   /*************************************************************************/
00156   /*                                                                       */
00157   /* <Function>                                                            */
00158   /*    FT_Outline_Done                                                    */
00159   /*                                                                       */
00160   /* <Description>                                                         */
00161   /*    Destroy an outline created with @FT_Outline_New.                   */
00162   /*                                                                       */
00163   /* <Input>                                                               */
00164   /*    library :: A handle of the library object used to allocate the     */
00165   /*               outline.                                                */
00166   /*                                                                       */
00167   /*    outline :: A pointer to the outline object to be discarded.        */
00168   /*                                                                       */
00169   /* <Return>                                                              */
00170   /*    FreeType error code.  0~means success.                             */
00171   /*                                                                       */
00172   /* <Note>                                                                */
00173   /*    If the outline's `owner' field is not set, only the outline        */
00174   /*    descriptor will be released.                                       */
00175   /*                                                                       */
00176   /*    The reason why this function takes an `library' parameter is       */
00177   /*    simply to use ft_mem_free().                                       */
00178   /*                                                                       */
00179   FT_EXPORT( FT_Error )
00180   FT_Outline_Done( FT_Library   library,
00181                    FT_Outline*  outline );
00182 
00183 
00184   FT_EXPORT( FT_Error )
00185   FT_Outline_Done_Internal( FT_Memory    memory,
00186                             FT_Outline*  outline );
00187 
00188 
00189   /*************************************************************************/
00190   /*                                                                       */
00191   /* <Function>                                                            */
00192   /*    FT_Outline_Check                                                   */
00193   /*                                                                       */
00194   /* <Description>                                                         */
00195   /*    Check the contents of an outline descriptor.                       */
00196   /*                                                                       */
00197   /* <Input>                                                               */
00198   /*    outline :: A handle to a source outline.                           */
00199   /*                                                                       */
00200   /* <Return>                                                              */
00201   /*    FreeType error code.  0~means success.                             */
00202   /*                                                                       */
00203   FT_EXPORT( FT_Error )
00204   FT_Outline_Check( FT_Outline*  outline );
00205 
00206 
00207   /*************************************************************************/
00208   /*                                                                       */
00209   /* <Function>                                                            */
00210   /*    FT_Outline_Get_CBox                                                */
00211   /*                                                                       */
00212   /* <Description>                                                         */
00213   /*    Return an outline's `control box'.  The control box encloses all   */
00214   /*    the outline's points, including Bézier control points.  Though it  */
00215   /*    coincides with the exact bounding box for most glyphs, it can be   */
00216   /*    slightly larger in some situations (like when rotating an outline  */
00217   /*    which contains Bézier outside arcs).                               */
00218   /*                                                                       */
00219   /*    Computing the control box is very fast, while getting the bounding */
00220   /*    box can take much more time as it needs to walk over all segments  */
00221   /*    and arcs in the outline.  To get the latter, you can use the       */
00222   /*    `ftbbox' component which is dedicated to this single task.         */
00223   /*                                                                       */
00224   /* <Input>                                                               */
00225   /*    outline :: A pointer to the source outline descriptor.             */
00226   /*                                                                       */
00227   /* <Output>                                                              */
00228   /*    acbox   :: The outline's control box.                              */
00229   /*                                                                       */
00230   FT_EXPORT( void )
00231   FT_Outline_Get_CBox( const FT_Outline*  outline,
00232                        FT_BBox           *acbox );
00233 
00234 
00235   /*************************************************************************/
00236   /*                                                                       */
00237   /* <Function>                                                            */
00238   /*    FT_Outline_Translate                                               */
00239   /*                                                                       */
00240   /* <Description>                                                         */
00241   /*    Apply a simple translation to the points of an outline.            */
00242   /*                                                                       */
00243   /* <InOut>                                                               */
00244   /*    outline :: A pointer to the target outline descriptor.             */
00245   /*                                                                       */
00246   /* <Input>                                                               */
00247   /*    xOffset :: The horizontal offset.                                  */
00248   /*                                                                       */
00249   /*    yOffset :: The vertical offset.                                    */
00250   /*                                                                       */
00251   FT_EXPORT( void )
00252   FT_Outline_Translate( const FT_Outline*  outline,
00253                         FT_Pos             xOffset,
00254                         FT_Pos             yOffset );
00255 
00256 
00257   /*************************************************************************/
00258   /*                                                                       */
00259   /* <Function>                                                            */
00260   /*    FT_Outline_Copy                                                    */
00261   /*                                                                       */
00262   /* <Description>                                                         */
00263   /*    Copy an outline into another one.  Both objects must have the      */
00264   /*    same sizes (number of points & number of contours) when this       */
00265   /*    function is called.                                                */
00266   /*                                                                       */
00267   /* <Input>                                                               */
00268   /*    source :: A handle to the source outline.                          */
00269   /*                                                                       */
00270   /* <Output>                                                              */
00271   /*    target :: A handle to the target outline.                          */
00272   /*                                                                       */
00273   /* <Return>                                                              */
00274   /*    FreeType error code.  0~means success.                             */
00275   /*                                                                       */
00276   FT_EXPORT( FT_Error )
00277   FT_Outline_Copy( const FT_Outline*  source,
00278                    FT_Outline        *target );
00279 
00280 
00281   /*************************************************************************/
00282   /*                                                                       */
00283   /* <Function>                                                            */
00284   /*    FT_Outline_Transform                                               */
00285   /*                                                                       */
00286   /* <Description>                                                         */
00287   /*    Apply a simple 2x2 matrix to all of an outline's points.  Useful   */
00288   /*    for applying rotations, slanting, flipping, etc.                   */
00289   /*                                                                       */
00290   /* <InOut>                                                               */
00291   /*    outline :: A pointer to the target outline descriptor.             */
00292   /*                                                                       */
00293   /* <Input>                                                               */
00294   /*    matrix  :: A pointer to the transformation matrix.                 */
00295   /*                                                                       */
00296   /* <Note>                                                                */
00297   /*    You can use @FT_Outline_Translate if you need to translate the     */
00298   /*    outline's points.                                                  */
00299   /*                                                                       */
00300   FT_EXPORT( void )
00301   FT_Outline_Transform( const FT_Outline*  outline,
00302                         const FT_Matrix*   matrix );
00303 
00304 
00305   /*************************************************************************/
00306   /*                                                                       */
00307   /* <Function>                                                            */
00308   /*    FT_Outline_Embolden                                                */
00309   /*                                                                       */
00310   /* <Description>                                                         */
00311   /*    Embolden an outline.  The new outline will be at most 4~times      */
00312   /*    `strength' pixels wider and higher.  You may think of the left and */
00313   /*    bottom borders as unchanged.                                       */
00314   /*                                                                       */
00315   /*    Negative `strength' values to reduce the outline thickness are     */
00316   /*    possible also.                                                     */
00317   /*                                                                       */
00318   /* <InOut>                                                               */
00319   /*    outline  :: A handle to the target outline.                        */
00320   /*                                                                       */
00321   /* <Input>                                                               */
00322   /*    strength :: How strong the glyph is emboldened.  Expressed in      */
00323   /*                26.6 pixel format.                                     */
00324   /*                                                                       */
00325   /* <Return>                                                              */
00326   /*    FreeType error code.  0~means success.                             */
00327   /*                                                                       */
00328   /* <Note>                                                                */
00329   /*    The used algorithm to increase or decrease the thickness of the    */
00330   /*    glyph doesn't change the number of points; this means that certain */
00331   /*    situations like acute angles or intersections are sometimes        */
00332   /*    handled incorrectly.                                               */
00333   /*                                                                       */
00334   /*    If you need `better' metrics values you should call                */
00335   /*    @FT_Outline_Get_CBox ot @FT_Outline_Get_BBox.                      */
00336   /*                                                                       */
00337   /*    Example call:                                                      */
00338   /*                                                                       */
00339   /*    {                                                                  */
00340   /*      FT_Load_Glyph( face, index, FT_LOAD_DEFAULT );                   */
00341   /*      if ( face->slot->format == FT_GLYPH_FORMAT_OUTLINE )             */
00342   /*        FT_Outline_Embolden( &face->slot->outline, strength );         */
00343   /*    }                                                                  */
00344   /*                                                                       */
00345   FT_EXPORT( FT_Error )
00346   FT_Outline_Embolden( FT_Outline*  outline,
00347                        FT_Pos       strength );
00348 
00349 
00350   /*************************************************************************/
00351   /*                                                                       */
00352   /* <Function>                                                            */
00353   /*    FT_Outline_Reverse                                                 */
00354   /*                                                                       */
00355   /* <Description>                                                         */
00356   /*    Reverse the drawing direction of an outline.  This is used to      */
00357   /*    ensure consistent fill conventions for mirrored glyphs.            */
00358   /*                                                                       */
00359   /* <InOut>                                                               */
00360   /*    outline :: A pointer to the target outline descriptor.             */
00361   /*                                                                       */
00362   /* <Note>                                                                */
00363   /*    This function toggles the bit flag @FT_OUTLINE_REVERSE_FILL in     */
00364   /*    the outline's `flags' field.                                       */
00365   /*                                                                       */
00366   /*    It shouldn't be used by a normal client application, unless it     */
00367   /*    knows what it is doing.                                            */
00368   /*                                                                       */
00369   FT_EXPORT( void )
00370   FT_Outline_Reverse( FT_Outline*  outline );
00371 
00372 
00373   /*************************************************************************/
00374   /*                                                                       */
00375   /* <Function>                                                            */
00376   /*    FT_Outline_Get_Bitmap                                              */
00377   /*                                                                       */
00378   /* <Description>                                                         */
00379   /*    Render an outline within a bitmap.  The outline's image is simply  */
00380   /*    OR-ed to the target bitmap.                                        */
00381   /*                                                                       */
00382   /* <Input>                                                               */
00383   /*    library :: A handle to a FreeType library object.                  */
00384   /*                                                                       */
00385   /*    outline :: A pointer to the source outline descriptor.             */
00386   /*                                                                       */
00387   /* <InOut>                                                               */
00388   /*    abitmap :: A pointer to the target bitmap descriptor.              */
00389   /*                                                                       */
00390   /* <Return>                                                              */
00391   /*    FreeType error code.  0~means success.                             */
00392   /*                                                                       */
00393   /* <Note>                                                                */
00394   /*    This function does NOT CREATE the bitmap, it only renders an       */
00395   /*    outline image within the one you pass to it!  Consequently, the    */
00396   /*    various fields in `abitmap' should be set accordingly.             */
00397   /*                                                                       */
00398   /*    It will use the raster corresponding to the default glyph format.  */
00399   /*                                                                       */
00400   /*    The value of the `num_grays' field in `abitmap' is ignored.  If    */
00401   /*    you select the gray-level rasterizer, and you want less than 256   */
00402   /*    gray levels, you have to use @FT_Outline_Render directly.          */
00403   /*                                                                       */
00404   FT_EXPORT( FT_Error )
00405   FT_Outline_Get_Bitmap( FT_Library        library,
00406                          FT_Outline*       outline,
00407                          const FT_Bitmap  *abitmap );
00408 
00409 
00410   /*************************************************************************/
00411   /*                                                                       */
00412   /* <Function>                                                            */
00413   /*    FT_Outline_Render                                                  */
00414   /*                                                                       */
00415   /* <Description>                                                         */
00416   /*    Render an outline within a bitmap using the current scan-convert.  */
00417   /*    This function uses an @FT_Raster_Params structure as an argument,  */
00418   /*    allowing advanced features like direct composition, translucency,  */
00419   /*    etc.                                                               */
00420   /*                                                                       */
00421   /* <Input>                                                               */
00422   /*    library :: A handle to a FreeType library object.                  */
00423   /*                                                                       */
00424   /*    outline :: A pointer to the source outline descriptor.             */
00425   /*                                                                       */
00426   /* <InOut>                                                               */
00427   /*    params  :: A pointer to an @FT_Raster_Params structure used to     */
00428   /*               describe the rendering operation.                       */
00429   /*                                                                       */
00430   /* <Return>                                                              */
00431   /*    FreeType error code.  0~means success.                             */
00432   /*                                                                       */
00433   /* <Note>                                                                */
00434   /*    You should know what you are doing and how @FT_Raster_Params works */
00435   /*    to use this function.                                              */
00436   /*                                                                       */
00437   /*    The field `params.source' will be set to `outline' before the scan */
00438   /*    converter is called, which means that the value you give to it is  */
00439   /*    actually ignored.                                                  */
00440   /*                                                                       */
00441   /*    The gray-level rasterizer always uses 256 gray levels.  If you     */
00442   /*    want less gray levels, you have to provide your own span callback. */
00443   /*    See the @FT_RASTER_FLAG_DIRECT value of the `flags' field in the   */
00444   /*    @FT_Raster_Params structure for more details.                      */
00445   /*                                                                       */
00446   FT_EXPORT( FT_Error )
00447   FT_Outline_Render( FT_Library         library,
00448                      FT_Outline*        outline,
00449                      FT_Raster_Params*  params );
00450 
00451 
00452  /**************************************************************************
00453   *
00454   * @enum:
00455   *   FT_Orientation
00456   *
00457   * @description:
00458   *   A list of values used to describe an outline's contour orientation.
00459   *
00460   *   The TrueType and PostScript specifications use different conventions
00461   *   to determine whether outline contours should be filled or unfilled.
00462   *
00463   * @values:
00464   *   FT_ORIENTATION_TRUETYPE ::
00465   *     According to the TrueType specification, clockwise contours must
00466   *     be filled, and counter-clockwise ones must be unfilled.
00467   *
00468   *   FT_ORIENTATION_POSTSCRIPT ::
00469   *     According to the PostScript specification, counter-clockwise contours
00470   *     must be filled, and clockwise ones must be unfilled.
00471   *
00472   *   FT_ORIENTATION_FILL_RIGHT ::
00473   *     This is identical to @FT_ORIENTATION_TRUETYPE, but is used to
00474   *     remember that in TrueType, everything that is to the right of
00475   *     the drawing direction of a contour must be filled.
00476   *
00477   *   FT_ORIENTATION_FILL_LEFT ::
00478   *     This is identical to @FT_ORIENTATION_POSTSCRIPT, but is used to
00479   *     remember that in PostScript, everything that is to the left of
00480   *     the drawing direction of a contour must be filled.
00481   *
00482   *   FT_ORIENTATION_NONE ::
00483   *     The orientation cannot be determined.  That is, different parts of
00484   *     the glyph have different orientation.
00485   *
00486   */
00487   typedef enum  FT_Orientation_
00488   {
00489     FT_ORIENTATION_TRUETYPE   = 0,
00490     FT_ORIENTATION_POSTSCRIPT = 1,
00491     FT_ORIENTATION_FILL_RIGHT = FT_ORIENTATION_TRUETYPE,
00492     FT_ORIENTATION_FILL_LEFT  = FT_ORIENTATION_POSTSCRIPT,
00493     FT_ORIENTATION_NONE
00494 
00495   } FT_Orientation;
00496 
00497 
00498  /**************************************************************************
00499   *
00500   * @function:
00501   *   FT_Outline_Get_Orientation
00502   *
00503   * @description:
00504   *   This function analyzes a glyph outline and tries to compute its
00505   *   fill orientation (see @FT_Orientation).  This is done by computing
00506   *   the direction of each global horizontal and/or vertical extrema
00507   *   within the outline.
00508   *
00509   *   Note that this will return @FT_ORIENTATION_TRUETYPE for empty
00510   *   outlines.
00511   *
00512   * @input:
00513   *   outline ::
00514   *     A handle to the source outline.
00515   *
00516   * @return:
00517   *   The orientation.
00518   *
00519   */
00520   FT_EXPORT( FT_Orientation )
00521   FT_Outline_Get_Orientation( FT_Outline*  outline );
00522 
00523 
00524   /* */
00525 
00526 
00527 FT_END_HEADER
00528 
00529 #endif /* __FTOUTLN_H__ */
00530 
00531 
00532 /* END */
00533 
00534 
00535 /* Local Variables: */
00536 /* coding: utf-8    */
00537 /* End:             */

Generated on Sun May 27 2012 04:33:31 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.