src/java.desktop/share/native/libfreetype/include/freetype/internal/ftobjs.h
changeset 54876 da3834261f0c
parent 50479 70e706c85f1d
equal deleted inserted replaced
54875:bcfedddcf4ce 54876:da3834261f0c
     1 /***************************************************************************/
     1 /****************************************************************************
     2 /*                                                                         */
     2  *
     3 /*  ftobjs.h                                                               */
     3  * ftobjs.h
     4 /*                                                                         */
     4  *
     5 /*    The FreeType private base classes (specification).                   */
     5  *   The FreeType private base classes (specification).
     6 /*                                                                         */
     6  *
     7 /*  Copyright 1996-2018 by                                                 */
     7  * Copyright (C) 1996-2019 by
     8 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
     8  * David Turner, Robert Wilhelm, and Werner Lemberg.
     9 /*                                                                         */
     9  *
    10 /*  This file is part of the FreeType project, and may only be used,       */
    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      */
    11  * modified, and distributed under the terms of the FreeType project
    12 /*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
    12  * license, LICENSE.TXT.  By continuing to use, modify, or distribute
    13 /*  this file you indicate that you have read the license and              */
    13  * this file you indicate that you have read the license and
    14 /*  understand and accept it fully.                                        */
    14  * understand and accept it fully.
    15 /*                                                                         */
    15  *
    16 /***************************************************************************/
    16  */
    17 
    17 
    18 
    18 
    19   /*************************************************************************/
    19   /**************************************************************************
    20   /*                                                                       */
    20    *
    21   /*  This file contains the definition of all internal FreeType classes.  */
    21    * This file contains the definition of all internal FreeType classes.
    22   /*                                                                       */
    22    *
    23   /*************************************************************************/
    23    */
    24 
    24 
    25 
    25 
    26 #ifndef FTOBJS_H_
    26 #ifndef FTOBJS_H_
    27 #define FTOBJS_H_
    27 #define FTOBJS_H_
    28 
    28 
    33 #include FT_INTERNAL_MEMORY_H
    33 #include FT_INTERNAL_MEMORY_H
    34 #include FT_INTERNAL_GLYPH_LOADER_H
    34 #include FT_INTERNAL_GLYPH_LOADER_H
    35 #include FT_INTERNAL_DRIVER_H
    35 #include FT_INTERNAL_DRIVER_H
    36 #include FT_INTERNAL_AUTOHINT_H
    36 #include FT_INTERNAL_AUTOHINT_H
    37 #include FT_INTERNAL_SERVICE_H
    37 #include FT_INTERNAL_SERVICE_H
    38 #include FT_INTERNAL_PIC_H
       
    39 #include FT_INTERNAL_CALC_H
    38 #include FT_INTERNAL_CALC_H
    40 
    39 
    41 #ifdef FT_CONFIG_OPTION_INCREMENTAL
    40 #ifdef FT_CONFIG_OPTION_INCREMENTAL
    42 #include FT_INCREMENTAL_H
    41 #include FT_INCREMENTAL_H
    43 #endif
    42 #endif
    44 
    43 
    45 
    44 
    46 FT_BEGIN_HEADER
    45 FT_BEGIN_HEADER
    47 
    46 
    48 
    47 
    49   /*************************************************************************/
    48   /**************************************************************************
    50   /*                                                                       */
    49    *
    51   /* Some generic definitions.                                             */
    50    * Some generic definitions.
    52   /*                                                                       */
    51    */
    53 #ifndef TRUE
    52 #ifndef TRUE
    54 #define TRUE  1
    53 #define TRUE  1
    55 #endif
    54 #endif
    56 
    55 
    57 #ifndef FALSE
    56 #ifndef FALSE
    61 #ifndef NULL
    60 #ifndef NULL
    62 #define NULL  (void*)0
    61 #define NULL  (void*)0
    63 #endif
    62 #endif
    64 
    63 
    65 
    64 
    66   /*************************************************************************/
    65   /**************************************************************************
    67   /*                                                                       */
    66    *
    68   /* The min and max functions missing in C.  As usual, be careful not to  */
    67    * The min and max functions missing in C.  As usual, be careful not to
    69   /* write things like FT_MIN( a++, b++ ) to avoid side effects.           */
    68    * write things like FT_MIN( a++, b++ ) to avoid side effects.
    70   /*                                                                       */
    69    */
    71 #define FT_MIN( a, b )  ( (a) < (b) ? (a) : (b) )
    70 #define FT_MIN( a, b )  ( (a) < (b) ? (a) : (b) )
    72 #define FT_MAX( a, b )  ( (a) > (b) ? (a) : (b) )
    71 #define FT_MAX( a, b )  ( (a) > (b) ? (a) : (b) )
    73 
    72 
    74 #define FT_ABS( a )     ( (a) < 0 ? -(a) : (a) )
    73 #define FT_ABS( a )     ( (a) < 0 ? -(a) : (a) )
    75 
    74 
    76   /*
    75   /*
    77    *  Approximate sqrt(x*x+y*y) using the `alpha max plus beta min'
    76    * Approximate sqrt(x*x+y*y) using the `alpha max plus beta min' algorithm.
    78    *  algorithm.  We use alpha = 1, beta = 3/8, giving us results with a
    77    * We use alpha = 1, beta = 3/8, giving us results with a largest error
    79    *  largest error less than 7% compared to the exact value.
    78    * less than 7% compared to the exact value.
    80    */
    79    */
    81 #define FT_HYPOT( x, y )                 \
    80 #define FT_HYPOT( x, y )                 \
    82           ( x = FT_ABS( x ),             \
    81           ( x = FT_ABS( x ),             \
    83             y = FT_ABS( y ),             \
    82             y = FT_ABS( y ),             \
    84             x > y ? x + ( 3 * y >> 3 )   \
    83             x > y ? x + ( 3 * y >> 3 )   \
   109 #define FT_PIX_ROUND_INT32( x )     FT_PIX_FLOOR( ADD_INT32( (x), 32 ) )
   108 #define FT_PIX_ROUND_INT32( x )     FT_PIX_FLOOR( ADD_INT32( (x), 32 ) )
   110 #define FT_PIX_CEIL_INT32( x )      FT_PIX_FLOOR( ADD_INT32( (x), 63 ) )
   109 #define FT_PIX_CEIL_INT32( x )      FT_PIX_FLOOR( ADD_INT32( (x), 63 ) )
   111 
   110 
   112 
   111 
   113   /*
   112   /*
   114    *  character classification functions -- since these are used to parse
   113    * character classification functions -- since these are used to parse font
   115    *  font files, we must not use those in <ctypes.h> which are
   114    * files, we must not use those in <ctypes.h> which are locale-dependent
   116    *  locale-dependent
       
   117    */
   115    */
   118 #define  ft_isdigit( x )   ( ( (unsigned)(x) - '0' ) < 10U )
   116 #define  ft_isdigit( x )   ( ( (unsigned)(x) - '0' ) < 10U )
   119 
   117 
   120 #define  ft_isxdigit( x )  ( ( (unsigned)(x) - '0' ) < 10U || \
   118 #define  ft_isxdigit( x )  ( ( (unsigned)(x) - '0' ) < 10U || \
   121                              ( (unsigned)(x) - 'a' ) < 6U  || \
   119                              ( (unsigned)(x) - 'a' ) < 6U  || \
   185   (*FT_CMap_CharVarIndexFunc)( FT_CMap    cmap,
   183   (*FT_CMap_CharVarIndexFunc)( FT_CMap    cmap,
   186                                FT_CMap    unicode_cmap,
   184                                FT_CMap    unicode_cmap,
   187                                FT_UInt32  char_code,
   185                                FT_UInt32  char_code,
   188                                FT_UInt32  variant_selector );
   186                                FT_UInt32  variant_selector );
   189 
   187 
   190   typedef FT_Bool
   188   typedef FT_Int
   191   (*FT_CMap_CharVarIsDefaultFunc)( FT_CMap    cmap,
   189   (*FT_CMap_CharVarIsDefaultFunc)( FT_CMap    cmap,
   192                                    FT_UInt32  char_code,
   190                                    FT_UInt32  char_code,
   193                                    FT_UInt32  variant_selector );
   191                                    FT_UInt32  variant_selector );
   194 
   192 
   195   typedef FT_UInt32 *
   193   typedef FT_UInt32 *
   225     FT_CMap_CharVariantListFunc   charvariant_list;
   223     FT_CMap_CharVariantListFunc   charvariant_list;
   226     FT_CMap_VariantCharListFunc   variantchar_list;
   224     FT_CMap_VariantCharListFunc   variantchar_list;
   227 
   225 
   228   } FT_CMap_ClassRec;
   226   } FT_CMap_ClassRec;
   229 
   227 
   230 
       
   231 #ifndef FT_CONFIG_OPTION_PIC
       
   232 
   228 
   233 #define FT_DECLARE_CMAP_CLASS( class_ )              \
   229 #define FT_DECLARE_CMAP_CLASS( class_ )              \
   234   FT_CALLBACK_TABLE const  FT_CMap_ClassRec class_;
   230   FT_CALLBACK_TABLE const  FT_CMap_ClassRec class_;
   235 
   231 
   236 #define FT_DEFINE_CMAP_CLASS(       \
   232 #define FT_DEFINE_CMAP_CLASS(       \
   258     variant_list_,                  \
   254     variant_list_,                  \
   259     charvariant_list_,              \
   255     charvariant_list_,              \
   260     variantchar_list_               \
   256     variantchar_list_               \
   261   };
   257   };
   262 
   258 
   263 #else /* FT_CONFIG_OPTION_PIC */
       
   264 
       
   265 #define FT_DECLARE_CMAP_CLASS( class_ )                  \
       
   266   void                                                   \
       
   267   FT_Init_Class_ ## class_( FT_Library         library,  \
       
   268                             FT_CMap_ClassRec*  clazz );
       
   269 
       
   270 #define FT_DEFINE_CMAP_CLASS(                            \
       
   271           class_,                                        \
       
   272           size_,                                         \
       
   273           init_,                                         \
       
   274           done_,                                         \
       
   275           char_index_,                                   \
       
   276           char_next_,                                    \
       
   277           char_var_index_,                               \
       
   278           char_var_default_,                             \
       
   279           variant_list_,                                 \
       
   280           charvariant_list_,                             \
       
   281           variantchar_list_ )                            \
       
   282   void                                                   \
       
   283   FT_Init_Class_ ## class_( FT_Library         library,  \
       
   284                             FT_CMap_ClassRec*  clazz )   \
       
   285   {                                                      \
       
   286     FT_UNUSED( library );                                \
       
   287                                                          \
       
   288     clazz->size             = size_;                     \
       
   289     clazz->init             = init_;                     \
       
   290     clazz->done             = done_;                     \
       
   291     clazz->char_index       = char_index_;               \
       
   292     clazz->char_next        = char_next_;                \
       
   293     clazz->char_var_index   = char_var_index_;           \
       
   294     clazz->char_var_default = char_var_default_;         \
       
   295     clazz->variant_list     = variant_list_;             \
       
   296     clazz->charvariant_list = charvariant_list_;         \
       
   297     clazz->variantchar_list = variantchar_list_;         \
       
   298   }
       
   299 
       
   300 #endif /* FT_CONFIG_OPTION_PIC */
       
   301 
       
   302 
   259 
   303   /* create a new charmap and add it to charmap->face */
   260   /* create a new charmap and add it to charmap->face */
   304   FT_BASE( FT_Error )
   261   FT_BASE( FT_Error )
   305   FT_CMap_New( FT_CMap_Class  clazz,
   262   FT_CMap_New( FT_CMap_Class  clazz,
   306                FT_Pointer     init_data,
   263                FT_Pointer     init_data,
   310   /* destroy a charmap and remove it from face's list */
   267   /* destroy a charmap and remove it from face's list */
   311   FT_BASE( void )
   268   FT_BASE( void )
   312   FT_CMap_Done( FT_CMap  cmap );
   269   FT_CMap_Done( FT_CMap  cmap );
   313 
   270 
   314 
   271 
   315   /* adds LCD padding to Min and Max boundaries */
   272   /* add LCD padding to CBox */
   316   FT_BASE( void )
   273   FT_BASE( void )
   317   ft_lcd_padding( FT_Pos*       Min,
   274   ft_lcd_padding( FT_BBox*        cbox,
   318                   FT_Pos*       Max,
   275                   FT_GlyphSlot    slot,
   319                   FT_GlyphSlot  slot );
   276                   FT_Render_Mode  mode );
   320 
   277 
   321 #ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING
   278 #ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING
   322 
   279 
   323   typedef void  (*FT_Bitmap_LcdFilterFunc)( FT_Bitmap*      bitmap,
   280   typedef void  (*FT_Bitmap_LcdFilterFunc)( FT_Bitmap*      bitmap,
   324                                             FT_Render_Mode  render_mode,
   281                                             FT_Render_Mode  render_mode,
   331                      FT_Render_Mode       mode,
   288                      FT_Render_Mode       mode,
   332                      FT_LcdFiveTapFilter  weights );
   289                      FT_LcdFiveTapFilter  weights );
   333 
   290 
   334 #endif /* FT_CONFIG_OPTION_SUBPIXEL_RENDERING */
   291 #endif /* FT_CONFIG_OPTION_SUBPIXEL_RENDERING */
   335 
   292 
   336   /*************************************************************************/
   293   /**************************************************************************
   337   /*                                                                       */
   294    *
   338   /* <Struct>                                                              */
   295    * @struct:
   339   /*    FT_Face_InternalRec                                                */
   296    *   FT_Face_InternalRec
   340   /*                                                                       */
   297    *
   341   /* <Description>                                                         */
   298    * @description:
   342   /*    This structure contains the internal fields of each FT_Face        */
   299    *   This structure contains the internal fields of each FT_Face object.
   343   /*    object.  These fields may change between different releases of     */
   300    *   These fields may change between different releases of FreeType.
   344   /*    FreeType.                                                          */
   301    *
   345   /*                                                                       */
   302    * @fields:
   346   /* <Fields>                                                              */
   303    *   max_points ::
   347   /*    max_points ::                                                      */
   304    *     The maximum number of points used to store the vectorial outline of
   348   /*      The maximum number of points used to store the vectorial outline */
   305    *     any glyph in this face.  If this value cannot be known in advance,
   349   /*      of any glyph in this face.  If this value cannot be known in     */
   306    *     or if the face isn't scalable, this should be set to 0.  Only
   350   /*      advance, or if the face isn't scalable, this should be set to 0. */
   307    *     relevant for scalable formats.
   351   /*      Only relevant for scalable formats.                              */
   308    *
   352   /*                                                                       */
   309    *   max_contours ::
   353   /*    max_contours ::                                                    */
   310    *     The maximum number of contours used to store the vectorial outline
   354   /*      The maximum number of contours used to store the vectorial       */
   311    *     of any glyph in this face.  If this value cannot be known in
   355   /*      outline of any glyph in this face.  If this value cannot be      */
   312    *     advance, or if the face isn't scalable, this should be set to 0.
   356   /*      known in advance, or if the face isn't scalable, this should be  */
   313    *     Only relevant for scalable formats.
   357   /*      set to 0.  Only relevant for scalable formats.                   */
   314    *
   358   /*                                                                       */
   315    *   transform_matrix ::
   359   /*    transform_matrix ::                                                */
   316    *     A 2x2 matrix of 16.16 coefficients used to transform glyph outlines
   360   /*      A 2x2 matrix of 16.16 coefficients used to transform glyph       */
   317    *     after they are loaded from the font.  Only used by the convenience
   361   /*      outlines after they are loaded from the font.  Only used by the  */
   318    *     functions.
   362   /*      convenience functions.                                           */
   319    *
   363   /*                                                                       */
   320    *   transform_delta ::
   364   /*    transform_delta ::                                                 */
   321    *     A translation vector used to transform glyph outlines after they are
   365   /*      A translation vector used to transform glyph outlines after they */
   322    *     loaded from the font.  Only used by the convenience functions.
   366   /*      are loaded from the font.  Only used by the convenience          */
   323    *
   367   /*      functions.                                                       */
   324    *   transform_flags ::
   368   /*                                                                       */
   325    *     Some flags used to classify the transform.  Only used by the
   369   /*    transform_flags ::                                                 */
   326    *     convenience functions.
   370   /*      Some flags used to classify the transform.  Only used by the     */
   327    *
   371   /*      convenience functions.                                           */
   328    *   services ::
   372   /*                                                                       */
   329    *     A cache for frequently used services.  It should be only accessed
   373   /*    services ::                                                        */
   330    *     with the macro `FT_FACE_LOOKUP_SERVICE`.
   374   /*      A cache for frequently used services.  It should be only         */
   331    *
   375   /*      accessed with the macro `FT_FACE_LOOKUP_SERVICE'.                */
   332    *   incremental_interface ::
   376   /*                                                                       */
   333    *     If non-null, the interface through which glyph data and metrics are
   377   /*    incremental_interface ::                                           */
   334    *     loaded incrementally for faces that do not provide all of this data
   378   /*      If non-null, the interface through which glyph data and metrics  */
   335    *     when first opened.  This field exists only if
   379   /*      are loaded incrementally for faces that do not provide all of    */
   336    *     @FT_CONFIG_OPTION_INCREMENTAL is defined.
   380   /*      this data when first opened.  This field exists only if          */
   337    *
   381   /*      @FT_CONFIG_OPTION_INCREMENTAL is defined.                        */
   338    *   no_stem_darkening ::
   382   /*                                                                       */
   339    *     Overrides the module-level default, see @stem-darkening[cff], for
   383   /*    no_stem_darkening ::                                               */
   340    *     example.  FALSE and TRUE toggle stem darkening on and off,
   384   /*      Overrides the module-level default, see @stem-darkening[cff],    */
   341    *     respectively, value~-1 means to use the module/driver default.
   385   /*      for example.  FALSE and TRUE toggle stem darkening on and off,   */
   342    *
   386   /*      respectively, value~-1 means to use the module/driver default.   */
   343    *   random_seed ::
   387   /*                                                                       */
   344    *     If positive, override the seed value for the CFF 'random' operator.
   388   /*    random_seed ::                                                     */
   345    *     Value~0 means to use the font's value.  Value~-1 means to use the
   389   /*      If positive, override the seed value for the CFF `random'        */
   346    *     CFF driver's default.
   390   /*      operator.  Value~0 means to use the font's value.  Value~-1      */
   347    *
   391   /*      means to use the CFF driver's default.                           */
   348    *   lcd_weights ::
   392   /*                                                                       */
   349    *   lcd_filter_func ::
   393   /*    lcd_weights      ::                                                */
   350    *     These fields specify the LCD filtering weights and callback function
   394   /*    lcd_filter_func  ::                                                */
   351    *     for ClearType-style subpixel rendering.
   395   /*      If subpixel rendering is activated, the LCD filtering weights    */
   352    *
   396   /*      and callback function.                                           */
   353    *   refcount ::
   397   /*                                                                       */
   354    *     A counter initialized to~1 at the time an @FT_Face structure is
   398   /*    refcount ::                                                        */
   355    *     created.  @FT_Reference_Face increments this counter, and
   399   /*      A counter initialized to~1 at the time an @FT_Face structure is  */
   356    *     @FT_Done_Face only destroys a face if the counter is~1, otherwise it
   400   /*      created.  @FT_Reference_Face increments this counter, and        */
   357    *     simply decrements it.
   401   /*      @FT_Done_Face only destroys a face if the counter is~1,          */
   358    */
   402   /*      otherwise it simply decrements it.                               */
       
   403   /*                                                                       */
       
   404   typedef struct  FT_Face_InternalRec_
   359   typedef struct  FT_Face_InternalRec_
   405   {
   360   {
   406     FT_Matrix  transform_matrix;
   361     FT_Matrix  transform_matrix;
   407     FT_Vector  transform_delta;
   362     FT_Vector  transform_delta;
   408     FT_Int     transform_flags;
   363     FT_Int     transform_flags;
   424     FT_Int  refcount;
   379     FT_Int  refcount;
   425 
   380 
   426   } FT_Face_InternalRec;
   381   } FT_Face_InternalRec;
   427 
   382 
   428 
   383 
   429   /*************************************************************************/
   384   /**************************************************************************
   430   /*                                                                       */
   385    *
   431   /* <Struct>                                                              */
   386    * @struct:
   432   /*    FT_Slot_InternalRec                                                */
   387    *   FT_Slot_InternalRec
   433   /*                                                                       */
   388    *
   434   /* <Description>                                                         */
   389    * @description:
   435   /*    This structure contains the internal fields of each FT_GlyphSlot   */
   390    *   This structure contains the internal fields of each FT_GlyphSlot
   436   /*    object.  These fields may change between different releases of     */
   391    *   object.  These fields may change between different releases of
   437   /*    FreeType.                                                          */
   392    *   FreeType.
   438   /*                                                                       */
   393    *
   439   /* <Fields>                                                              */
   394    * @fields:
   440   /*    loader            :: The glyph loader object used to load outlines */
   395    *   loader ::
   441   /*                         into the glyph slot.                          */
   396    *     The glyph loader object used to load outlines into the glyph slot.
   442   /*                                                                       */
   397    *
   443   /*    flags             :: Possible values are zero or                   */
   398    *   flags ::
   444   /*                         FT_GLYPH_OWN_BITMAP.  The latter indicates    */
   399    *     Possible values are zero or FT_GLYPH_OWN_BITMAP.  The latter
   445   /*                         that the FT_GlyphSlot structure owns the      */
   400    *     indicates that the FT_GlyphSlot structure owns the bitmap buffer.
   446   /*                         bitmap buffer.                                */
   401    *
   447   /*                                                                       */
   402    *   glyph_transformed ::
   448   /*    glyph_transformed :: Boolean.  Set to TRUE when the loaded glyph   */
   403    *     Boolean.  Set to TRUE when the loaded glyph must be transformed
   449   /*                         must be transformed through a specific        */
   404    *     through a specific font transformation.  This is _not_ the same as
   450   /*                         font transformation.  This is _not_ the same  */
   405    *     the face transform set through FT_Set_Transform().
   451   /*                         as the face transform set through             */
   406    *
   452   /*                         FT_Set_Transform().                           */
   407    *   glyph_matrix ::
   453   /*                                                                       */
   408    *     The 2x2 matrix corresponding to the glyph transformation, if
   454   /*    glyph_matrix      :: The 2x2 matrix corresponding to the glyph     */
   409    *     necessary.
   455   /*                         transformation, if necessary.                 */
   410    *
   456   /*                                                                       */
   411    *   glyph_delta ::
   457   /*    glyph_delta       :: The 2d translation vector corresponding to    */
   412    *     The 2d translation vector corresponding to the glyph transformation,
   458   /*                         the glyph transformation, if necessary.       */
   413    *     if necessary.
   459   /*                                                                       */
   414    *
   460   /*    glyph_hints       :: Format-specific glyph hints management.       */
   415    *   glyph_hints ::
   461   /*                                                                       */
   416    *     Format-specific glyph hints management.
       
   417    *
       
   418    *   load_flags ::
       
   419    *     The load flags passed as an argument to @FT_Load_Glyph while
       
   420    *     initializing the glyph slot.
       
   421    */
   462 
   422 
   463 #define FT_GLYPH_OWN_BITMAP  0x1U
   423 #define FT_GLYPH_OWN_BITMAP  0x1U
   464 
   424 
   465   typedef struct  FT_Slot_InternalRec_
   425   typedef struct  FT_Slot_InternalRec_
   466   {
   426   {
   469     FT_Bool         glyph_transformed;
   429     FT_Bool         glyph_transformed;
   470     FT_Matrix       glyph_matrix;
   430     FT_Matrix       glyph_matrix;
   471     FT_Vector       glyph_delta;
   431     FT_Vector       glyph_delta;
   472     void*           glyph_hints;
   432     void*           glyph_hints;
   473 
   433 
       
   434     FT_Int32        load_flags;
       
   435 
   474   } FT_GlyphSlot_InternalRec;
   436   } FT_GlyphSlot_InternalRec;
   475 
   437 
   476 
   438 
   477   /*************************************************************************/
   439   /**************************************************************************
   478   /*                                                                       */
   440    *
   479   /* <Struct>                                                              */
   441    * @struct:
   480   /*    FT_Size_InternalRec                                                */
   442    *   FT_Size_InternalRec
   481   /*                                                                       */
   443    *
   482   /* <Description>                                                         */
   444    * @description:
   483   /*    This structure contains the internal fields of each FT_Size        */
   445    *   This structure contains the internal fields of each FT_Size object.
   484   /*    object.                                                            */
   446    *
   485   /*                                                                       */
   447    * @fields:
   486   /* <Fields>                                                              */
   448    *   module_data ::
   487   /*    module_data      :: Data specific to a driver module.              */
   449    *     Data specific to a driver module.
   488   /*                                                                       */
   450    *
   489   /*    autohint_mode    :: The used auto-hinting mode.                    */
   451    *   autohint_mode ::
   490   /*                                                                       */
   452    *     The used auto-hinting mode.
   491   /*    autohint_metrics :: Metrics used by the auto-hinter.               */
   453    *
   492   /*                                                                       */
   454    *   autohint_metrics ::
   493   /*************************************************************************/
   455    *     Metrics used by the auto-hinter.
       
   456    *
       
   457    */
   494 
   458 
   495   typedef struct  FT_Size_InternalRec_
   459   typedef struct  FT_Size_InternalRec_
   496   {
   460   {
   497     void*  module_data;
   461     void*  module_data;
   498 
   462 
   513   /*************************************************************************/
   477   /*************************************************************************/
   514   /*************************************************************************/
   478   /*************************************************************************/
   515   /*************************************************************************/
   479   /*************************************************************************/
   516 
   480 
   517 
   481 
   518   /*************************************************************************/
   482   /**************************************************************************
   519   /*                                                                       */
   483    *
   520   /* <Struct>                                                              */
   484    * @struct:
   521   /*    FT_ModuleRec                                                       */
   485    *   FT_ModuleRec
   522   /*                                                                       */
   486    *
   523   /* <Description>                                                         */
   487    * @description:
   524   /*    A module object instance.                                          */
   488    *   A module object instance.
   525   /*                                                                       */
   489    *
   526   /* <Fields>                                                              */
   490    * @fields:
   527   /*    clazz   :: A pointer to the module's class.                        */
   491    *   clazz ::
   528   /*                                                                       */
   492    *     A pointer to the module's class.
   529   /*    library :: A handle to the parent library object.                  */
   493    *
   530   /*                                                                       */
   494    *   library ::
   531   /*    memory  :: A handle to the memory manager.                         */
   495    *     A handle to the parent library object.
   532   /*                                                                       */
   496    *
       
   497    *   memory ::
       
   498    *     A handle to the memory manager.
       
   499    */
   533   typedef struct  FT_ModuleRec_
   500   typedef struct  FT_ModuleRec_
   534   {
   501   {
   535     FT_Module_Class*  clazz;
   502     FT_Module_Class*  clazz;
   536     FT_Library        library;
   503     FT_Library        library;
   537     FT_Memory         memory;
   504     FT_Memory         memory;
   570 
   537 
   571 #define FT_DRIVER_HINTS_LIGHTLY( x )  ( FT_MODULE_CLASS( x )->module_flags & \
   538 #define FT_DRIVER_HINTS_LIGHTLY( x )  ( FT_MODULE_CLASS( x )->module_flags & \
   572                                         FT_MODULE_DRIVER_HINTS_LIGHTLY )
   539                                         FT_MODULE_DRIVER_HINTS_LIGHTLY )
   573 
   540 
   574 
   541 
   575   /*************************************************************************/
   542   /**************************************************************************
   576   /*                                                                       */
   543    *
   577   /* <Function>                                                            */
   544    * @function:
   578   /*    FT_Get_Module_Interface                                            */
   545    *   FT_Get_Module_Interface
   579   /*                                                                       */
   546    *
   580   /* <Description>                                                         */
   547    * @description:
   581   /*    Finds a module and returns its specific interface as a typeless    */
   548    *   Finds a module and returns its specific interface as a typeless
   582   /*    pointer.                                                           */
   549    *   pointer.
   583   /*                                                                       */
   550    *
   584   /* <Input>                                                               */
   551    * @input:
   585   /*    library     :: A handle to the library object.                     */
   552    *   library ::
   586   /*                                                                       */
   553    *     A handle to the library object.
   587   /*    module_name :: The module's name (as an ASCII string).             */
   554    *
   588   /*                                                                       */
   555    *   module_name ::
   589   /* <Return>                                                              */
   556    *     The module's name (as an ASCII string).
   590   /*    A module-specific interface if available, 0 otherwise.             */
   557    *
   591   /*                                                                       */
   558    * @return:
   592   /* <Note>                                                                */
   559    *   A module-specific interface if available, 0 otherwise.
   593   /*    You should better be familiar with FreeType internals to know      */
   560    *
   594   /*    which module to look for, and what its interface is :-)            */
   561    * @note:
   595   /*                                                                       */
   562    *   You should better be familiar with FreeType internals to know which
       
   563    *   module to look for, and what its interface is :-)
       
   564    */
   596   FT_BASE( const void* )
   565   FT_BASE( const void* )
   597   FT_Get_Module_Interface( FT_Library   library,
   566   FT_Get_Module_Interface( FT_Library   library,
   598                            const char*  mod_name );
   567                            const char*  mod_name );
   599 
   568 
   600   FT_BASE( FT_Pointer )
   569   FT_BASE( FT_Pointer )
   641 
   610 
   642 #define FT_FACE_SLOT( x )     FT_FACE( x )->glyph
   611 #define FT_FACE_SLOT( x )     FT_FACE( x )->glyph
   643 #define FT_FACE_SIZE( x )     FT_FACE( x )->size
   612 #define FT_FACE_SIZE( x )     FT_FACE( x )->size
   644 
   613 
   645 
   614 
   646   /*************************************************************************/
   615   /**************************************************************************
   647   /*                                                                       */
   616    *
   648   /* <Function>                                                            */
   617    * @function:
   649   /*    FT_New_GlyphSlot                                                   */
   618    *   FT_New_GlyphSlot
   650   /*                                                                       */
   619    *
   651   /* <Description>                                                         */
   620    * @description:
   652   /*    It is sometimes useful to have more than one glyph slot for a      */
   621    *   It is sometimes useful to have more than one glyph slot for a given
   653   /*    given face object.  This function is used to create additional     */
   622    *   face object.  This function is used to create additional slots.  All
   654   /*    slots.  All of them are automatically discarded when the face is   */
   623    *   of them are automatically discarded when the face is destroyed.
   655   /*    destroyed.                                                         */
   624    *
   656   /*                                                                       */
   625    * @input:
   657   /* <Input>                                                               */
   626    *   face ::
   658   /*    face  :: A handle to a parent face object.                         */
   627    *     A handle to a parent face object.
   659   /*                                                                       */
   628    *
   660   /* <Output>                                                              */
   629    * @output:
   661   /*    aslot :: A handle to a new glyph slot object.                      */
   630    *   aslot ::
   662   /*                                                                       */
   631    *     A handle to a new glyph slot object.
   663   /* <Return>                                                              */
   632    *
   664   /*    FreeType error code.  0 means success.                             */
   633    * @return:
   665   /*                                                                       */
   634    *   FreeType error code.  0 means success.
       
   635    */
   666   FT_BASE( FT_Error )
   636   FT_BASE( FT_Error )
   667   FT_New_GlyphSlot( FT_Face        face,
   637   FT_New_GlyphSlot( FT_Face        face,
   668                     FT_GlyphSlot  *aslot );
   638                     FT_GlyphSlot  *aslot );
   669 
   639 
   670 
   640 
   671   /*************************************************************************/
   641   /**************************************************************************
   672   /*                                                                       */
   642    *
   673   /* <Function>                                                            */
   643    * @function:
   674   /*    FT_Done_GlyphSlot                                                  */
   644    *   FT_Done_GlyphSlot
   675   /*                                                                       */
   645    *
   676   /* <Description>                                                         */
   646    * @description:
   677   /*    Destroys a given glyph slot.  Remember however that all slots are  */
   647    *   Destroys a given glyph slot.  Remember however that all slots are
   678   /*    automatically destroyed with its parent.  Using this function is   */
   648    *   automatically destroyed with its parent.  Using this function is not
   679   /*    not always mandatory.                                              */
   649    *   always mandatory.
   680   /*                                                                       */
   650    *
   681   /* <Input>                                                               */
   651    * @input:
   682   /*    slot :: A handle to a target glyph slot.                           */
   652    *   slot ::
   683   /*                                                                       */
   653    *     A handle to a target glyph slot.
       
   654    */
   684   FT_BASE( void )
   655   FT_BASE( void )
   685   FT_Done_GlyphSlot( FT_GlyphSlot  slot );
   656   FT_Done_GlyphSlot( FT_GlyphSlot  slot );
   686 
   657 
   687  /* */
   658  /* */
   688 
   659 
   728   /* was allocated with ft_glyphslot_alloc_bitmap).                       */
   699   /* was allocated with ft_glyphslot_alloc_bitmap).                       */
   729   FT_BASE( void )
   700   FT_BASE( void )
   730   ft_glyphslot_free_bitmap( FT_GlyphSlot  slot );
   701   ft_glyphslot_free_bitmap( FT_GlyphSlot  slot );
   731 
   702 
   732 
   703 
   733   /* Preset bitmap metrics of an outline glyphslot prior to rendering. */
   704   /* Preset bitmap metrics of an outline glyphslot prior to rendering */
   734   FT_BASE( void )
   705   /* and check whether the truncated bbox is too large for rendering. */
       
   706   FT_BASE( FT_Bool )
   735   ft_glyphslot_preset_bitmap( FT_GlyphSlot      slot,
   707   ft_glyphslot_preset_bitmap( FT_GlyphSlot      slot,
   736                               FT_Render_Mode    mode,
   708                               FT_Render_Mode    mode,
   737                               const FT_Vector*  origin );
   709                               const FT_Vector*  origin );
   738 
   710 
   739   /* Allocate a new bitmap buffer in a glyph slot. */
   711   /* Allocate a new bitmap buffer in a glyph slot. */
   800 
   772 
   801   /* typecast a module as a driver, and get its driver class */
   773   /* typecast a module as a driver, and get its driver class */
   802 #define FT_DRIVER_CLASS( x )  FT_DRIVER( x )->clazz
   774 #define FT_DRIVER_CLASS( x )  FT_DRIVER( x )->clazz
   803 
   775 
   804 
   776 
   805   /*************************************************************************/
   777   /**************************************************************************
   806   /*                                                                       */
   778    *
   807   /* <Struct>                                                              */
   779    * @struct:
   808   /*    FT_DriverRec                                                       */
   780    *   FT_DriverRec
   809   /*                                                                       */
   781    *
   810   /* <Description>                                                         */
   782    * @description:
   811   /*    The root font driver class.  A font driver is responsible for      */
   783    *   The root font driver class.  A font driver is responsible for managing
   812   /*    managing and loading font files of a given format.                 */
   784    *   and loading font files of a given format.
   813   /*                                                                       */
   785    *
   814   /*  <Fields>                                                             */
   786    * @fields:
   815   /*     root         :: Contains the fields of the root module class.     */
   787    *   root ::
   816   /*                                                                       */
   788    *     Contains the fields of the root module class.
   817   /*     clazz        :: A pointer to the font driver's class.  Note that  */
   789    *
   818   /*                     this is NOT root.clazz.  `class' wasn't used      */
   790    *   clazz ::
   819   /*                     as it is a reserved word in C++.                  */
   791    *     A pointer to the font driver's class.  Note that this is NOT
   820   /*                                                                       */
   792    *     root.clazz.  'class' wasn't used as it is a reserved word in C++.
   821   /*     faces_list   :: The list of faces currently opened by this        */
   793    *
   822   /*                     driver.                                           */
   794    *   faces_list ::
   823   /*                                                                       */
   795    *     The list of faces currently opened by this driver.
   824   /*     glyph_loader :: Unused.  Used to be glyph loader for all faces    */
   796    *
   825   /*                     managed by this driver.                           */
   797    *   glyph_loader ::
   826   /*                                                                       */
   798    *     Unused.  Used to be glyph loader for all faces managed by this
       
   799    *     driver.
       
   800    */
   827   typedef struct  FT_DriverRec_
   801   typedef struct  FT_DriverRec_
   828   {
   802   {
   829     FT_ModuleRec     root;
   803     FT_ModuleRec     root;
   830     FT_Driver_Class  clazz;
   804     FT_Driver_Class  clazz;
   831     FT_ListRec       faces_list;
   805     FT_ListRec       faces_list;
   845   /*************************************************************************/
   819   /*************************************************************************/
   846   /*************************************************************************/
   820   /*************************************************************************/
   847   /*************************************************************************/
   821   /*************************************************************************/
   848 
   822 
   849 
   823 
   850   /* This hook is used by the TrueType debugger.  It must be set to an */
   824   /**************************************************************************
   851   /* alternate truetype bytecode interpreter function.                 */
   825    *
   852 #define FT_DEBUG_HOOK_TRUETYPE  0
   826    * @struct:
   853 
   827    *   FT_LibraryRec
   854 
   828    *
   855   /*************************************************************************/
   829    * @description:
   856   /*                                                                       */
   830    *   The FreeType library class.  This is the root of all FreeType data.
   857   /* <Struct>                                                              */
   831    *   Use FT_New_Library() to create a library object, and FT_Done_Library()
   858   /*    FT_LibraryRec                                                      */
   832    *   to discard it and all child objects.
   859   /*                                                                       */
   833    *
   860   /* <Description>                                                         */
   834    * @fields:
   861   /*    The FreeType library class.  This is the root of all FreeType      */
   835    *   memory ::
   862   /*    data.  Use FT_New_Library() to create a library object, and        */
   836    *     The library's memory object.  Manages memory allocation.
   863   /*    FT_Done_Library() to discard it and all child objects.             */
   837    *
   864   /*                                                                       */
   838    *   version_major ::
   865   /* <Fields>                                                              */
   839    *     The major version number of the library.
   866   /*    memory           :: The library's memory object.  Manages memory   */
   840    *
   867   /*                        allocation.                                    */
   841    *   version_minor ::
   868   /*                                                                       */
   842    *     The minor version number of the library.
   869   /*    version_major    :: The major version number of the library.       */
   843    *
   870   /*                                                                       */
   844    *   version_patch ::
   871   /*    version_minor    :: The minor version number of the library.       */
   845    *     The current patch level of the library.
   872   /*                                                                       */
   846    *
   873   /*    version_patch    :: The current patch level of the library.        */
   847    *   num_modules ::
   874   /*                                                                       */
   848    *     The number of modules currently registered within this library.
   875   /*    num_modules      :: The number of modules currently registered     */
   849    *     This is set to 0 for new libraries.  New modules are added through
   876   /*                        within this library.  This is set to 0 for new */
   850    *     the FT_Add_Module() API function.
   877   /*                        libraries.  New modules are added through the  */
   851    *
   878   /*                        FT_Add_Module() API function.                  */
   852    *   modules ::
   879   /*                                                                       */
   853    *     A table used to store handles to the currently registered
   880   /*    modules          :: A table used to store handles to the currently */
   854    *     modules. Note that each font driver contains a list of its opened
   881   /*                        registered modules. Note that each font driver */
   855    *     faces.
   882   /*                        contains a list of its opened faces.           */
   856    *
   883   /*                                                                       */
   857    *   renderers ::
   884   /*    renderers        :: The list of renderers currently registered     */
   858    *     The list of renderers currently registered within the library.
   885   /*                        within the library.                            */
   859    *
   886   /*                                                                       */
   860    *   cur_renderer ::
   887   /*    cur_renderer     :: The current outline renderer.  This is a       */
   861    *     The current outline renderer.  This is a shortcut used to avoid
   888   /*                        shortcut used to avoid parsing the list on     */
   862    *     parsing the list on each call to FT_Outline_Render().  It is a
   889   /*                        each call to FT_Outline_Render().  It is a     */
   863    *     handle to the current renderer for the FT_GLYPH_FORMAT_OUTLINE
   890   /*                        handle to the current renderer for the         */
   864    *     format.
   891   /*                        FT_GLYPH_FORMAT_OUTLINE format.                */
   865    *
   892   /*                                                                       */
   866    *   auto_hinter ::
   893   /*    auto_hinter      :: The auto-hinter module interface.              */
   867    *     The auto-hinter module interface.
   894   /*                                                                       */
   868    *
   895   /*    debug_hooks      :: An array of four function pointers that allow  */
   869    *   debug_hooks ::
   896   /*                        debuggers to hook into a font format's         */
   870    *     An array of four function pointers that allow debuggers to hook into
   897   /*                        interpreter.  Currently, only the TrueType     */
   871    *     a font format's interpreter.  Currently, only the TrueType bytecode
   898   /*                        bytecode debugger uses this.                   */
   872    *     debugger uses this.
   899   /*                                                                       */
   873    *
   900   /*    lcd_weights      :: If subpixel rendering is activated, the LCD    */
   874    *   lcd_weights ::
   901   /*                        filter weights, if any.                        */
   875    *     The LCD filter weights for ClearType-style subpixel rendering.
   902   /*                                                                       */
   876    *
   903   /*    lcd_filter_func  :: If subpixel rendering is activated, the LCD    */
   877    *   lcd_filter_func ::
   904   /*                        filtering callback function.                   */
   878    *     The LCD filtering callback function for for ClearType-style subpixel
   905   /*                                                                       */
   879    *     rendering.
   906   /*    pic_container    :: Contains global structs and tables, instead    */
   880    *
   907   /*                        of defining them globally.                     */
   881    *   lcd_geometry ::
   908   /*                                                                       */
   882    *     This array specifies LCD subpixel geometry and controls Harmony LCD
   909   /*    refcount         :: A counter initialized to~1 at the time an      */
   883    *     rendering technique, alternative to ClearType.
   910   /*                        @FT_Library structure is created.              */
   884    *
   911   /*                        @FT_Reference_Library increments this counter, */
   885    *   pic_container ::
   912   /*                        and @FT_Done_Library only destroys a library   */
   886    *     Contains global structs and tables, instead of defining them
   913   /*                        if the counter is~1, otherwise it simply       */
   887    *     globally.
   914   /*                        decrements it.                                 */
   888    *
   915   /*                                                                       */
   889    *   refcount ::
       
   890    *     A counter initialized to~1 at the time an @FT_Library structure is
       
   891    *     created.  @FT_Reference_Library increments this counter, and
       
   892    *     @FT_Done_Library only destroys a library if the counter is~1,
       
   893    *     otherwise it simply decrements it.
       
   894    */
   916   typedef struct  FT_LibraryRec_
   895   typedef struct  FT_LibraryRec_
   917   {
   896   {
   918     FT_Memory          memory;           /* library's memory manager */
   897     FT_Memory          memory;           /* library's memory manager */
   919 
   898 
   920     FT_Int             version_major;
   899     FT_Int             version_major;
   931     FT_DebugHook_Func  debug_hooks[4];
   910     FT_DebugHook_Func  debug_hooks[4];
   932 
   911 
   933 #ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING
   912 #ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING
   934     FT_LcdFiveTapFilter      lcd_weights;      /* filter weights, if any */
   913     FT_LcdFiveTapFilter      lcd_weights;      /* filter weights, if any */
   935     FT_Bitmap_LcdFilterFunc  lcd_filter_func;  /* filtering callback     */
   914     FT_Bitmap_LcdFilterFunc  lcd_filter_func;  /* filtering callback     */
   936 #endif
   915 #else
   937 
   916     FT_Vector                lcd_geometry[3];  /* RGB subpixel positions */
   938 #ifdef FT_CONFIG_OPTION_PIC
       
   939     FT_PIC_Container   pic_container;
       
   940 #endif
   917 #endif
   941 
   918 
   942     FT_Int             refcount;
   919     FT_Int             refcount;
   943 
   920 
   944   } FT_LibraryRec;
   921   } FT_LibraryRec;
   968                                     FT_String*  glyph_name );
   945                                     FT_String*  glyph_name );
   969 
   946 
   970 
   947 
   971 #ifndef FT_CONFIG_OPTION_NO_DEFAULT_SYSTEM
   948 #ifndef FT_CONFIG_OPTION_NO_DEFAULT_SYSTEM
   972 
   949 
   973   /*************************************************************************/
   950   /**************************************************************************
   974   /*                                                                       */
   951    *
   975   /* <Function>                                                            */
   952    * @function:
   976   /*    FT_New_Memory                                                      */
   953    *   FT_New_Memory
   977   /*                                                                       */
   954    *
   978   /* <Description>                                                         */
   955    * @description:
   979   /*    Creates a new memory object.                                       */
   956    *   Creates a new memory object.
   980   /*                                                                       */
   957    *
   981   /* <Return>                                                              */
   958    * @return:
   982   /*    A pointer to the new memory object.  0 in case of error.           */
   959    *   A pointer to the new memory object.  0 in case of error.
   983   /*                                                                       */
   960    */
   984   FT_BASE( FT_Memory )
   961   FT_BASE( FT_Memory )
   985   FT_New_Memory( void );
   962   FT_New_Memory( void );
   986 
   963 
   987 
   964 
   988   /*************************************************************************/
   965   /**************************************************************************
   989   /*                                                                       */
   966    *
   990   /* <Function>                                                            */
   967    * @function:
   991   /*    FT_Done_Memory                                                     */
   968    *   FT_Done_Memory
   992   /*                                                                       */
   969    *
   993   /* <Description>                                                         */
   970    * @description:
   994   /*    Discards memory manager.                                           */
   971    *   Discards memory manager.
   995   /*                                                                       */
   972    *
   996   /* <Input>                                                               */
   973    * @input:
   997   /*    memory :: A handle to the memory manager.                          */
   974    *   memory ::
   998   /*                                                                       */
   975    *     A handle to the memory manager.
       
   976    */
   999   FT_BASE( void )
   977   FT_BASE( void )
  1000   FT_Done_Memory( FT_Memory  memory );
   978   FT_Done_Memory( FT_Memory  memory );
  1001 
   979 
  1002 #endif /* !FT_CONFIG_OPTION_NO_DEFAULT_SYSTEM */
   980 #endif /* !FT_CONFIG_OPTION_NO_DEFAULT_SYSTEM */
  1003 
   981 
  1011 #ifndef FT_NO_DEFAULT_RASTER
   989 #ifndef FT_NO_DEFAULT_RASTER
  1012   FT_EXPORT_VAR( FT_Raster_Funcs )  ft_default_raster;
   990   FT_EXPORT_VAR( FT_Raster_Funcs )  ft_default_raster;
  1013 #endif
   991 #endif
  1014 
   992 
  1015 
   993 
  1016   /*************************************************************************/
   994   /**************************************************************************
  1017   /*************************************************************************/
   995    *
  1018   /*************************************************************************/
   996    * @macro:
  1019   /****                                                                 ****/
   997    *   FT_DEFINE_OUTLINE_FUNCS
  1020   /****                                                                 ****/
   998    *
  1021   /****                      P I C   S U P P O R T                      ****/
   999    * @description:
  1022   /****                                                                 ****/
  1000    *   Used to initialize an instance of FT_Outline_Funcs struct.  The struct
  1023   /****                                                                 ****/
  1001    *   will be allocated in the global scope (or the scope where the macro is
  1024   /*************************************************************************/
  1002    *   used).
  1025   /*************************************************************************/
  1003    */
  1026   /*************************************************************************/
       
  1027 
       
  1028 
       
  1029   /* PIC support macros for ftimage.h */
       
  1030 
       
  1031 
       
  1032   /*************************************************************************/
       
  1033   /*                                                                       */
       
  1034   /* <Macro>                                                               */
       
  1035   /*    FT_DEFINE_OUTLINE_FUNCS                                            */
       
  1036   /*                                                                       */
       
  1037   /* <Description>                                                         */
       
  1038   /*    Used to initialize an instance of FT_Outline_Funcs struct.         */
       
  1039   /*    When FT_CONFIG_OPTION_PIC is defined an init function will need    */
       
  1040   /*    to be called with a pre-allocated structure to be filled.          */
       
  1041   /*    When FT_CONFIG_OPTION_PIC is not defined the struct will be        */
       
  1042   /*    allocated in the global scope (or the scope where the macro        */
       
  1043   /*    is used).                                                          */
       
  1044   /*                                                                       */
       
  1045 #ifndef FT_CONFIG_OPTION_PIC
       
  1046 
       
  1047 #define FT_DEFINE_OUTLINE_FUNCS(           \
  1004 #define FT_DEFINE_OUTLINE_FUNCS(           \
  1048           class_,                          \
  1005           class_,                          \
  1049           move_to_,                        \
  1006           move_to_,                        \
  1050           line_to_,                        \
  1007           line_to_,                        \
  1051           conic_to_,                       \
  1008           conic_to_,                       \
  1060     cubic_to_,                             \
  1017     cubic_to_,                             \
  1061     shift_,                                \
  1018     shift_,                                \
  1062     delta_                                 \
  1019     delta_                                 \
  1063   };
  1020   };
  1064 
  1021 
  1065 #else /* FT_CONFIG_OPTION_PIC */
  1022 
  1066 
  1023   /**************************************************************************
  1067 #define FT_DEFINE_OUTLINE_FUNCS(                     \
  1024    *
  1068           class_,                                    \
  1025    * @macro:
  1069           move_to_,                                  \
  1026    *   FT_DEFINE_RASTER_FUNCS
  1070           line_to_,                                  \
  1027    *
  1071           conic_to_,                                 \
  1028    * @description:
  1072           cubic_to_,                                 \
  1029    *   Used to initialize an instance of FT_Raster_Funcs struct.  The struct
  1073           shift_,                                    \
  1030    *   will be allocated in the global scope (or the scope where the macro is
  1074           delta_ )                                   \
  1031    *   used).
  1075   static FT_Error                                    \
  1032    */
  1076   Init_Class_ ## class_( FT_Outline_Funcs*  clazz )  \
       
  1077   {                                                  \
       
  1078     clazz->move_to  = move_to_;                      \
       
  1079     clazz->line_to  = line_to_;                      \
       
  1080     clazz->conic_to = conic_to_;                     \
       
  1081     clazz->cubic_to = cubic_to_;                     \
       
  1082     clazz->shift    = shift_;                        \
       
  1083     clazz->delta    = delta_;                        \
       
  1084                                                      \
       
  1085     return FT_Err_Ok;                                \
       
  1086   }
       
  1087 
       
  1088 #endif /* FT_CONFIG_OPTION_PIC */
       
  1089 
       
  1090 
       
  1091   /*************************************************************************/
       
  1092   /*                                                                       */
       
  1093   /* <Macro>                                                               */
       
  1094   /*    FT_DEFINE_RASTER_FUNCS                                             */
       
  1095   /*                                                                       */
       
  1096   /* <Description>                                                         */
       
  1097   /*    Used to initialize an instance of FT_Raster_Funcs struct.          */
       
  1098   /*    When FT_CONFIG_OPTION_PIC is defined an init function will need    */
       
  1099   /*    to be called with a pre-allocated structure to be filled.          */
       
  1100   /*    When FT_CONFIG_OPTION_PIC is not defined the struct will be        */
       
  1101   /*    allocated in the global scope (or the scope where the macro        */
       
  1102   /*    is used).                                                          */
       
  1103   /*                                                                       */
       
  1104 #ifndef FT_CONFIG_OPTION_PIC
       
  1105 
       
  1106 #define FT_DEFINE_RASTER_FUNCS(    \
  1033 #define FT_DEFINE_RASTER_FUNCS(    \
  1107           class_,                  \
  1034           class_,                  \
  1108           glyph_format_,           \
  1035           glyph_format_,           \
  1109           raster_new_,             \
  1036           raster_new_,             \
  1110           raster_reset_,           \
  1037           raster_reset_,           \
  1119     raster_set_mode_,              \
  1046     raster_set_mode_,              \
  1120     raster_render_,                \
  1047     raster_render_,                \
  1121     raster_done_                   \
  1048     raster_done_                   \
  1122   };
  1049   };
  1123 
  1050 
  1124 #else /* FT_CONFIG_OPTION_PIC */
  1051 
  1125 
  1052 
  1126 #define FT_DEFINE_RASTER_FUNCS(                        \
  1053   /**************************************************************************
  1127           class_,                                      \
  1054    *
  1128           glyph_format_,                               \
  1055    * @macro:
  1129           raster_new_,                                 \
  1056    *   FT_DEFINE_GLYPH
  1130           raster_reset_,                               \
  1057    *
  1131           raster_set_mode_,                            \
  1058    * @description:
  1132           raster_render_,                              \
  1059    *   The struct will be allocated in the global scope (or the scope where
  1133           raster_done_ )                               \
  1060    *   the macro is used).
  1134   void                                                 \
  1061    */
  1135   FT_Init_Class_ ## class_( FT_Raster_Funcs*  clazz )  \
       
  1136   {                                                    \
       
  1137     clazz->glyph_format    = glyph_format_;            \
       
  1138     clazz->raster_new      = raster_new_;              \
       
  1139     clazz->raster_reset    = raster_reset_;            \
       
  1140     clazz->raster_set_mode = raster_set_mode_;         \
       
  1141     clazz->raster_render   = raster_render_;           \
       
  1142     clazz->raster_done     = raster_done_;             \
       
  1143   }
       
  1144 
       
  1145 #endif /* FT_CONFIG_OPTION_PIC */
       
  1146 
       
  1147 
       
  1148   /* PIC support macros for ftrender.h */
       
  1149 
       
  1150 
       
  1151   /*************************************************************************/
       
  1152   /*                                                                       */
       
  1153   /* <Macro>                                                               */
       
  1154   /*    FT_DEFINE_GLYPH                                                    */
       
  1155   /*                                                                       */
       
  1156   /* <Description>                                                         */
       
  1157   /*    Used to initialize an instance of FT_Glyph_Class struct.           */
       
  1158   /*    When FT_CONFIG_OPTION_PIC is defined an init function will need    */
       
  1159   /*    to be called with a pre-allocated structure to be filled.          */
       
  1160   /*    When FT_CONFIG_OPTION_PIC is not defined the struct will be        */
       
  1161   /*    allocated in the global scope (or the scope where the macro        */
       
  1162   /*    is used).                                                          */
       
  1163   /*                                                                       */
       
  1164 #ifndef FT_CONFIG_OPTION_PIC
       
  1165 
       
  1166 #define FT_DEFINE_GLYPH(          \
  1062 #define FT_DEFINE_GLYPH(          \
  1167           class_,                 \
  1063           class_,                 \
  1168           size_,                  \
  1064           size_,                  \
  1169           format_,                \
  1065           format_,                \
  1170           init_,                  \
  1066           init_,                  \
  1184     transform_,                   \
  1080     transform_,                   \
  1185     bbox_,                        \
  1081     bbox_,                        \
  1186     prepare_                      \
  1082     prepare_                      \
  1187   };
  1083   };
  1188 
  1084 
  1189 #else /* FT_CONFIG_OPTION_PIC */
  1085 
  1190 
  1086   /**************************************************************************
  1191 #define FT_DEFINE_GLYPH(                              \
  1087    *
  1192           class_,                                     \
  1088    * @macro:
  1193           size_,                                      \
  1089    *   FT_DECLARE_RENDERER
  1194           format_,                                    \
  1090    *
  1195           init_,                                      \
  1091    * @description:
  1196           done_,                                      \
  1092    *   Used to create a forward declaration of a FT_Renderer_Class struct
  1197           copy_,                                      \
  1093    *   instance.
  1198           transform_,                                 \
  1094    *
  1199           bbox_,                                      \
  1095    * @macro:
  1200           prepare_ )                                  \
  1096    *   FT_DEFINE_RENDERER
  1201   void                                                \
  1097    *
  1202   FT_Init_Class_ ## class_( FT_Glyph_Class*  clazz )  \
  1098    * @description:
  1203   {                                                   \
  1099    *   Used to initialize an instance of FT_Renderer_Class struct.
  1204     clazz->glyph_size      = size_;                   \
  1100    *
  1205     clazz->glyph_format    = format_;                 \
  1101    *   The struct will be allocated in the global scope (or the scope where
  1206     clazz->glyph_init      = init_;                   \
  1102    *   the macro is used).
  1207     clazz->glyph_done      = done_;                   \
  1103    */
  1208     clazz->glyph_copy      = copy_;                   \
       
  1209     clazz->glyph_transform = transform_;              \
       
  1210     clazz->glyph_bbox      = bbox_;                   \
       
  1211     clazz->glyph_prepare   = prepare_;                \
       
  1212   }
       
  1213 
       
  1214 #endif /* FT_CONFIG_OPTION_PIC */
       
  1215 
       
  1216 
       
  1217   /*************************************************************************/
       
  1218   /*                                                                       */
       
  1219   /* <Macro>                                                               */
       
  1220   /*    FT_DECLARE_RENDERER                                                */
       
  1221   /*                                                                       */
       
  1222   /* <Description>                                                         */
       
  1223   /*    Used to create a forward declaration of a                          */
       
  1224   /*    FT_Renderer_Class struct instance.                                 */
       
  1225   /*                                                                       */
       
  1226   /* <Macro>                                                               */
       
  1227   /*    FT_DEFINE_RENDERER                                                 */
       
  1228   /*                                                                       */
       
  1229   /* <Description>                                                         */
       
  1230   /*    Used to initialize an instance of FT_Renderer_Class struct.        */
       
  1231   /*                                                                       */
       
  1232   /*    When FT_CONFIG_OPTION_PIC is defined a `create' function will      */
       
  1233   /*    need to be called with a pointer where the allocated structure is  */
       
  1234   /*    returned.  And when it is no longer needed a `destroy' function    */
       
  1235   /*    needs to be called to release that allocation.                     */
       
  1236   /*    `ftinit.c' (ft_create_default_module_classes) already contains     */
       
  1237   /*    a mechanism to call these functions for the default modules        */
       
  1238   /*    described in `ftmodule.h'.                                         */
       
  1239   /*                                                                       */
       
  1240   /*    Notice that the created `create' and `destroy' functions call      */
       
  1241   /*    `pic_init' and `pic_free' to allow you to manually allocate and    */
       
  1242   /*    initialize any additional global data, like a module specific      */
       
  1243   /*    interface, and put them in the global pic container defined in     */
       
  1244   /*    `ftpic.h'.  If you don't need them just implement the functions as */
       
  1245   /*    empty to resolve the link error.  Also the `pic_init' and          */
       
  1246   /*    `pic_free' functions should be declared in `pic.h', to be referred */
       
  1247   /*    by the renderer definition calling `FT_DEFINE_RENDERER' in the     */
       
  1248   /*    following.                                                         */
       
  1249   /*                                                                       */
       
  1250   /*    When FT_CONFIG_OPTION_PIC is not defined the struct will be        */
       
  1251   /*    allocated in the global scope (or the scope where the macro        */
       
  1252   /*    is used).                                                          */
       
  1253   /*                                                                       */
       
  1254 #ifndef FT_CONFIG_OPTION_PIC
       
  1255 
       
  1256 #define FT_DECLARE_RENDERER( class_ )               \
  1104 #define FT_DECLARE_RENDERER( class_ )               \
  1257   FT_EXPORT_VAR( const FT_Renderer_Class ) class_;
  1105   FT_EXPORT_VAR( const FT_Renderer_Class ) class_;
  1258 
  1106 
  1259 #define FT_DEFINE_RENDERER(                  \
  1107 #define FT_DEFINE_RENDERER(                  \
  1260           class_,                            \
  1108           class_,                            \
  1293     set_mode_,                               \
  1141     set_mode_,                               \
  1294                                              \
  1142                                              \
  1295     raster_class_                            \
  1143     raster_class_                            \
  1296   };
  1144   };
  1297 
  1145 
  1298 #else /* FT_CONFIG_OPTION_PIC */
  1146 
  1299 
  1147   /**************************************************************************
  1300 #define FT_DECLARE_RENDERER( class_ )  FT_DECLARE_MODULE( class_ )
  1148    *
  1301 
  1149    * @macro:
  1302 #define FT_DEFINE_RENDERER(                                      \
  1150    *   FT_DECLARE_MODULE
  1303           class_,                                                \
  1151    *
  1304           flags_,                                                \
  1152    * @description:
  1305           size_,                                                 \
  1153    *   Used to create a forward declaration of a FT_Module_Class struct
  1306           name_,                                                 \
  1154    *   instance.
  1307           version_,                                              \
  1155    *
  1308           requires_,                                             \
  1156    * @macro:
  1309           interface_,                                            \
  1157    *   FT_DEFINE_MODULE
  1310           init_,                                                 \
  1158    *
  1311           done_,                                                 \
  1159    * @description:
  1312           get_interface_,                                        \
  1160    *   Used to initialize an instance of an FT_Module_Class struct.
  1313           glyph_format_,                                         \
  1161    *
  1314           render_glyph_,                                         \
  1162    *   The struct will be allocated in the global scope (or the scope where
  1315           transform_glyph_,                                      \
  1163    *   the macro is used).
  1316           get_glyph_cbox_,                                       \
  1164    *
  1317           set_mode_,                                             \
  1165    * @macro:
  1318           raster_class_ )                                        \
  1166    *   FT_DEFINE_ROOT_MODULE
  1319   void                                                           \
  1167    *
  1320   FT_Destroy_Class_ ## class_( FT_Library        library,        \
  1168    * @description:
  1321                                FT_Module_Class*  clazz )         \
  1169    *   Used to initialize an instance of an FT_Module_Class struct inside
  1322   {                                                              \
  1170    *   another struct that contains it or in a function that initializes that
  1323     FT_Renderer_Class*  rclazz = (FT_Renderer_Class*)clazz;      \
  1171    *   containing struct.
  1324     FT_Memory           memory = library->memory;                \
  1172    */
  1325                                                                  \
       
  1326                                                                  \
       
  1327     class_ ## _pic_free( library );                              \
       
  1328     if ( rclazz )                                                \
       
  1329       FT_FREE( rclazz );                                         \
       
  1330   }                                                              \
       
  1331                                                                  \
       
  1332                                                                  \
       
  1333   FT_Error                                                       \
       
  1334   FT_Create_Class_ ## class_( FT_Library         library,        \
       
  1335                               FT_Module_Class**  output_class )  \
       
  1336   {                                                              \
       
  1337     FT_Renderer_Class*  clazz = NULL;                            \
       
  1338     FT_Error            error;                                   \
       
  1339     FT_Memory           memory = library->memory;                \
       
  1340                                                                  \
       
  1341                                                                  \
       
  1342     if ( FT_ALLOC( clazz, sizeof ( *clazz ) ) )                  \
       
  1343       return error;                                              \
       
  1344                                                                  \
       
  1345     error = class_ ## _pic_init( library );                      \
       
  1346     if ( error )                                                 \
       
  1347     {                                                            \
       
  1348       FT_FREE( clazz );                                          \
       
  1349       return error;                                              \
       
  1350     }                                                            \
       
  1351                                                                  \
       
  1352     FT_DEFINE_ROOT_MODULE( flags_,                               \
       
  1353                            size_,                                \
       
  1354                            name_,                                \
       
  1355                            version_,                             \
       
  1356                            requires_,                            \
       
  1357                            interface_,                           \
       
  1358                            init_,                                \
       
  1359                            done_,                                \
       
  1360                            get_interface_ )                      \
       
  1361                                                                  \
       
  1362     clazz->glyph_format    = glyph_format_;                      \
       
  1363                                                                  \
       
  1364     clazz->render_glyph    = render_glyph_;                      \
       
  1365     clazz->transform_glyph = transform_glyph_;                   \
       
  1366     clazz->get_glyph_cbox  = get_glyph_cbox_;                    \
       
  1367     clazz->set_mode        = set_mode_;                          \
       
  1368                                                                  \
       
  1369     clazz->raster_class    = raster_class_;                      \
       
  1370                                                                  \
       
  1371     *output_class = (FT_Module_Class*)clazz;                     \
       
  1372                                                                  \
       
  1373     return FT_Err_Ok;                                            \
       
  1374   }
       
  1375 
       
  1376 #endif /* FT_CONFIG_OPTION_PIC */
       
  1377 
       
  1378 
       
  1379   /* PIC support macros for ftmodapi.h **/
       
  1380 
       
  1381 
       
  1382 #ifdef FT_CONFIG_OPTION_PIC
       
  1383 
       
  1384   /*************************************************************************/
       
  1385   /*                                                                       */
       
  1386   /* <FuncType>                                                            */
       
  1387   /*    FT_Module_Creator                                                  */
       
  1388   /*                                                                       */
       
  1389   /* <Description>                                                         */
       
  1390   /*    A function used to create (allocate) a new module class object.    */
       
  1391   /*    The object's members are initialized, but the module itself is     */
       
  1392   /*    not.                                                               */
       
  1393   /*                                                                       */
       
  1394   /* <Input>                                                               */
       
  1395   /*    memory       :: A handle to the memory manager.                    */
       
  1396   /*    output_class :: Initialized with the newly allocated class.        */
       
  1397   /*                                                                       */
       
  1398   typedef FT_Error
       
  1399   (*FT_Module_Creator)( FT_Memory          memory,
       
  1400                         FT_Module_Class**  output_class );
       
  1401 
       
  1402   /*************************************************************************/
       
  1403   /*                                                                       */
       
  1404   /* <FuncType>                                                            */
       
  1405   /*    FT_Module_Destroyer                                                */
       
  1406   /*                                                                       */
       
  1407   /* <Description>                                                         */
       
  1408   /*    A function used to destroy (deallocate) a module class object.     */
       
  1409   /*                                                                       */
       
  1410   /* <Input>                                                               */
       
  1411   /*    memory :: A handle to the memory manager.                          */
       
  1412   /*    clazz  :: Module class to destroy.                                 */
       
  1413   /*                                                                       */
       
  1414   typedef void
       
  1415   (*FT_Module_Destroyer)( FT_Memory         memory,
       
  1416                           FT_Module_Class*  clazz );
       
  1417 
       
  1418 #endif
       
  1419 
       
  1420 
       
  1421   /*************************************************************************/
       
  1422   /*                                                                       */
       
  1423   /* <Macro>                                                               */
       
  1424   /*    FT_DECLARE_MODULE                                                  */
       
  1425   /*                                                                       */
       
  1426   /* <Description>                                                         */
       
  1427   /*    Used to create a forward declaration of a                          */
       
  1428   /*    FT_Module_Class struct instance.                                   */
       
  1429   /*                                                                       */
       
  1430   /* <Macro>                                                               */
       
  1431   /*    FT_DEFINE_MODULE                                                   */
       
  1432   /*                                                                       */
       
  1433   /* <Description>                                                         */
       
  1434   /*    Used to initialize an instance of an FT_Module_Class struct.       */
       
  1435   /*                                                                       */
       
  1436   /*    When FT_CONFIG_OPTION_PIC is defined a `create' function needs     */
       
  1437   /*    to be called with a pointer where the allocated structure is       */
       
  1438   /*    returned.  And when it is no longer needed a `destroy' function    */
       
  1439   /*    needs to be called to release that allocation.                     */
       
  1440   /*    `ftinit.c' (ft_create_default_module_classes) already contains     */
       
  1441   /*    a mechanism to call these functions for the default modules        */
       
  1442   /*    described in `ftmodule.h'.                                         */
       
  1443   /*                                                                       */
       
  1444   /*    Notice that the created `create' and `destroy' functions call      */
       
  1445   /*    `pic_init' and `pic_free' to allow you to manually allocate and    */
       
  1446   /*    initialize any additional global data, like a module specific      */
       
  1447   /*    interface, and put them in the global pic container defined in     */
       
  1448   /*    `ftpic.h'.  If you don't need them just implement the functions as */
       
  1449   /*    empty to resolve the link error.  Also the `pic_init' and          */
       
  1450   /*    `pic_free' functions should be declared in `pic.h', to be referred */
       
  1451   /*    by the module definition calling `FT_DEFINE_MODULE' in the         */
       
  1452   /*    following.                                                         */
       
  1453   /*                                                                       */
       
  1454   /*    When FT_CONFIG_OPTION_PIC is not defined the struct will be        */
       
  1455   /*    allocated in the global scope (or the scope where the macro        */
       
  1456   /*    is used).                                                          */
       
  1457   /*                                                                       */
       
  1458   /* <Macro>                                                               */
       
  1459   /*    FT_DEFINE_ROOT_MODULE                                              */
       
  1460   /*                                                                       */
       
  1461   /* <Description>                                                         */
       
  1462   /*    Used to initialize an instance of an FT_Module_Class struct inside */
       
  1463   /*    another struct that contains it or in a function that initializes  */
       
  1464   /*    that containing struct.                                            */
       
  1465   /*                                                                       */
       
  1466 #ifndef FT_CONFIG_OPTION_PIC
       
  1467 
       
  1468 #define FT_DECLARE_MODULE( class_ )  \
  1173 #define FT_DECLARE_MODULE( class_ )  \
  1469   FT_CALLBACK_TABLE                  \
  1174   FT_CALLBACK_TABLE                  \
  1470   const FT_Module_Class  class_;
  1175   const FT_Module_Class  class_;
  1471 
  1176 
  1472 #define FT_DEFINE_ROOT_MODULE(  \
  1177 #define FT_DEFINE_ROOT_MODULE(  \
  1521     done_,                        \
  1226     done_,                        \
  1522     get_interface_,               \
  1227     get_interface_,               \
  1523   };
  1228   };
  1524 
  1229 
  1525 
  1230 
  1526 #else /* FT_CONFIG_OPTION_PIC */
       
  1527 
       
  1528 #define FT_DECLARE_MODULE( class_ )                               \
       
  1529   FT_Error                                                        \
       
  1530   FT_Create_Class_ ## class_( FT_Library         library,         \
       
  1531                               FT_Module_Class**  output_class );  \
       
  1532   void                                                            \
       
  1533   FT_Destroy_Class_ ## class_( FT_Library        library,         \
       
  1534                                FT_Module_Class*  clazz );
       
  1535 
       
  1536 #define FT_DEFINE_ROOT_MODULE(                      \
       
  1537           flags_,                                   \
       
  1538           size_,                                    \
       
  1539           name_,                                    \
       
  1540           version_,                                 \
       
  1541           requires_,                                \
       
  1542           interface_,                               \
       
  1543           init_,                                    \
       
  1544           done_,                                    \
       
  1545           get_interface_ )                          \
       
  1546     clazz->root.module_flags     = flags_;          \
       
  1547     clazz->root.module_size      = size_;           \
       
  1548     clazz->root.module_name      = name_;           \
       
  1549     clazz->root.module_version   = version_;        \
       
  1550     clazz->root.module_requires  = requires_;       \
       
  1551                                                     \
       
  1552     clazz->root.module_interface = interface_;      \
       
  1553                                                     \
       
  1554     clazz->root.module_init      = init_;           \
       
  1555     clazz->root.module_done      = done_;           \
       
  1556     clazz->root.get_interface    = get_interface_;
       
  1557 
       
  1558 #define FT_DEFINE_MODULE(                                        \
       
  1559           class_,                                                \
       
  1560           flags_,                                                \
       
  1561           size_,                                                 \
       
  1562           name_,                                                 \
       
  1563           version_,                                              \
       
  1564           requires_,                                             \
       
  1565           interface_,                                            \
       
  1566           init_,                                                 \
       
  1567           done_,                                                 \
       
  1568           get_interface_ )                                       \
       
  1569   void                                                           \
       
  1570   FT_Destroy_Class_ ## class_( FT_Library        library,        \
       
  1571                                FT_Module_Class*  clazz )         \
       
  1572   {                                                              \
       
  1573     FT_Memory memory = library->memory;                          \
       
  1574                                                                  \
       
  1575                                                                  \
       
  1576     class_ ## _pic_free( library );                              \
       
  1577     if ( clazz )                                                 \
       
  1578       FT_FREE( clazz );                                          \
       
  1579   }                                                              \
       
  1580                                                                  \
       
  1581                                                                  \
       
  1582   FT_Error                                                       \
       
  1583   FT_Create_Class_ ## class_( FT_Library         library,        \
       
  1584                               FT_Module_Class**  output_class )  \
       
  1585   {                                                              \
       
  1586     FT_Memory         memory = library->memory;                  \
       
  1587     FT_Module_Class*  clazz  = NULL;                             \
       
  1588     FT_Error          error;                                     \
       
  1589                                                                  \
       
  1590                                                                  \
       
  1591     if ( FT_ALLOC( clazz, sizeof ( *clazz ) ) )                  \
       
  1592       return error;                                              \
       
  1593     error = class_ ## _pic_init( library );                      \
       
  1594     if ( error )                                                 \
       
  1595     {                                                            \
       
  1596       FT_FREE( clazz );                                          \
       
  1597       return error;                                              \
       
  1598     }                                                            \
       
  1599                                                                  \
       
  1600     clazz->module_flags     = flags_;                            \
       
  1601     clazz->module_size      = size_;                             \
       
  1602     clazz->module_name      = name_;                             \
       
  1603     clazz->module_version   = version_;                          \
       
  1604     clazz->module_requires  = requires_;                         \
       
  1605                                                                  \
       
  1606     clazz->module_interface = interface_;                        \
       
  1607                                                                  \
       
  1608     clazz->module_init      = init_;                             \
       
  1609     clazz->module_done      = done_;                             \
       
  1610     clazz->get_interface    = get_interface_;                    \
       
  1611                                                                  \
       
  1612     *output_class = clazz;                                       \
       
  1613                                                                  \
       
  1614     return FT_Err_Ok;                                            \
       
  1615   }
       
  1616 
       
  1617 #endif /* FT_CONFIG_OPTION_PIC */
       
  1618 
       
  1619 
       
  1620 FT_END_HEADER
  1231 FT_END_HEADER
  1621 
  1232 
  1622 #endif /* FTOBJS_H_ */
  1233 #endif /* FTOBJS_H_ */
  1623 
  1234 
  1624 
  1235