aflatin.h

Go to the documentation of this file.
00001 /***************************************************************************/
00002 /*                                                                         */
00003 /*  aflatin.h                                                              */
00004 /*                                                                         */
00005 /*    Auto-fitter hinting routines for latin script (specification).       */
00006 /*                                                                         */
00007 /*  Copyright 2003, 2004, 2005, 2006, 2007, 2009 by                        */
00008 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
00009 /*                                                                         */
00010 /*  This file is part of the FreeType project, and may only be used,       */
00011 /*  modified, and distributed under the terms of the FreeType project      */
00012 /*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
00013 /*  this file you indicate that you have read the license and              */
00014 /*  understand and accept it fully.                                        */
00015 /*                                                                         */
00016 /***************************************************************************/
00017 
00018 
00019 #ifndef __AFLATIN_H__
00020 #define __AFLATIN_H__
00021 
00022 #include "afhints.h"
00023 
00024 
00025 FT_BEGIN_HEADER
00026 
00027 
00028   /* the latin-specific script class */
00029 
00030   AF_DECLARE_SCRIPT_CLASS(af_latin_script_class)
00031 
00032 
00033 /* constants are given with units_per_em == 2048 in mind */
00034 #define AF_LATIN_CONSTANT( metrics, c ) \
00035   ( ( (c) * (FT_Long)( (AF_LatinMetrics)(metrics) )->units_per_em ) / 2048 )
00036 
00037 
00038   /*************************************************************************/
00039   /*************************************************************************/
00040   /*****                                                               *****/
00041   /*****            L A T I N   G L O B A L   M E T R I C S            *****/
00042   /*****                                                               *****/
00043   /*************************************************************************/
00044   /*************************************************************************/
00045 
00046 
00047   /*
00048    *  The following declarations could be embedded in the file `aflatin.c';
00049    *  they have been made semi-public to allow alternate script hinters to
00050    *  re-use some of them.
00051    */
00052 
00053 
00054   /* Latin (global) metrics management */
00055 
00056   enum
00057   {
00058     AF_LATIN_BLUE_CAPITAL_TOP,
00059     AF_LATIN_BLUE_CAPITAL_BOTTOM,
00060     AF_LATIN_BLUE_SMALL_F_TOP,
00061     AF_LATIN_BLUE_SMALL_TOP,
00062     AF_LATIN_BLUE_SMALL_BOTTOM,
00063     AF_LATIN_BLUE_SMALL_MINOR,
00064 
00065     AF_LATIN_BLUE_MAX
00066   };
00067 
00068 
00069 #define AF_LATIN_IS_TOP_BLUE( b )  ( (b) == AF_LATIN_BLUE_CAPITAL_TOP || \
00070                                      (b) == AF_LATIN_BLUE_SMALL_F_TOP || \
00071                                      (b) == AF_LATIN_BLUE_SMALL_TOP   )
00072 
00073 #define AF_LATIN_MAX_WIDTHS  16
00074 #define AF_LATIN_MAX_BLUES   AF_LATIN_BLUE_MAX
00075 
00076 
00077   enum
00078   {
00079     AF_LATIN_BLUE_ACTIVE     = 1 << 0,
00080     AF_LATIN_BLUE_TOP        = 1 << 1,
00081     AF_LATIN_BLUE_ADJUSTMENT = 1 << 2,  /* used for scale adjustment */
00082                                         /* optimization              */
00083     AF_LATIN_BLUE_FLAG_MAX
00084   };
00085 
00086 
00087   typedef struct  AF_LatinBlueRec_
00088   {
00089     AF_WidthRec  ref;
00090     AF_WidthRec  shoot;
00091     FT_UInt      flags;
00092 
00093   } AF_LatinBlueRec, *AF_LatinBlue;
00094 
00095 
00096   typedef struct  AF_LatinAxisRec_
00097   {
00098     FT_Fixed         scale;
00099     FT_Pos           delta;
00100 
00101     FT_UInt          width_count;
00102     AF_WidthRec      widths[AF_LATIN_MAX_WIDTHS];
00103     FT_Pos           edge_distance_threshold;
00104     FT_Pos           standard_width;
00105     FT_Bool          extra_light;
00106 
00107     /* ignored for horizontal metrics */
00108     FT_Bool          control_overshoot;
00109     FT_UInt          blue_count;
00110     AF_LatinBlueRec  blues[AF_LATIN_BLUE_MAX];
00111 
00112     FT_Fixed         org_scale;
00113     FT_Pos           org_delta;
00114 
00115   } AF_LatinAxisRec, *AF_LatinAxis;
00116 
00117 
00118   typedef struct  AF_LatinMetricsRec_
00119   {
00120     AF_ScriptMetricsRec  root;
00121     FT_UInt              units_per_em;
00122     AF_LatinAxisRec      axis[AF_DIMENSION_MAX];
00123 
00124   } AF_LatinMetricsRec, *AF_LatinMetrics;
00125 
00126 
00127   FT_LOCAL( FT_Error )
00128   af_latin_metrics_init( AF_LatinMetrics  metrics,
00129                          FT_Face          face );
00130 
00131   FT_LOCAL( void )
00132   af_latin_metrics_scale( AF_LatinMetrics  metrics,
00133                           AF_Scaler        scaler );
00134 
00135   FT_LOCAL( void )
00136   af_latin_metrics_init_widths( AF_LatinMetrics  metrics,
00137                                 FT_Face          face,
00138                                 FT_ULong         charcode );
00139 
00140   FT_LOCAL( void )
00141   af_latin_metrics_check_digits( AF_LatinMetrics  metrics,
00142                                  FT_Face          face );
00143 
00144 
00145   /*************************************************************************/
00146   /*************************************************************************/
00147   /*****                                                               *****/
00148   /*****           L A T I N   G L Y P H   A N A L Y S I S             *****/
00149   /*****                                                               *****/
00150   /*************************************************************************/
00151   /*************************************************************************/
00152 
00153   enum
00154   {
00155     AF_LATIN_HINTS_HORZ_SNAP   = 1 << 0, /* enable stem width snapping  */
00156     AF_LATIN_HINTS_VERT_SNAP   = 1 << 1, /* enable stem height snapping */
00157     AF_LATIN_HINTS_STEM_ADJUST = 1 << 2, /* enable stem width/height    */
00158                                          /* adjustment                  */
00159     AF_LATIN_HINTS_MONO        = 1 << 3  /* indicate monochrome         */
00160                                          /* rendering                   */
00161   };
00162 
00163 
00164 #define AF_LATIN_HINTS_DO_HORZ_SNAP( h )             \
00165   AF_HINTS_TEST_OTHER( h, AF_LATIN_HINTS_HORZ_SNAP )
00166 
00167 #define AF_LATIN_HINTS_DO_VERT_SNAP( h )             \
00168   AF_HINTS_TEST_OTHER( h, AF_LATIN_HINTS_VERT_SNAP )
00169 
00170 #define AF_LATIN_HINTS_DO_STEM_ADJUST( h )             \
00171   AF_HINTS_TEST_OTHER( h, AF_LATIN_HINTS_STEM_ADJUST )
00172 
00173 #define AF_LATIN_HINTS_DO_MONO( h )             \
00174   AF_HINTS_TEST_OTHER( h, AF_LATIN_HINTS_MONO )
00175 
00176 
00177   /*
00178    *  This shouldn't normally be exported.  However, other scripts might
00179    *  like to use this function as-is.
00180    */
00181   FT_LOCAL( FT_Error )
00182   af_latin_hints_compute_segments( AF_GlyphHints  hints,
00183                                    AF_Dimension   dim );
00184 
00185   /*
00186    *  This shouldn't normally be exported.  However, other scripts might
00187    *  want to use this function as-is.
00188    */
00189   FT_LOCAL( void )
00190   af_latin_hints_link_segments( AF_GlyphHints  hints,
00191                                 AF_Dimension   dim );
00192 
00193   /*
00194    *  This shouldn't normally be exported.  However, other scripts might
00195    *  want to use this function as-is.
00196    */
00197   FT_LOCAL( FT_Error )
00198   af_latin_hints_compute_edges( AF_GlyphHints  hints,
00199                                 AF_Dimension   dim );
00200 
00201   FT_LOCAL( FT_Error )
00202   af_latin_hints_detect_features( AF_GlyphHints  hints,
00203                                   AF_Dimension   dim );
00204 
00205 /* */
00206 
00207 FT_END_HEADER
00208 
00209 #endif /* __AFLATIN_H__ */
00210 
00211 
00212 /* END */

Generated on Tue Jul 5 14:13:41 2011 for ROOT_528-00b_version by  doxygen 1.5.1