diff options
Diffstat (limited to 'freetype/src/autofit/afhints.h')
-rw-r--r-- | freetype/src/autofit/afhints.h | 73 |
1 files changed, 44 insertions, 29 deletions
diff --git a/freetype/src/autofit/afhints.h b/freetype/src/autofit/afhints.h index 92101de7c..a64c7a4b1 100644 --- a/freetype/src/autofit/afhints.h +++ b/freetype/src/autofit/afhints.h @@ -4,7 +4,7 @@ /* */ /* Auto-fitter hinting routines (specification). */ /* */ -/* Copyright 2003-2008, 2010-2012, 2014 by */ +/* Copyright 2003-2015 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -207,35 +207,27 @@ FT_BEGIN_HEADER /* point hint flags */ - typedef enum AF_Flags_ - { - AF_FLAG_NONE = 0, - - /* point type flags */ - AF_FLAG_CONIC = 1 << 0, - AF_FLAG_CUBIC = 1 << 1, - AF_FLAG_CONTROL = AF_FLAG_CONIC | AF_FLAG_CUBIC, +#define AF_FLAG_NONE 0 - /* point touch flags */ - AF_FLAG_TOUCH_X = 1 << 2, - AF_FLAG_TOUCH_Y = 1 << 3, + /* point type flags */ +#define AF_FLAG_CONIC ( 1U << 0 ) +#define AF_FLAG_CUBIC ( 1U << 1 ) +#define AF_FLAG_CONTROL ( AF_FLAG_CONIC | AF_FLAG_CUBIC ) - /* candidates for weak interpolation have this flag set */ - AF_FLAG_WEAK_INTERPOLATION = 1 << 4 + /* point touch flags */ +#define AF_FLAG_TOUCH_X ( 1U << 2 ) +#define AF_FLAG_TOUCH_Y ( 1U << 3 ) - } AF_Flags; + /* candidates for weak interpolation have this flag set */ +#define AF_FLAG_WEAK_INTERPOLATION ( 1U << 4 ) /* edge hint flags */ - typedef enum AF_Edge_Flags_ - { - AF_EDGE_NORMAL = 0, - AF_EDGE_ROUND = 1 << 0, - AF_EDGE_SERIF = 1 << 1, - AF_EDGE_DONE = 1 << 2, - AF_EDGE_NEUTRAL = 1 << 3 /* set if edge aligns to a neutral blue zone */ - - } AF_Edge_Flags; +#define AF_EDGE_NORMAL 0 +#define AF_EDGE_ROUND ( 1U << 0 ) +#define AF_EDGE_SERIF ( 1U << 1 ) +#define AF_EDGE_DONE ( 1U << 2 ) +#define AF_EDGE_NEUTRAL ( 1U << 3 ) /* edge aligns to a neutral blue zone */ typedef struct AF_PointRec_* AF_Point; @@ -305,6 +297,8 @@ FT_BEGIN_HEADER } AF_EdgeRec; +#define AF_SEGMENTS_EMBEDDED 18 /* number of embedded segments */ +#define AF_EDGES_EMBEDDED 12 /* number of embedded edges */ typedef struct AF_AxisHintsRec_ { @@ -321,9 +315,20 @@ FT_BEGIN_HEADER AF_Direction major_dir; /* either vertical or horizontal */ + /* two arrays to avoid allocation penalty */ + struct + { + AF_SegmentRec segments[AF_SEGMENTS_EMBEDDED]; + AF_EdgeRec edges[AF_EDGES_EMBEDDED]; + } embedded; + + } AF_AxisHintsRec, *AF_AxisHints; +#define AF_POINTS_EMBEDDED 96 /* number of embedded points */ +#define AF_CONTOURS_EMBEDDED 8 /* number of embedded contours */ + typedef struct AF_GlyphHintsRec_ { FT_Memory memory; @@ -352,6 +357,14 @@ FT_BEGIN_HEADER FT_Pos xmin_delta; /* used for warping */ FT_Pos xmax_delta; + /* Two arrays to avoid allocation penalty. */ + /* The `embedded' structure must be the last element! */ + struct + { + AF_Point contours[AF_CONTOURS_EMBEDDED]; + AF_PointRec points[AF_POINTS_EMBEDDED]; + } embedded; + } AF_GlyphHintsRec; @@ -369,9 +382,6 @@ FT_BEGIN_HEADER ( !_af_debug_disable_vert_hints && \ !AF_HINTS_TEST_SCALER( h, AF_SCALER_FLAG_NO_VERTICAL ) ) -#define AF_HINTS_DO_ADVANCE( h ) \ - !AF_HINTS_TEST_SCALER( h, AF_SCALER_FLAG_NO_ADVANCE ) - #define AF_HINTS_DO_BLUES( h ) ( !_af_debug_disable_blue_hints ) #else /* !FT_DEBUG_AUTOFIT */ @@ -382,12 +392,17 @@ FT_BEGIN_HEADER #define AF_HINTS_DO_VERTICAL( h ) \ !AF_HINTS_TEST_SCALER( h, AF_SCALER_FLAG_NO_VERTICAL ) +#define AF_HINTS_DO_BLUES( h ) 1 + +#endif /* !FT_DEBUG_AUTOFIT */ + + #define AF_HINTS_DO_ADVANCE( h ) \ !AF_HINTS_TEST_SCALER( h, AF_SCALER_FLAG_NO_ADVANCE ) -#define AF_HINTS_DO_BLUES( h ) 1 +#define AF_HINTS_DO_WARP( h ) \ + !AF_HINTS_TEST_SCALER( h, AF_SCALER_FLAG_NO_WARPER ) -#endif /* !FT_DEBUG_AUTOFIT */ FT_LOCAL( AF_Direction ) |