summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/freetype/src/autofit/afhints.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/3rdparty/freetype/src/autofit/afhints.h')
-rw-r--r--src/3rdparty/freetype/src/autofit/afhints.h272
1 files changed, 129 insertions, 143 deletions
diff --git a/src/3rdparty/freetype/src/autofit/afhints.h b/src/3rdparty/freetype/src/autofit/afhints.h
index 3326ebc44e..d1cf9529bf 100644
--- a/src/3rdparty/freetype/src/autofit/afhints.h
+++ b/src/3rdparty/freetype/src/autofit/afhints.h
@@ -1,19 +1,19 @@
-/***************************************************************************/
-/* */
-/* afhints.h */
-/* */
-/* Auto-fitter hinting routines (specification). */
-/* */
-/* Copyright 2003-2018 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
+/****************************************************************************
+ *
+ * afhints.h
+ *
+ * Auto-fitter hinting routines (specification).
+ *
+ * Copyright (C) 2003-2023 by
+ * David Turner, Robert Wilhelm, and Werner Lemberg.
+ *
+ * This file is part of the FreeType project, and may only be used,
+ * modified, and distributed under the terms of the FreeType project
+ * license, LICENSE.TXT. By continuing to use, modify, or distribute
+ * this file you indicate that you have read the license and
+ * understand and accept it fully.
+ *
+ */
#ifndef AFHINTS_H_
@@ -21,13 +21,11 @@
#include "aftypes.h"
-#define xxAF_SORT_SEGMENTS
-
FT_BEGIN_HEADER
/*
- * The definition of outline glyph hints. These are shared by all
- * writing system analysis routines (until now).
+ * The definition of outline glyph hints. These are shared by all
+ * writing system analysis routines (until now).
*/
typedef enum AF_Dimension_
@@ -56,153 +54,153 @@ FT_BEGIN_HEADER
/*
- * The following explanations are mostly taken from the article
+ * The following explanations are mostly taken from the article
*
- * Real-Time Grid Fitting of Typographic Outlines
+ * Real-Time Grid Fitting of Typographic Outlines
*
- * by David Turner and Werner Lemberg
+ * by David Turner and Werner Lemberg
*
- * https://www.tug.org/TUGboat/Articles/tb24-3/lemberg.pdf
+ * https://www.tug.org/TUGboat/Articles/tb24-3/lemberg.pdf
*
- * with appropriate updates.
+ * with appropriate updates.
*
*
- * Segments
+ * Segments
*
- * `af_{cjk,latin,...}_hints_compute_segments' are the functions to
- * find segments in an outline.
+ * `af_{cjk,latin,...}_hints_compute_segments' are the functions to
+ * find segments in an outline.
*
- * 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.
+ * 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
+ * Edges
*
- * `af_{cjk,latin,...}_hints_compute_edges' are the functions to find
- * edges.
+ * `af_{cjk,latin,...}_hints_compute_edges' are the functions to find
+ * edges.
*
- * As soon as segments are defined, the auto-hinter groups them into
- * edges. An edge corresponds to a single position on the main
- * dimension that collects one or more segments (allowing for a small
- * threshold).
+ * As soon as segments are defined, the auto-hinter groups them into
+ * edges. An edge corresponds to a single position on the main
+ * dimension that collects one or more segments (allowing for a small
+ * threshold).
*
- * As an example, the `latin' writing system first tries to grid-fit
- * edges, then to align segments on the edges unless it detects that
- * they form a serif.
+ * As an example, the `latin' writing system first tries to grid-fit
+ * edges, then to align segments on the edges unless it detects that
+ * they form a serif.
*
*
- * A H
- * | |
- * | |
- * | |
- * | |
- * C | | F
- * +------<-----+ +-----<------+
- * | B G |
- * | |
- * | |
- * +--------------->------------------+
- * D E
+ * A H
+ * | |
+ * | |
+ * | |
+ * | |
+ * C | | F
+ * +------<-----+ +-----<------+
+ * | B G |
+ * | |
+ * | |
+ * +--------------->------------------+
+ * D E
*
*
- * Stems
+ * Stems
*
- * Stems are detected by `af_{cjk,latin,...}_hint_edges'.
+ * Stems are detected by `af_{cjk,latin,...}_hint_edges'.
*
- * Segments need to be `linked' to other ones in order to detect stems.
- * A stem is made of two segments that face each other in opposite
- * directions and that are sufficiently close to each other. Using
- * vocabulary from the TrueType specification, stem segments form a
- * `black distance'.
+ * Segments need to be `linked' to other ones in order to detect stems.
+ * A stem is made of two segments that face each other in opposite
+ * directions and that are sufficiently close to each other. Using
+ * vocabulary from the TrueType specification, stem segments form a
+ * `black distance'.
*
- * In the above ASCII drawing, the horizontal segments are BC, DE, and
- * FG; the vertical segments are AB, CD, EF, and GH.
+ * In the above ASCII drawing, the horizontal segments are BC, DE, and
+ * FG; the vertical segments are AB, CD, EF, and GH.
*
- * Each segment has at most one `best' candidate to form a black
- * distance, or no candidate at all. Notice that two distinct segments
- * can have the same candidate, which frequently means a serif.
+ * Each segment has at most one `best' candidate to form a black
+ * distance, or no candidate at all. Notice that two distinct segments
+ * can have the same candidate, which frequently means a serif.
*
- * A stem is recognized by the following condition:
+ * A stem is recognized by the following condition:
*
- * best segment_1 = segment_2 && best segment_2 = segment_1
+ * best segment_1 = segment_2 && best segment_2 = segment_1
*
- * The best candidate is stored in field `link' in structure
- * `AF_Segment'.
+ * The best candidate is stored in field `link' in structure
+ * `AF_Segment'.
*
- * In the above ASCII drawing, the best candidate for both AB and CD is
- * GH, while the best candidate for GH is AB. Similarly, the best
- * candidate for EF and GH is AB, while the best candidate for AB is
- * GH.
+ * In the above ASCII drawing, the best candidate for both AB and CD is
+ * GH, while the best candidate for GH is AB. Similarly, the best
+ * candidate for EF and GH is AB, while the best candidate for AB is
+ * GH.
*
- * The detection and handling of stems is dependent on the writing
- * system.
+ * The detection and handling of stems is dependent on the writing
+ * system.
*
*
- * Serifs
+ * Serifs
*
- * Serifs are detected by `af_{cjk,latin,...}_hint_edges'.
+ * Serifs are detected by `af_{cjk,latin,...}_hint_edges'.
*
- * In comparison to a stem, a serif (as handled by the auto-hinter
- * module that takes care of the `latin' writing system) has
+ * In comparison to a stem, a serif (as handled by the auto-hinter
+ * module that takes care of the `latin' writing system) has
*
- * best segment_1 = segment_2 && best segment_2 != segment_1
+ * best segment_1 = segment_2 && best segment_2 != segment_1
*
- * where segment_1 corresponds to the serif segment (CD and EF in the
- * above ASCII drawing).
+ * where segment_1 corresponds to the serif segment (CD and EF in the
+ * above ASCII drawing).
*
- * The best candidate is stored in field `serif' in structure
- * `AF_Segment' (and `link' is set to NULL).
+ * The best candidate is stored in field `serif' in structure
+ * `AF_Segment' (and `link' is set to NULL).
*
*
- * Touched points
+ * Touched points
*
- * A point is called `touched' if it has been processed somehow by the
- * auto-hinter. It basically means that it shouldn't be moved again
- * (or moved only under certain constraints to preserve the already
- * applied processing).
+ * A point is called `touched' if it has been processed somehow by the
+ * auto-hinter. It basically means that it shouldn't be moved again
+ * (or moved only under certain constraints to preserve the already
+ * applied processing).
*
*
- * Flat and round segments
+ * Flat and round segments
*
- * Segments are `round' or `flat', depending on the series of points
- * that define them. A segment is round if the next and previous point
- * of an extremum (which can be either a single point or sequence of
- * points) are both conic or cubic control points. Otherwise, a
- * segment with an extremum is flat.
+ * Segments are `round' or `flat', depending on the series of points
+ * that define them. A segment is round if the next and previous point
+ * of an extremum (which can be either a single point or sequence of
+ * points) are both conic or cubic control points. Otherwise, a
+ * segment with an extremum is flat.
*
*
- * Strong Points
+ * Strong Points
*
- * 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
+ * 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)
+ * - 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 specially in the auto-hinter]
+ * - inflection points (i.e., where the `in' and `out' angles are the
+ * same, but the curvature changes sign) [currently, such points
+ * aren't handled specially in the auto-hinter]
*
- * `af_glyph_hints_align_strong_points' is the function that takes
- * care of such situations; it is equivalent to the TrueType `IP'
- * hinting instruction.
+ * `af_glyph_hints_align_strong_points' is the function that takes
+ * care of such situations; it is equivalent to the TrueType `IP'
+ * hinting instruction.
*
*
- * Weak Points
+ * Weak Points
*
- * Other points in the outline must be interpolated using the
- * coordinates of their previous and next unfitted contour neighbours.
- * These are called `weak points' and are touched by the function
- * `af_glyph_hints_align_weak_points', equivalent to the TrueType `IUP'
- * hinting instruction. Typical candidates are control points and
- * points on the contour without a major direction.
+ * Other points in the outline must be interpolated using the
+ * coordinates of their previous and next unfitted contour neighbours.
+ * These are called `weak points' and are touched by the function
+ * `af_glyph_hints_align_weak_points', equivalent to the TrueType `IUP'
+ * hinting instruction. Typical candidates are control points and
+ * points on the contour without a major direction.
*
- * The major effect is to reduce possible distortion caused by
- * alignment of edges and strong points, thus weak points are processed
- * after strong points.
+ * The major effect is to reduce possible distortion caused by
+ * alignment of edges and strong points, thus weak points are processed
+ * after strong points.
*/
@@ -252,6 +250,12 @@ FT_BEGIN_HEADER
AF_Point next; /* next point in contour */
AF_Point prev; /* previous point in contour */
+#ifdef FT_DEBUG_AUTOFIT
+ /* track `before' and `after' edges for strong points */
+ AF_Edge before[2];
+ AF_Edge after[2];
+#endif
+
} AF_PointRec;
@@ -304,15 +308,12 @@ FT_BEGIN_HEADER
typedef struct AF_AxisHintsRec_
{
- FT_Int num_segments; /* number of used segments */
- FT_Int max_segments; /* number of allocated segments */
+ FT_UInt num_segments; /* number of used segments */
+ FT_UInt max_segments; /* number of allocated segments */
AF_Segment segments; /* segments array */
-#ifdef AF_SORT_SEGMENTS
- FT_Int mid_segments;
-#endif
- FT_Int num_edges; /* number of used edges */
- FT_Int max_edges; /* number of allocated edges */
+ FT_UInt num_edges; /* number of used edges */
+ FT_UInt max_edges; /* number of allocated edges */
AF_Edge edges; /* edges array */
AF_Direction major_dir; /* either vertical or horizontal */
@@ -356,9 +357,6 @@ FT_BEGIN_HEADER
/* implementations */
AF_StyleMetrics metrics;
- 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
@@ -377,14 +375,14 @@ FT_BEGIN_HEADER
#ifdef FT_DEBUG_AUTOFIT
#define AF_HINTS_DO_HORIZONTAL( h ) \
- ( !_af_debug_disable_horz_hints && \
+ ( !af_debug_disable_horz_hints_ && \
!AF_HINTS_TEST_SCALER( h, AF_SCALER_FLAG_NO_HORIZONTAL ) )
#define AF_HINTS_DO_VERTICAL( h ) \
- ( !_af_debug_disable_vert_hints && \
+ ( !af_debug_disable_vert_hints_ && \
!AF_HINTS_TEST_SCALER( h, AF_SCALER_FLAG_NO_VERTICAL ) )
-#define AF_HINTS_DO_BLUES( h ) ( !_af_debug_disable_blue_hints )
+#define AF_HINTS_DO_BLUES( h ) ( !af_debug_disable_blue_hints_ )
#else /* !FT_DEBUG_AUTOFIT */
@@ -402,10 +400,6 @@ FT_BEGIN_HEADER
#define AF_HINTS_DO_ADVANCE( h ) \
!AF_HINTS_TEST_SCALER( h, AF_SCALER_FLAG_NO_ADVANCE )
-#define AF_HINTS_DO_WARP( h ) \
- !AF_HINTS_TEST_SCALER( h, AF_SCALER_FLAG_NO_WARPER )
-
-
FT_LOCAL( AF_Direction )
af_direction_compute( FT_Pos dx,
@@ -453,14 +447,6 @@ FT_BEGIN_HEADER
af_glyph_hints_align_weak_points( AF_GlyphHints hints,
AF_Dimension dim );
-#ifdef AF_CONFIG_OPTION_USE_WARPER
- FT_LOCAL( void )
- af_glyph_hints_scale_dim( AF_GlyphHints hints,
- AF_Dimension dim,
- FT_Fixed scale,
- FT_Pos delta );
-#endif
-
FT_LOCAL( void )
af_glyph_hints_done( AF_GlyphHints hints );