fontservices/freetypefontrasteriser/freetype2/include/freetype/internal/ftgloadr.h
changeset 71 6cc5529d4a89
equal deleted inserted replaced
64:f66674566702 71:6cc5529d4a89
       
     1 /***************************************************************************/
       
     2 /*                                                                         */
       
     3 /*  ftgloadr.h                                                             */
       
     4 /*                                                                         */
       
     5 /*    The FreeType glyph loader (specification).                           */
       
     6 /*                                                                         */
       
     7 /*  Copyright 2002, 2003, 2005, 2006 by                                    */
       
     8 /*  David Turner, Robert Wilhelm, and Werner Lemberg                       */
       
     9 /*                                                                         */
       
    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, FTL.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.                                        */
       
    15 /*                                                                         */
       
    16 /***************************************************************************/
       
    17 
       
    18 
       
    19 #ifndef __FTGLOADR_H__
       
    20 #define __FTGLOADR_H__
       
    21 
       
    22 
       
    23 #include <ft2build.h>
       
    24 #include FT_FREETYPE_H
       
    25 
       
    26 
       
    27 FT_BEGIN_HEADER
       
    28 
       
    29 
       
    30   /*************************************************************************/
       
    31   /*                                                                       */
       
    32   /* <Struct>                                                              */
       
    33   /*    FT_GlyphLoader                                                     */
       
    34   /*                                                                       */
       
    35   /* <Description>                                                         */
       
    36   /*    The glyph loader is an internal object used to load several glyphs */
       
    37   /*    together (for example, in the case of composites).                 */
       
    38   /*                                                                       */
       
    39   /* <Note>                                                                */
       
    40   /*    The glyph loader implementation is not part of the high-level API, */
       
    41   /*    hence the forward structure declaration.                           */
       
    42   /*                                                                       */
       
    43   typedef struct FT_GlyphLoaderRec_*  FT_GlyphLoader ;
       
    44 
       
    45 
       
    46 #if 0  /* moved to freetype.h in version 2.2 */
       
    47 #define FT_SUBGLYPH_FLAG_ARGS_ARE_WORDS          1
       
    48 #define FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES      2
       
    49 #define FT_SUBGLYPH_FLAG_ROUND_XY_TO_GRID        4
       
    50 #define FT_SUBGLYPH_FLAG_SCALE                   8
       
    51 #define FT_SUBGLYPH_FLAG_XY_SCALE             0x40
       
    52 #define FT_SUBGLYPH_FLAG_2X2                  0x80
       
    53 #define FT_SUBGLYPH_FLAG_USE_MY_METRICS      0x200
       
    54 #endif
       
    55 
       
    56 
       
    57   typedef struct  FT_SubGlyphRec_
       
    58   {
       
    59     FT_Int     index;
       
    60     FT_UShort  flags;
       
    61     FT_Int     arg1;
       
    62     FT_Int     arg2;
       
    63     FT_Matrix  transform;
       
    64 
       
    65   } FT_SubGlyphRec;
       
    66 
       
    67 
       
    68   typedef struct  FT_GlyphLoadRec_
       
    69   {
       
    70     FT_Outline   outline;       /* outline             */
       
    71     FT_Vector*   extra_points;  /* extra points table  */
       
    72     FT_UInt      num_subglyphs; /* number of subglyphs */
       
    73     FT_SubGlyph  subglyphs;     /* subglyphs           */
       
    74 
       
    75   } FT_GlyphLoadRec, *FT_GlyphLoad;
       
    76 
       
    77 
       
    78   typedef struct  FT_GlyphLoaderRec_
       
    79   {
       
    80     FT_Memory        memory;
       
    81     FT_UInt          max_points;
       
    82     FT_UInt          max_contours;
       
    83     FT_UInt          max_subglyphs;
       
    84     FT_Bool          use_extra;
       
    85 
       
    86     FT_GlyphLoadRec  base;
       
    87     FT_GlyphLoadRec  current;
       
    88 
       
    89     void*            other;            /* for possible future extension? */
       
    90 
       
    91   } FT_GlyphLoaderRec;
       
    92 
       
    93 
       
    94   /* create new empty glyph loader */
       
    95   FT_BASE( FT_Error )
       
    96   FT_GlyphLoader_New( FT_Memory        memory,
       
    97                       FT_GlyphLoader  *aloader );
       
    98 
       
    99   /* add an extra points table to a glyph loader */
       
   100   FT_BASE( FT_Error )
       
   101   FT_GlyphLoader_CreateExtra( FT_GlyphLoader  loader );
       
   102 
       
   103   /* destroy a glyph loader */
       
   104   FT_BASE( void )
       
   105   FT_GlyphLoader_Done( FT_GlyphLoader  loader );
       
   106 
       
   107   /* reset a glyph loader (frees everything int it) */
       
   108   FT_BASE( void )
       
   109   FT_GlyphLoader_Reset( FT_GlyphLoader  loader );
       
   110 
       
   111   /* rewind a glyph loader */
       
   112   FT_BASE( void )
       
   113   FT_GlyphLoader_Rewind( FT_GlyphLoader  loader );
       
   114 
       
   115   /* check that there is enough space to add `n_points' and `n_contours' */
       
   116   /* to the glyph loader                                                 */
       
   117   FT_BASE( FT_Error )
       
   118   FT_GlyphLoader_CheckPoints( FT_GlyphLoader  loader,
       
   119                               FT_UInt         n_points,
       
   120                               FT_UInt         n_contours );
       
   121 
       
   122 
       
   123 #define FT_GLYPHLOADER_CHECK_P( _loader, _count )                    \
       
   124    ( (_count) == 0 || (int)((_loader)->base.outline.n_points    +    \
       
   125                             (_loader)->current.outline.n_points +    \
       
   126                             (_count)) <= (int)(_loader)->max_points )
       
   127 
       
   128 #define FT_GLYPHLOADER_CHECK_C( _loader, _count )                     \
       
   129   ( (_count) == 0 || (int)((_loader)->base.outline.n_contours    +    \
       
   130                            (_loader)->current.outline.n_contours +    \
       
   131                            (_count)) <= (int)(_loader)->max_contours )
       
   132 
       
   133 #define FT_GLYPHLOADER_CHECK_POINTS( _loader, _points,_contours )      \
       
   134   ( ( FT_GLYPHLOADER_CHECK_P( _loader, _points )   &&                  \
       
   135       FT_GLYPHLOADER_CHECK_C( _loader, _contours ) )                   \
       
   136     ? 0                                                                \
       
   137     : FT_GlyphLoader_CheckPoints( (_loader), (_points), (_contours) ) )
       
   138 
       
   139 
       
   140   /* check that there is enough space to add `n_subs' sub-glyphs to */
       
   141   /* a glyph loader                                                 */
       
   142   FT_BASE( FT_Error )
       
   143   FT_GlyphLoader_CheckSubGlyphs( FT_GlyphLoader  loader,
       
   144                                  FT_UInt         n_subs );
       
   145 
       
   146   /* prepare a glyph loader, i.e. empty the current glyph */
       
   147   FT_BASE( void )
       
   148   FT_GlyphLoader_Prepare( FT_GlyphLoader  loader );
       
   149 
       
   150   /* add the current glyph to the base glyph */
       
   151   FT_BASE( void )
       
   152   FT_GlyphLoader_Add( FT_GlyphLoader  loader );
       
   153 
       
   154   /* copy points from one glyph loader to another */
       
   155   FT_BASE( FT_Error )
       
   156   FT_GlyphLoader_CopyPoints( FT_GlyphLoader  target,
       
   157                              FT_GlyphLoader  source );
       
   158 
       
   159  /* */
       
   160 
       
   161 
       
   162 FT_END_HEADER
       
   163 
       
   164 #endif /* __FTGLOADR_H__ */
       
   165 
       
   166 
       
   167 /* END */