misc/libfreetype/src/autofit/afhints.h
author koda
Tue, 26 Mar 2013 01:13:45 +0100
branchcmake_pascal
changeset 8846 c156ac6ddc2b
parent 5172 88f2e05288ba
permissions -rw-r--r--
set directories to be included externally, in the project file
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5172
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     1
/***************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     2
/*                                                                         */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     3
/*  afhints.h                                                              */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     4
/*                                                                         */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     5
/*    Auto-fitter hinting routines (specification).                        */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     6
/*                                                                         */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     7
/*  Copyright 2003-2008, 2010-2011 by                                      */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     8
/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     9
/*                                                                         */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    10
/*  This file is part of the FreeType project, and may only be used,       */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    11
/*  modified, and distributed under the terms of the FreeType project      */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    12
/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    13
/*  this file you indicate that you have read the license and              */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    14
/*  understand and accept it fully.                                        */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    15
/*                                                                         */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    16
/***************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    17
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    18
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    19
#ifndef __AFHINTS_H__
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    20
#define __AFHINTS_H__
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    21
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    22
#include "aftypes.h"
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    23
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    24
#define xxAF_SORT_SEGMENTS
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    25
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    26
FT_BEGIN_HEADER
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    27
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    28
  /*
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    29
   *  The definition of outline glyph hints.  These are shared by all
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    30
   *  script analysis routines (until now).
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    31
   */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    32
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    33
  typedef enum  AF_Dimension_
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    34
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    35
    AF_DIMENSION_HORZ = 0,  /* x coordinates,                    */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    36
                            /* i.e., vertical segments & edges   */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    37
    AF_DIMENSION_VERT = 1,  /* y coordinates,                    */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    38
                            /* i.e., horizontal segments & edges */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    39
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    40
    AF_DIMENSION_MAX  /* do not remove */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    41
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    42
  } AF_Dimension;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    43
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    44
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    45
  /* hint directions -- the values are computed so that two vectors are */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    46
  /* in opposite directions iff `dir1 + dir2 == 0'                      */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    47
  typedef enum  AF_Direction_
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    48
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    49
    AF_DIR_NONE  =  4,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    50
    AF_DIR_RIGHT =  1,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    51
    AF_DIR_LEFT  = -1,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    52
    AF_DIR_UP    =  2,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    53
    AF_DIR_DOWN  = -2
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    54
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    55
  } AF_Direction;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    56
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    57
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    58
  /*
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    59
   *  The following explanations are mostly taken from the article
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    60
   *
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    61
   *    Real-Time Grid Fitting of Typographic Outlines
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    62
   *
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    63
   *  by David Turner and Werner Lemberg
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    64
   *
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    65
   *   http://www.tug.org/TUGboat/Articles/tb24-3/lemberg.pdf
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    66
   *
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    67
   *
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    68
   *  Segments
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    69
   *
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    70
   *    `af_{cjk,latin,...}_hints_compute_segments' are the functions to
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    71
   *    find segments in an outline.  A segment is a series of consecutive
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    72
   *    points that are approximately aligned along a coordinate axis.  The
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    73
   *    analysis to do so is specific to a script.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    74
   *
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    75
   *    A segment must have at least two points, except in the case of
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    76
   *    `fake' segments that are generated to hint metrics appropriately,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    77
   *    and which consist of a single point.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    78
   *
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    79
   *
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    80
   *  Edges
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    81
   *
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    82
   *    As soon as segments are defined, the auto-hinter groups them into
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    83
   *    edges.  An edge corresponds to a single position on the main
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    84
   *    dimension that collects one or more segments (allowing for a small
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    85
   *    threshold).
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    86
   *
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    87
   *    The auto-hinter first tries to grid fit edges, then to align
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    88
   *    segments on the edges unless it detects that they form a serif.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    89
   *
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    90
   *    `af_{cjk,latin,...}_hints_compute_edges' are the functions to find
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    91
   *    edges; they are specific to a script.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    92
   *
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    93
   *
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    94
   *                      A          H
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    95
   *                       |        |
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    96
   *                       |        |
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    97
   *                       |        |
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    98
   *                       |        |
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    99
   *         C             |        |             F
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   100
   *          +------<-----+        +-----<------+
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   101
   *          |             B      G             |
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   102
   *          |                                  |
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   103
   *          |                                  |
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   104
   *          +--------------->------------------+
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   105
   *         D                                    E
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   106
   *
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   107
   *
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   108
   *  Stems
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   109
   *
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   110
   *    Segments need to be `linked' to other ones in order to detect stems.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   111
   *    A stem is made of two segments that face each other in opposite
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   112
   *    directions and that are sufficiently close to each other.  Using
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   113
   *    vocabulary from the TrueType specification, stem segments form a
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   114
   *    `black distance'.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   115
   *
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   116
   *    In the above ASCII drawing, the horizontal segments are BC, DE, and
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   117
   *    FG; the vertical segments are AB, CD, EF, and GH.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   118
   *
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   119
   *    Each segment has at most one `best' candidate to form a black
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   120
   *    distance, or no candidate at all.  Notice that two distinct segments
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   121
   *    can have the same candidate, which frequently means a serif.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   122
   *
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   123
   *    A stem is recognized by the following condition:
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   124
   *
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   125
   *      best segment_1 = segment_2 && best segment_2 = segment_1
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   126
   *
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   127
   *    The best candidate is stored in field `link' in structure
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   128
   *    `AF_Segment'.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   129
   *
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   130
   *    Stems are detected by `af_{cjk,latin,...}_hint_edges'.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   131
   *
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   132
   *    In the above ASCII drawing, the best candidate for both AB and CD is
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   133
   *    GH, while the best candidate for GH is AB.  Similarly, the best
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   134
   *    candidate for EF and GH is AB, while the best candidate for AB is
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   135
   *    GH.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   136
   *
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   137
   *
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   138
   *  Serifs
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   139
   *
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   140
   *    On the opposite, a serif has
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   141
   *
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   142
   *      best segment_1 = segment_2 && best segment_2 != segment_1
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   143
   *
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   144
   *    where segment_1 corresponds to the serif segment (CD and EF in the
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   145
   *    above ASCII drawing).
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   146
   *
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   147
   *    The best candidate is stored in field `serif' in structure
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   148
   *    `AF_Segment' (and `link' is set to NULL).
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   149
   *
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   150
   *    Serifs are detected by `af_{cjk,latin,...}_hint_edges'.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   151
   *
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   152
   *
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   153
   *  Touched points
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   154
   *
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   155
   *    A point is called `touched' if it has been processed somehow by the
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   156
   *    auto-hinter.  It basically means that it shouldn't be moved again
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   157
   *    (or moved only under certain constraints to preserve the already
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   158
   *    applied processing).
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   159
   *
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   160
   *
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   161
   *  Flat and round segments
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   162
   *
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   163
   *    Segments are `round' or `flat', depending on the series of points
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   164
   *    that define them.  A segment is round if the next and previous point
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   165
   *    of an extremum (which can be either a single point or sequence of
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   166
   *    points) are both conic or cubic control points.  Otherwise, a
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   167
   *    segment with an extremum is flat.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   168
   *
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   169
   *
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   170
   *  Strong Points
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   171
   *
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   172
   *    Experience has shown that points which are not part of an edge need
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   173
   *    to be interpolated linearly between their two closest edges, even if
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   174
   *    these are not part of the contour of those particular points.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   175
   *    Typical candidates for this are
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   176
   *
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   177
   *    - angle points (i.e., points where the `in' and `out' direction
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   178
   *      differ greatly)
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   179
   *
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   180
   *    - inflection points (i.e., where the `in' and `out' angles are the
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   181
   *      same, but the curvature changes sign)
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   182
   *
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   183
   *    `af_glyph_hints_align_strong_points' is the function which takes
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   184
   *    care of such situations; it is equivalent to the TrueType `IP'
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   185
   *    hinting instruction.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   186
   *
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   187
   *
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   188
   *  Weak Points
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   189
   *
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   190
   *    Other points in the outline must be interpolated using the
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   191
   *    coordinates of their previous and next unfitted contour neighbours.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   192
   *    These are called `weak points' and are touched by the function
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   193
   *    `af_glyph_hints_align_weak_points', equivalent to the TrueType `IUP'
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   194
   *    hinting instruction.  Typical candidates are control points and
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   195
   *    points on the contour without a major direction.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   196
   *
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   197
   *    The major effect is to reduce possible distortion caused by
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   198
   *    alignment of edges and strong points, thus weak points are processed
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   199
   *    after strong points.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   200
   */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   201
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   202
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   203
  /* point hint flags */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   204
  typedef enum  AF_Flags_
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   205
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   206
    AF_FLAG_NONE = 0,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   207
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   208
    /* point type flags */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   209
    AF_FLAG_CONIC   = 1 << 0,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   210
    AF_FLAG_CUBIC   = 1 << 1,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   211
    AF_FLAG_CONTROL = AF_FLAG_CONIC | AF_FLAG_CUBIC,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   212
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   213
    /* point extremum flags */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   214
    AF_FLAG_EXTREMA_X = 1 << 2,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   215
    AF_FLAG_EXTREMA_Y = 1 << 3,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   216
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   217
    /* point roundness flags */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   218
    AF_FLAG_ROUND_X = 1 << 4,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   219
    AF_FLAG_ROUND_Y = 1 << 5,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   220
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   221
    /* point touch flags */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   222
    AF_FLAG_TOUCH_X = 1 << 6,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   223
    AF_FLAG_TOUCH_Y = 1 << 7,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   224
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   225
    /* candidates for weak interpolation have this flag set */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   226
    AF_FLAG_WEAK_INTERPOLATION = 1 << 8,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   227
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   228
    /* all inflection points in the outline have this flag set */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   229
    AF_FLAG_INFLECTION = 1 << 9
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   230
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   231
  } AF_Flags;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   232
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   233
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   234
  /* edge hint flags */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   235
  typedef enum  AF_Edge_Flags_
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   236
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   237
    AF_EDGE_NORMAL = 0,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   238
    AF_EDGE_ROUND  = 1 << 0,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   239
    AF_EDGE_SERIF  = 1 << 1,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   240
    AF_EDGE_DONE   = 1 << 2
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   241
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   242
  } AF_Edge_Flags;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   243
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   244
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   245
  typedef struct AF_PointRec_*    AF_Point;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   246
  typedef struct AF_SegmentRec_*  AF_Segment;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   247
  typedef struct AF_EdgeRec_*     AF_Edge;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   248
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   249
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   250
  typedef struct  AF_PointRec_
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   251
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   252
    FT_UShort  flags;    /* point flags used by hinter   */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   253
    FT_Char    in_dir;   /* direction of inwards vector  */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   254
    FT_Char    out_dir;  /* direction of outwards vector */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   255
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   256
    FT_Pos     ox, oy;   /* original, scaled position                   */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   257
    FT_Short   fx, fy;   /* original, unscaled position (font units)    */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   258
    FT_Pos     x, y;     /* current position                            */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   259
    FT_Pos     u, v;     /* current (x,y) or (y,x) depending on context */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   260
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   261
    AF_Point   next;     /* next point in contour     */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   262
    AF_Point   prev;     /* previous point in contour */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   263
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   264
  } AF_PointRec;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   265
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   266
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   267
  typedef struct  AF_SegmentRec_
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   268
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   269
    FT_Byte     flags;       /* edge/segment flags for this segment */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   270
    FT_Char     dir;         /* segment direction                   */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   271
    FT_Short    pos;         /* position of segment                 */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   272
    FT_Short    min_coord;   /* minimum coordinate of segment       */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   273
    FT_Short    max_coord;   /* maximum coordinate of segment       */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   274
    FT_Short    height;      /* the hinted segment height           */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   275
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   276
    AF_Edge     edge;        /* the segment's parent edge           */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   277
    AF_Segment  edge_next;   /* link to next segment in parent edge */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   278
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   279
    AF_Segment  link;        /* (stem) link segment        */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   280
    AF_Segment  serif;       /* primary segment for serifs */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   281
    FT_Pos      num_linked;  /* number of linked segments  */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   282
    FT_Pos      score;       /* used during stem matching  */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   283
    FT_Pos      len;         /* used during stem matching  */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   284
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   285
    AF_Point    first;       /* first point in edge segment             */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   286
    AF_Point    last;        /* last point in edge segment              */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   287
    AF_Point*   contour;     /* ptr to first point of segment's contour */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   288
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   289
  } AF_SegmentRec;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   290
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   291
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   292
  typedef struct  AF_EdgeRec_
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   293
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   294
    FT_Short    fpos;       /* original, unscaled position (font units) */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   295
    FT_Pos      opos;       /* original, scaled position                */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   296
    FT_Pos      pos;        /* current position                         */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   297
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   298
    FT_Byte     flags;      /* edge flags                                   */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   299
    FT_Char     dir;        /* edge direction                               */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   300
    FT_Fixed    scale;      /* used to speed up interpolation between edges */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   301
    AF_Width    blue_edge;  /* non-NULL if this is a blue edge              */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   302
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   303
    AF_Edge     link;       /* link edge                 */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   304
    AF_Edge     serif;      /* primary edge for serifs   */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   305
    FT_Short    num_linked; /* number of linked edges    */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   306
    FT_Int      score;      /* used during stem matching */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   307
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   308
    AF_Segment  first;      /* first segment in edge */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   309
    AF_Segment  last;       /* last segment in edge  */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   310
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   311
  } AF_EdgeRec;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   312
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   313
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   314
  typedef struct  AF_AxisHintsRec_
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   315
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   316
    FT_Int        num_segments; /* number of used segments      */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   317
    FT_Int        max_segments; /* number of allocated segments */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   318
    AF_Segment    segments;     /* segments array               */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   319
#ifdef AF_SORT_SEGMENTS
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   320
    FT_Int        mid_segments;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   321
#endif
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   322
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   323
    FT_Int        num_edges;    /* number of used edges      */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   324
    FT_Int        max_edges;    /* number of allocated edges */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   325
    AF_Edge       edges;        /* edges array               */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   326
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   327
    AF_Direction  major_dir;    /* either vertical or horizontal */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   328
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   329
  } AF_AxisHintsRec, *AF_AxisHints;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   330
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   331
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   332
  typedef struct  AF_GlyphHintsRec_
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   333
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   334
    FT_Memory         memory;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   335
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   336
    FT_Fixed          x_scale;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   337
    FT_Pos            x_delta;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   338
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   339
    FT_Fixed          y_scale;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   340
    FT_Pos            y_delta;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   341
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   342
    FT_Int            max_points;    /* number of allocated points */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   343
    FT_Int            num_points;    /* number of used points      */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   344
    AF_Point          points;        /* points array               */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   345
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   346
    FT_Int            max_contours;  /* number of allocated contours */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   347
    FT_Int            num_contours;  /* number of used contours      */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   348
    AF_Point*         contours;      /* contours array               */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   349
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   350
    AF_AxisHintsRec   axis[AF_DIMENSION_MAX];
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   351
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   352
    FT_UInt32         scaler_flags;  /* copy of scaler flags     */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   353
    FT_UInt32         other_flags;   /* free for script-specific */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   354
                                     /* implementations          */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   355
    AF_ScriptMetrics  metrics;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   356
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   357
    FT_Pos            xmin_delta;    /* used for warping */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   358
    FT_Pos            xmax_delta;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   359
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   360
  } AF_GlyphHintsRec;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   361
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   362
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   363
#define AF_HINTS_TEST_SCALER( h, f )  ( (h)->scaler_flags & (f) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   364
#define AF_HINTS_TEST_OTHER( h, f )   ( (h)->other_flags  & (f) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   365
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   366
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   367
#ifdef FT_DEBUG_AUTOFIT
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   368
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   369
#define AF_HINTS_DO_HORIZONTAL( h )                                     \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   370
          ( !_af_debug_disable_horz_hints                            && \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   371
            !AF_HINTS_TEST_SCALER( h, AF_SCALER_FLAG_NO_HORIZONTAL ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   372
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   373
#define AF_HINTS_DO_VERTICAL( h )                                     \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   374
          ( !_af_debug_disable_vert_hints                          && \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   375
            !AF_HINTS_TEST_SCALER( h, AF_SCALER_FLAG_NO_VERTICAL ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   376
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   377
#define AF_HINTS_DO_ADVANCE( h )                                \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   378
          !AF_HINTS_TEST_SCALER( h, AF_SCALER_FLAG_NO_ADVANCE )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   379
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   380
#define AF_HINTS_DO_BLUES( h )  ( !_af_debug_disable_blue_hints )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   381
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   382
#else /* !FT_DEBUG_AUTOFIT */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   383
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   384
#define AF_HINTS_DO_HORIZONTAL( h )                                \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   385
          !AF_HINTS_TEST_SCALER( h, AF_SCALER_FLAG_NO_HORIZONTAL )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   386
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   387
#define AF_HINTS_DO_VERTICAL( h )                                \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   388
          !AF_HINTS_TEST_SCALER( h, AF_SCALER_FLAG_NO_VERTICAL )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   389
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   390
#define AF_HINTS_DO_ADVANCE( h )                                \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   391
          !AF_HINTS_TEST_SCALER( h, AF_SCALER_FLAG_NO_ADVANCE )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   392
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   393
#define AF_HINTS_DO_BLUES( h )  1
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   394
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   395
#endif /* !FT_DEBUG_AUTOFIT */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   396
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   397
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   398
  FT_LOCAL( AF_Direction )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   399
  af_direction_compute( FT_Pos  dx,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   400
                        FT_Pos  dy );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   401
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   402
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   403
  FT_LOCAL( FT_Error )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   404
  af_axis_hints_new_segment( AF_AxisHints  axis,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   405
                             FT_Memory     memory,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   406
                             AF_Segment   *asegment );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   407
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   408
  FT_LOCAL( FT_Error)
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   409
  af_axis_hints_new_edge( AF_AxisHints  axis,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   410
                          FT_Int        fpos,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   411
                          AF_Direction  dir,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   412
                          FT_Memory     memory,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   413
                          AF_Edge      *edge );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   414
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   415
  FT_LOCAL( void )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   416
  af_glyph_hints_init( AF_GlyphHints  hints,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   417
                       FT_Memory      memory );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   418
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   419
  FT_LOCAL( void )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   420
  af_glyph_hints_rescale( AF_GlyphHints     hints,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   421
                          AF_ScriptMetrics  metrics );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   422
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   423
  FT_LOCAL( FT_Error )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   424
  af_glyph_hints_reload( AF_GlyphHints  hints,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   425
                         FT_Outline*    outline );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   426
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   427
  FT_LOCAL( void )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   428
  af_glyph_hints_save( AF_GlyphHints  hints,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   429
                       FT_Outline*    outline );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   430
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   431
  FT_LOCAL( void )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   432
  af_glyph_hints_align_edge_points( AF_GlyphHints  hints,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   433
                                    AF_Dimension   dim );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   434
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   435
  FT_LOCAL( void )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   436
  af_glyph_hints_align_strong_points( AF_GlyphHints  hints,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   437
                                      AF_Dimension   dim );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   438
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   439
  FT_LOCAL( void )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   440
  af_glyph_hints_align_weak_points( AF_GlyphHints  hints,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   441
                                    AF_Dimension   dim );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   442
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   443
#ifdef AF_CONFIG_OPTION_USE_WARPER
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   444
  FT_LOCAL( void )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   445
  af_glyph_hints_scale_dim( AF_GlyphHints  hints,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   446
                            AF_Dimension   dim,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   447
                            FT_Fixed       scale,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   448
                            FT_Pos         delta );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   449
#endif
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   450
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   451
  FT_LOCAL( void )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   452
  af_glyph_hints_done( AF_GlyphHints  hints );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   453
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   454
/* */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   455
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   456
#define AF_SEGMENT_LEN( seg )          ( (seg)->max_coord - (seg)->min_coord )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   457
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   458
#define AF_SEGMENT_DIST( seg1, seg2 )  ( ( (seg1)->pos > (seg2)->pos )   \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   459
                                           ? (seg1)->pos - (seg2)->pos   \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   460
                                           : (seg2)->pos - (seg1)->pos )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   461
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   462
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   463
FT_END_HEADER
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   464
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   465
#endif /* __AFHINTS_H__ */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   466
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   467
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   468
/* END */