1 /***************************************************************************/
2 /*                                                                         */
3 /*  ttsubpix.h                                                             */
4 /*                                                                         */
5 /*    TrueType Subpixel Hinting.                                           */
6 /*                                                                         */
7 /*  Copyright 2010-2013 by                                                 */
8 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
9 /*                                                                         */
10 /*  This file is part of the FreeType project, and may only be used,       */
11 /*  modified, and distributed under the terms of the FreeType project      */
12 /*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
13 /*  this file you indicate that you have read the license and              */
14 /*  understand and accept it fully.                                        */
15 /*                                                                         */
16 /***************************************************************************/
17 
18 
19 #ifndef __TTSUBPIX_H__
20 #define __TTSUBPIX_H__
21 
22 #include <ft2build.h>
23 #include "ttobjs.h"
24 #include "ttinterp.h"
25 
26 
27 FT_BEGIN_HEADER
28 
29 
30 #ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING
31 
32   /*************************************************************************/
33   /*                                                                       */
34   /* ID flags to identify special functions at FDEF and runtime.           */
35   /*                                                                       */
36   /*                                                                       */
37 #define SPH_FDEF_INLINE_DELTA_1       0x0000001
38 #define SPH_FDEF_INLINE_DELTA_2       0x0000002
39 #define SPH_FDEF_DIAGONAL_STROKE      0x0000004
40 #define SPH_FDEF_VACUFORM_ROUND_1     0x0000008
41 #define SPH_FDEF_TTFAUTOHINT_1        0x0000010
42 #define SPH_FDEF_SPACING_1            0x0000020
43 #define SPH_FDEF_SPACING_2            0x0000040
44 #define SPH_FDEF_TYPEMAN_STROKES      0x0000080
45 #define SPH_FDEF_TYPEMAN_DIAGENDCTRL  0x0000100
46 
47 
48   /*************************************************************************/
49   /*                                                                       */
50   /* Tweak flags that are set for each glyph by the below rules.           */
51   /*                                                                       */
52   /*                                                                       */
53 #define SPH_TWEAK_ALLOW_X_DMOVE                   0x0000001
54 #define SPH_TWEAK_ALWAYS_DO_DELTAP                0x0000002
55 #define SPH_TWEAK_ALWAYS_SKIP_DELTAP              0x0000004
56 #define SPH_TWEAK_COURIER_NEW_2_HACK              0x0000008
57 #define SPH_TWEAK_DEEMBOLDEN                      0x0000010
58 #define SPH_TWEAK_DO_SHPIX                        0x0000020
59 #define SPH_TWEAK_EMBOLDEN                        0x0000040
60 #define SPH_TWEAK_MIAP_HACK                       0x0000080
61 #define SPH_TWEAK_NORMAL_ROUND                    0x0000100
62 #define SPH_TWEAK_NO_ALIGNRP_AFTER_IUP            0x0000200
63 #define SPH_TWEAK_NO_CALL_AFTER_IUP               0x0000400
64 #define SPH_TWEAK_NO_DELTAP_AFTER_IUP             0x0000800
65 #define SPH_TWEAK_PIXEL_HINTING                   0x0001000
66 #define SPH_TWEAK_RASTERIZER_35                   0x0002000
67 #define SPH_TWEAK_ROUND_NONPIXEL_Y_MOVES          0x0004000
68 #define SPH_TWEAK_SKIP_IUP                        0x0008000
69 #define SPH_TWEAK_SKIP_NONPIXEL_Y_MOVES           0x0010000
70 #define SPH_TWEAK_SKIP_OFFPIXEL_Y_MOVES           0x0020000
71 #define SPH_TWEAK_TIMES_NEW_ROMAN_HACK            0x0040000
72 #define SPH_TWEAK_SKIP_NONPIXEL_Y_MOVES_DELTAP    0x0080000
73 
74 
75   FT_LOCAL( FT_Bool )
76   sph_test_tweak( TT_Face               face,
77                   const FT_String*      family,
78                   FT_UInt               ppem,
79                   const FT_String*      style,
80                   FT_UInt               glyph_index,
81                   const SPH_TweakRule*  rule,
82                   FT_UInt               num_rules );
83 
84   FT_LOCAL( FT_UInt )
85   sph_test_tweak_x_scaling( TT_Face           face,
86                             const FT_String*  family,
87                             FT_UInt           ppem,
88                             const FT_String*  style,
89                             FT_UInt           glyph_index );
90 
91   FT_LOCAL( void )
92   sph_set_tweaks( TT_Loader  loader,
93                   FT_UInt    glyph_index );
94 
95 
96   /* These macros are defined absent a method for setting them */
97 #define SPH_OPTION_BITMAP_WIDTHS           FALSE
98 #define SPH_OPTION_SET_SUBPIXEL            TRUE
99 #define SPH_OPTION_SET_GRAYSCALE           FALSE
100 #define SPH_OPTION_SET_COMPATIBLE_WIDTHS   FALSE
101 #define SPH_OPTION_SET_RASTERIZER_VERSION  38
102 
103 #endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */
104 
105 
106 FT_END_HEADER
107 
108 #endif /* __TTSUBPIX_H__ */
109 
110 /* END */
111