1 /****************************************************************************
2  *
3  * ttsubpix.h
4  *
5  *   TrueType Subpixel Hinting.
6  *
7  * Copyright (C) 2010-2020 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_SUPPORT_SUBPIXEL_HINTING_INFINALITY
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                   0x0000001UL
54 #define SPH_TWEAK_ALWAYS_DO_DELTAP                0x0000002UL
55 #define SPH_TWEAK_ALWAYS_SKIP_DELTAP              0x0000004UL
56 #define SPH_TWEAK_COURIER_NEW_2_HACK              0x0000008UL
57 #define SPH_TWEAK_DEEMBOLDEN                      0x0000010UL
58 #define SPH_TWEAK_DO_SHPIX                        0x0000020UL
59 #define SPH_TWEAK_EMBOLDEN                        0x0000040UL
60 #define SPH_TWEAK_MIAP_HACK                       0x0000080UL
61 #define SPH_TWEAK_NORMAL_ROUND                    0x0000100UL
62 #define SPH_TWEAK_NO_ALIGNRP_AFTER_IUP            0x0000200UL
63 #define SPH_TWEAK_NO_CALL_AFTER_IUP               0x0000400UL
64 #define SPH_TWEAK_NO_DELTAP_AFTER_IUP             0x0000800UL
65 #define SPH_TWEAK_PIXEL_HINTING                   0x0001000UL
66 #define SPH_TWEAK_RASTERIZER_35                   0x0002000UL
67 #define SPH_TWEAK_ROUND_NONPIXEL_Y_MOVES          0x0004000UL
68 #define SPH_TWEAK_SKIP_IUP                        0x0008000UL
69 #define SPH_TWEAK_SKIP_NONPIXEL_Y_MOVES           0x0010000UL
70 #define SPH_TWEAK_SKIP_OFFPIXEL_Y_MOVES           0x0020000UL
71 #define SPH_TWEAK_TIMES_NEW_ROMAN_HACK            0x0040000UL
72 #define SPH_TWEAK_SKIP_NONPIXEL_Y_MOVES_DELTAP    0x0080000UL
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_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
104 
105 
106 FT_END_HEADER
107 
108 #endif /* TTSUBPIX_H_ */
109 
110 
111 /* END */
112