ReactOS  0.4.15-dev-506-ga3ec01c
psblues.h
Go to the documentation of this file.
1 /***************************************************************************/
2 /* */
3 /* psblues.h */
4 /* */
5 /* Adobe's code for handling Blue Zones (specification). */
6 /* */
7 /* Copyright 2009-2013 Adobe Systems Incorporated. */
8 /* */
9 /* This software, and all works of authorship, whether in source or */
10 /* object code form as indicated by the copyright notice(s) included */
11 /* herein (collectively, the "Work") is made available, and may only be */
12 /* used, modified, and distributed under the FreeType Project License, */
13 /* LICENSE.TXT. Additionally, subject to the terms and conditions of the */
14 /* FreeType Project License, each contributor to the Work hereby grants */
15 /* to any individual or legal entity exercising permissions granted by */
16 /* the FreeType Project License and this section (hereafter, "You" or */
17 /* "Your") a perpetual, worldwide, non-exclusive, no-charge, */
18 /* royalty-free, irrevocable (except as stated in this section) patent */
19 /* license to make, have made, use, offer to sell, sell, import, and */
20 /* otherwise transfer the Work, where such license applies only to those */
21 /* patent claims licensable by such contributor that are necessarily */
22 /* infringed by their contribution(s) alone or by combination of their */
23 /* contribution(s) with the Work to which such contribution(s) was */
24 /* submitted. If You institute patent litigation against any entity */
25 /* (including a cross-claim or counterclaim in a lawsuit) alleging that */
26 /* the Work or a contribution incorporated within the Work constitutes */
27 /* direct or contributory patent infringement, then any patent licenses */
28 /* granted to You under this License for that Work shall terminate as of */
29 /* the date such litigation is filed. */
30 /* */
31 /* By using, modifying, or distributing the Work you indicate that you */
32 /* have read and understood the terms and conditions of the */
33 /* FreeType Project License as well as those provided in this section, */
34 /* and you accept them fully. */
35 /* */
36 /***************************************************************************/
37 
38 
39  /*
40  * A `CF2_Blues' object stores the blue zones (horizontal alignment
41  * zones) of a font. These are specified in the CFF private dictionary
42  * by `BlueValues', `OtherBlues', `FamilyBlues', and `FamilyOtherBlues'.
43  * Each zone is defined by a top and bottom edge in character space.
44  * Further, each zone is either a top zone or a bottom zone, as recorded
45  * by `bottomZone'.
46  *
47  * The maximum number of `BlueValues' and `FamilyBlues' is 7 each.
48  * However, these are combined to produce a total of 7 zones.
49  * Similarly, the maximum number of `OtherBlues' and `FamilyOtherBlues'
50  * is 5 and these are combined to produce an additional 5 zones.
51  *
52  * Blue zones are used to `capture' hints and force them to a common
53  * alignment point. This alignment is recorded in device space in
54  * `dsFlatEdge'. Except for this value, a `CF2_Blues' object could be
55  * constructed independently of scaling. Construction may occur once
56  * the matrix is known. Other features implemented in the Capture
57  * method are overshoot suppression, overshoot enforcement, and Blue
58  * Boost.
59  *
60  * Capture is determined by `BlueValues' and `OtherBlues', but the
61  * alignment point may be adjusted to the scaled flat edge of
62  * `FamilyBlues' or `FamilyOtherBlues'. No alignment is done to the
63  * curved edge of a zone.
64  *
65  */
66 
67 
68 #ifndef PSBLUES_H_
69 #define PSBLUES_H_
70 
71 
72 #include "psglue.h"
73 
74 
76 
77 
78  /*
79  * `CF2_Hint' is shared by `cf2hints.h' and
80  * `cf2blues.h', but `cf2blues.h' depends on
81  * `cf2hints.h', so define it here. Note: The typedef is in
82  * `cf2glue.h'.
83  *
84  */
85  enum
86  {
87  CF2_GhostBottom = 0x1, /* a single bottom edge */
88  CF2_GhostTop = 0x2, /* a single top edge */
89  CF2_PairBottom = 0x4, /* the bottom edge of a stem hint */
90  CF2_PairTop = 0x8, /* the top edge of a stem hint */
91  CF2_Locked = 0x10, /* this edge has been aligned */
92  /* by a blue zone */
93  CF2_Synthetic = 0x20 /* this edge was synthesized */
94  };
95 
96 
97  /*
98  * Default value for OS/2 typoAscender/Descender when their difference
99  * is not equal to `unitsPerEm'. The default is based on -250 and 1100
100  * in `CF2_Blues', assuming 1000 units per em here.
101  *
102  */
103  enum
104  {
107  };
108 
109 
110  /*
111  * Constant used for hint adjustment and for synthetic em box hint
112  * placement.
113  */
114 #define CF2_MIN_COUNTER cf2_doubleToFixed( 0.5 )
115 
116 
117  /* shared typedef is in cf2glue.h */
119  {
120  CF2_UInt flags; /* attributes of the edge */
121  size_t index; /* index in original stem hint array */
122  /* (if not synthetic) */
126  };
127 
128 
129  typedef struct CF2_BlueRec_
130  {
133  CF2_Fixed csFlatEdge; /* may be from either local or Family zones */
134  CF2_Fixed dsFlatEdge; /* top edge of bottom zone or bottom edge */
135  /* of top zone (rounded) */
137 
138  } CF2_BlueRec;
139 
140 
141  /* max total blue zones is 12 */
142  enum
143  {
146  };
147 
148 
149  typedef struct CF2_BluesRec_
150  {
155 
159 
161 
164 
166 
168 
169 
170  FT_LOCAL( void )
171  cf2_blues_init( CF2_Blues blues,
172  CF2_Font font );
173  FT_LOCAL( FT_Bool )
174  cf2_blues_capture( const CF2_Blues blues,
175  CF2_Hint bottomHintEdge,
176  CF2_Hint topHintEdge );
177 
178 
180 
181 
182 #endif /* PSBLUES_H_ */
183 
184 
185 /* END */
#define CF2_UInt
Definition: pstypes.h:64
CF2_HintRec emBoxBottomEdge
Definition: psblues.h:163
CF2_UInt count
Definition: psblues.h:152
struct CF2_BlueRec_ CF2_BlueRec
#define FT_END_HEADER
Definition: ftheader.h:54
Definition: mk_font.cpp:20
CF2_Fixed scale
Definition: psblues.h:151
#define cf2_intToFixed(i)
Definition: psfixed.h:60
CF2_Fixed scale
Definition: psblues.h:125
CF2_Fixed csTopEdge
Definition: psblues.h:132
CF2_Fixed csBottomEdge
Definition: psblues.h:131
CF2_Fixed dsCoord
Definition: psblues.h:124
FT_BEGIN_HEADER typedef unsigned char FT_Bool
Definition: fttypes.h:108
#define FT_BEGIN_HEADER
Definition: ftheader.h:36
#define FT_LOCAL(x)
Definition: ftconfig.h:387
CF2_Fixed boost
Definition: psblues.h:160
cf2_blues_capture(const CF2_Blues blues, CF2_Hint bottomHintEdge, CF2_Hint topHintEdge)
Definition: psblues.c:465
FT_Bool suppressOvershoot
Definition: psblues.h:153
FT_Bool doEmBoxHints
Definition: psblues.h:154
CF2_Fixed csFlatEdge
Definition: psblues.h:133
CF2_Fixed blueScale
Definition: psblues.h:156
CF2_UInt flags
Definition: psblues.h:120
FT_Bool bottomZone
Definition: psblues.h:136
CF2_BlueRec zone[CF2_MAX_BLUES+CF2_MAX_OTHERBLUES]
Definition: psblues.h:165
struct CF2_BluesRec_ CF2_BluesRec
CF2_HintRec emBoxTopEdge
Definition: psblues.h:162
CF2_Fixed csCoord
Definition: psblues.h:123
CF2_Fixed blueFuzz
Definition: psblues.h:158
size_t index
Definition: psblues.h:121
CF2_Fixed blueShift
Definition: psblues.h:157
CF2_Fixed dsFlatEdge
Definition: psblues.h:134
struct CF2_BluesRec_ * CF2_Blues
cf2_blues_init(CF2_Blues blues, CF2_Font font)
Definition: psblues.c:66
#define CF2_Fixed
Definition: psfixed.h:48