misc/libfreetype/src/autofit/aftypes.h
author Xeli
Thu, 11 Aug 2011 14:59:14 +0200
branchhedgeroid
changeset 5542 141c12a23787
parent 5172 88f2e05288ba
permissions -rw-r--r--
start of implementation of the save button, check if there's something to save and update TeamSelectionActivity if a change has been made
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
/*  aftypes.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 types (specification only).                              */
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-2009, 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
  /*************************************************************************
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    20
   *
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    21
   *  The auto-fitter is a complete rewrite of the old auto-hinter.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    22
   *  Its main feature is the ability to differentiate between different
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    23
   *  scripts in order to apply language-specific rules.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    24
   *
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    25
   *  The code has also been compartmentized into several entities that
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    26
   *  should make algorithmic experimentation easier than with the old
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    27
   *  code.
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
   *  Finally, we get rid of the Catharon license, since this code is
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    30
   *  released under the FreeType one.
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
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
#ifndef __AFTYPES_H__
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    36
#define __AFTYPES_H__
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    37
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    38
#include <ft2build.h>
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
#include FT_FREETYPE_H
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    41
#include FT_OUTLINE_H
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    42
#include FT_INTERNAL_OBJECTS_H
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    43
#include FT_INTERNAL_DEBUG_H
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    46
FT_BEGIN_HEADER
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    47
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
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    50
  /*****                                                               *****/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    51
  /*****                    D E B U G G I N G                          *****/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    52
  /*****                                                               *****/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    53
  /*************************************************************************/
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    56
#ifdef FT_DEBUG_AUTOFIT
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
#include FT_CONFIG_STANDARD_LIBRARY_H
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    59
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    60
extern int    _af_debug_disable_horz_hints;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    61
extern int    _af_debug_disable_vert_hints;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    62
extern int    _af_debug_disable_blue_hints;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    63
extern void*  _af_debug_hints;
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
#endif /* FT_DEBUG_AUTOFIT */
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
  /*************************************************************************/
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
  /*****                                                               *****/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    71
  /*****                 U T I L I T Y   S T U F F                     *****/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    72
  /*****                                                               *****/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    73
  /*************************************************************************/
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    76
  typedef struct  AF_WidthRec_
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    77
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    78
    FT_Pos  org;  /* original position/width in font units              */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    79
    FT_Pos  cur;  /* current/scaled position/width in device sub-pixels */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    80
    FT_Pos  fit;  /* current/fitted position/width in device sub-pixels */
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
  } AF_WidthRec, *AF_Width;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    83
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    84
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    85
  FT_LOCAL( void )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    86
  af_sort_pos( FT_UInt  count,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    87
               FT_Pos*  table );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    88
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    89
  FT_LOCAL( void )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    90
  af_sort_widths( FT_UInt   count,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    91
                  AF_Width  widths );
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
  /*************************************************************************/
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
  /*****                   A N G L E   T Y P E S                       *****/
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
  /*************************************************************************/
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
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
   *  The auto-fitter doesn't need a very high angular accuracy;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   104
   *  this allows us to speed up some computations considerably with a
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   105
   *  light Cordic algorithm (see afangles.c).
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
  typedef FT_Int  AF_Angle;
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   111
#define AF_ANGLE_PI   256
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   112
#define AF_ANGLE_2PI  ( AF_ANGLE_PI * 2 )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   113
#define AF_ANGLE_PI2  ( AF_ANGLE_PI / 2 )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   114
#define AF_ANGLE_PI4  ( AF_ANGLE_PI / 4 )
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   117
#if 0
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
   *  compute the angle of a given 2-D vector
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   120
   */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   121
  FT_LOCAL( AF_Angle )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   122
  af_angle_atan( FT_Pos  dx,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   123
                 FT_Pos  dy );
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
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
   *  compute `angle2 - angle1'; the result is always within
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   128
   *  the range [-AF_ANGLE_PI .. AF_ANGLE_PI - 1]
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
  FT_LOCAL( AF_Angle )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   131
  af_angle_diff( AF_Angle  angle1,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   132
                 AF_Angle  angle2 );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   133
#endif /* 0 */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   134
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   135
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   136
#define AF_ANGLE_DIFF( result, angle1, angle2 ) \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   137
  FT_BEGIN_STMNT                                \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   138
    AF_Angle  _delta = (angle2) - (angle1);     \
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
                                                \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   141
    _delta %= AF_ANGLE_2PI;                     \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   142
    if ( _delta < 0 )                           \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   143
      _delta += AF_ANGLE_2PI;                   \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   144
                                                \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   145
    if ( _delta > AF_ANGLE_PI )                 \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   146
      _delta -= AF_ANGLE_2PI;                   \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   147
                                                \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   148
    result = _delta;                            \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   149
  FT_END_STMNT
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   150
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
  /*  opaque handle to glyph-specific hints -- see `afhints.h' for more
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   153
   *  details
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
  typedef struct AF_GlyphHintsRec_*  AF_GlyphHints;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   156
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   157
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   158
  /*************************************************************************/
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
  /*****                       S C A L E R S                           *****/
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
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   164
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   165
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   166
  /*
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   167
   *  A scaler models the target pixel device that will receive the
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   168
   *  auto-hinted glyph image.
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   171
  typedef enum  AF_ScalerFlags_
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   172
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   173
    AF_SCALER_FLAG_NO_HORIZONTAL = 1,  /* disable horizontal hinting */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   174
    AF_SCALER_FLAG_NO_VERTICAL   = 2,  /* disable vertical hinting   */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   175
    AF_SCALER_FLAG_NO_ADVANCE    = 4   /* disable advance hinting    */
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
  } AF_ScalerFlags;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   178
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
  typedef struct  AF_ScalerRec_
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   181
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   182
    FT_Face         face;        /* source font face                        */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   183
    FT_Fixed        x_scale;     /* from font units to 1/64th device pixels */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   184
    FT_Fixed        y_scale;     /* from font units to 1/64th device pixels */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   185
    FT_Pos          x_delta;     /* in 1/64th device pixels                 */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   186
    FT_Pos          y_delta;     /* in 1/64th device pixels                 */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   187
    FT_Render_Mode  render_mode; /* monochrome, anti-aliased, LCD, etc.     */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   188
    FT_UInt32       flags;       /* additional control flags, see above     */
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
  } AF_ScalerRec, *AF_Scaler;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   191
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   192
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   193
#define AF_SCALER_EQUAL_SCALES( a, b )      \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   194
          ( (a)->x_scale == (b)->x_scale && \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   195
            (a)->y_scale == (b)->y_scale && \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   196
            (a)->x_delta == (b)->x_delta && \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   197
            (a)->y_delta == (b)->y_delta )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   198
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   199
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
  /*****                       S C R I P T S                           *****/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   204
  /*****                                                               *****/
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
  /*************************************************************************/
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
  /*
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   209
   *  The list of known scripts.  Each different script corresponds to the
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   210
   *  following information:
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   211
   *
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   212
   *   - A set of Unicode ranges to test whether the face supports the
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   213
   *     script.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   214
   *
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   215
   *   - A specific global analyzer that will compute global metrics
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   216
   *     specific to the script.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   217
   *
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   218
   *   - A specific glyph analyzer that will compute segments and
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   219
   *     edges for each glyph covered by the script.
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
   *   - A specific grid-fitting algorithm that will distort the
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   222
   *     scaled glyph outline according to the results of the glyph
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   223
   *     analyzer.
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
   *  Note that a given analyzer and/or grid-fitting algorithm can be
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   226
   *  used by more than one script.
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   229
  typedef enum  AF_Script_
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_SCRIPT_NONE  = 0,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   232
    AF_SCRIPT_LATIN = 1,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   233
    AF_SCRIPT_CJK   = 2,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   234
    AF_SCRIPT_INDIC = 3, 
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   235
#ifdef FT_OPTION_AUTOFIT2
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   236
    AF_SCRIPT_LATIN2,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   237
#endif
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   238
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   239
    /* add new scripts here.  Don't forget to update the list in */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   240
    /* `afglobal.c'.                                             */
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_SCRIPT_MAX   /* do not remove */
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
  } AF_Script;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   245
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   246
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   247
  typedef struct AF_ScriptClassRec_ const*  AF_ScriptClass;
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
  typedef struct  AF_ScriptMetricsRec_
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   250
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   251
    AF_ScriptClass  clazz;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   252
    AF_ScalerRec    scaler;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   253
    FT_Bool         digits_have_same_width;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   254
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   255
  } AF_ScriptMetricsRec, *AF_ScriptMetrics;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   256
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   257
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   258
  /*  This function parses an FT_Face to compute global metrics for
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   259
   *  a specific script.
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
  typedef FT_Error
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   262
  (*AF_Script_InitMetricsFunc)( AF_ScriptMetrics  metrics,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   263
                                FT_Face           face );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   264
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   265
  typedef void
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   266
  (*AF_Script_ScaleMetricsFunc)( AF_ScriptMetrics  metrics,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   267
                                 AF_Scaler         scaler );
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
  typedef void
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   270
  (*AF_Script_DoneMetricsFunc)( AF_ScriptMetrics  metrics );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   271
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   272
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   273
  typedef FT_Error
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   274
  (*AF_Script_InitHintsFunc)( AF_GlyphHints     hints,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   275
                              AF_ScriptMetrics  metrics );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   276
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   277
  typedef void
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   278
  (*AF_Script_ApplyHintsFunc)( AF_GlyphHints     hints,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   279
                               FT_Outline*       outline,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   280
                               AF_ScriptMetrics  metrics );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   281
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   282
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   283
  typedef struct  AF_Script_UniRangeRec_
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
    FT_UInt32  first;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   286
    FT_UInt32  last;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   287
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   288
  } AF_Script_UniRangeRec;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   289
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   290
#define AF_UNIRANGE_REC( a, b ) { (FT_UInt32)(a), (FT_UInt32)(b) }
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 const AF_Script_UniRangeRec  *AF_Script_UniRange;
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   295
  typedef struct  AF_ScriptClassRec_
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   296
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   297
    AF_Script                   script;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   298
    AF_Script_UniRange          script_uni_ranges; /* last must be { 0, 0 } */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   299
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   300
    FT_Offset                   script_metrics_size;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   301
    AF_Script_InitMetricsFunc   script_metrics_init;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   302
    AF_Script_ScaleMetricsFunc  script_metrics_scale;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   303
    AF_Script_DoneMetricsFunc   script_metrics_done;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   304
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   305
    AF_Script_InitHintsFunc     script_hints_init;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   306
    AF_Script_ApplyHintsFunc    script_hints_apply;
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_ScriptClassRec;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   309
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
  /* Declare and define vtables for classes */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   312
#ifndef FT_CONFIG_OPTION_PIC
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
#define AF_DECLARE_SCRIPT_CLASS( script_class ) \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   315
  FT_CALLBACK_TABLE const AF_ScriptClassRec     \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   316
  script_class;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   317
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   318
#define AF_DEFINE_SCRIPT_CLASS( script_class, script_, ranges, m_size,     \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   319
                                m_init, m_scale, m_done, h_init, h_apply ) \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   320
  FT_CALLBACK_TABLE_DEF const AF_ScriptClassRec                            \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   321
  script_class =                                                           \
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
    script_,                                                               \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   324
    ranges,                                                                \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   325
                                                                           \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   326
    m_size,                                                                \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   327
                                                                           \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   328
    m_init,                                                                \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   329
    m_scale,                                                               \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   330
    m_done,                                                                \
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
    h_init,                                                                \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   333
    h_apply                                                                \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   334
  };
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
#else /* FT_CONFIG_OPTION_PIC */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   337
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   338
#define AF_DECLARE_SCRIPT_CLASS( script_class )          \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   339
  FT_LOCAL( void )                                       \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   340
  FT_Init_Class_##script_class( AF_ScriptClassRec* ac );
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
#define AF_DEFINE_SCRIPT_CLASS( script_class, script_, ranges, m_size,     \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   343
                                m_init, m_scale, m_done, h_init, h_apply ) \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   344
  FT_LOCAL_DEF( void )                                                     \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   345
  FT_Init_Class_##script_class( AF_ScriptClassRec* ac )                    \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   346
  {                                                                        \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   347
    ac->script               = script_;                                    \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   348
    ac->script_uni_ranges    = ranges;                                     \
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
    ac->script_metrics_size  = m_size;                                     \
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
    ac->script_metrics_init  = m_init;                                     \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   353
    ac->script_metrics_scale = m_scale;                                    \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   354
    ac->script_metrics_done  = m_done;                                     \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   355
                                                                           \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   356
    ac->script_hints_init    = h_init;                                     \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   357
    ac->script_hints_apply   = h_apply;                                    \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   358
  }
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
#endif /* FT_CONFIG_OPTION_PIC */
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
/* */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   364
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   365
FT_END_HEADER
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
#endif /* __AFTYPES_H__ */
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   370
/* END */