summaryrefslogtreecommitdiffstats
path: root/src/autofit/afhints.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/autofit/afhints.h')
-rw-r--r--src/autofit/afhints.h108
1 files changed, 54 insertions, 54 deletions
diff --git a/src/autofit/afhints.h b/src/autofit/afhints.h
index c0ebd0d..a64c7a4 100644
--- a/src/autofit/afhints.h
+++ b/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, */
@@ -72,13 +72,9 @@ FT_BEGIN_HEADER
* `af_{cjk,latin,...}_hints_compute_segments' are the functions to
* find segments in an outline.
*
- * A segment is a series of consecutive points that are approximately
- * aligned along a coordinate axis. The analysis to do so is specific
- * to a writing system.
- *
- * A segment must have at least two points, except in the case of
- * `fake' segments that are generated to hint metrics appropriately,
- * and which consist of a single point.
+ * A segment is a series of at least two consecutive points that are
+ * approximately aligned along a coordinate axis. The analysis to do
+ * so is specific to a writing system.
*
*
* Edges
@@ -148,7 +144,7 @@ FT_BEGIN_HEADER
* Serifs are detected by `af_{cjk,latin,...}_hint_edges'.
*
* In comparison to a stem, a serif (as handled by the auto-hinter
- * module which takes care of the `latin' writing system) has
+ * module that takes care of the `latin' writing system) has
*
* best segment_1 = segment_2 && best segment_2 != segment_1
*
@@ -178,19 +174,19 @@ FT_BEGIN_HEADER
*
* Strong Points
*
- * Experience has shown that points which are not part of an edge need
- * to be interpolated linearly between their two closest edges, even if
- * these are not part of the contour of those particular points.
- * Typical candidates for this are
+ * Experience has shown that points not part of an edge need to be
+ * interpolated linearly between their two closest edges, even if these
+ * are not part of the contour of those particular points. Typical
+ * candidates for this are
*
* - angle points (i.e., points where the `in' and `out' direction
* differ greatly)
*
* - inflection points (i.e., where the `in' and `out' angles are the
* same, but the curvature changes sign) [currently, such points
- * aren't handled in the auto-hinter]
+ * aren't handled specially in the auto-hinter]
*
- * `af_glyph_hints_align_strong_points' is the function which takes
+ * `af_glyph_hints_align_strong_points' is the function that takes
* care of such situations; it is equivalent to the TrueType `IP'
* hinting instruction.
*
@@ -211,46 +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,
-
- /* point extremum flags */
- AF_FLAG_EXTREMA_X = 1 << 2,
- AF_FLAG_EXTREMA_Y = 1 << 3,
-
- /* point roundness flags */
- AF_FLAG_ROUND_X = 1 << 4,
- AF_FLAG_ROUND_Y = 1 << 5,
-
- /* point touch flags */
- AF_FLAG_TOUCH_X = 1 << 6,
- AF_FLAG_TOUCH_Y = 1 << 7,
+#define AF_FLAG_NONE 0
- /* candidates for weak interpolation have this flag set */
- AF_FLAG_WEAK_INTERPOLATION = 1 << 8,
+ /* 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 )
- /* all inflection points in the outline have this flag set */
- AF_FLAG_INFLECTION = 1 << 9
+ /* 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;
@@ -320,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_
{
@@ -336,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;
@@ -367,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;
@@ -384,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 */
@@ -397,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 )