[EXPLORER] Fix the code that requests the taskbar to recalculate the size,
[reactos.git] / sdk / lib / 3rdparty / freetype / include / freetype / ftcffdrv.h
1 /***************************************************************************/
2 /* */
3 /* ftcffdrv.h */
4 /* */
5 /* FreeType API for controlling the CFF driver (specification only). */
6 /* */
7 /* Copyright 2013-2017 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 FTCFFDRV_H_
20 #define FTCFFDRV_H_
21
22 #include <ft2build.h>
23 #include FT_FREETYPE_H
24
25 #ifdef FREETYPE_H
26 #error "freetype.h of FreeType 1 has been loaded!"
27 #error "Please fix the directory search order for header files"
28 #error "so that freetype.h of FreeType 2 is found first."
29 #endif
30
31
32 FT_BEGIN_HEADER
33
34
35 /**************************************************************************
36 *
37 * @section:
38 * cff_driver
39 *
40 * @title:
41 * The CFF driver
42 *
43 * @abstract:
44 * Controlling the CFF driver module.
45 *
46 * @description:
47 * While FreeType's CFF driver doesn't expose API functions by itself,
48 * it is possible to control its behaviour with @FT_Property_Set and
49 * @FT_Property_Get. The list below gives the available properties
50 * together with the necessary macros and structures.
51 *
52 * The CFF driver's module name is `cff'.
53 *
54 * *Hinting* *and* *antialiasing* *principles* *of* *the* *new* *engine*
55 *
56 * The rasterizer is positioning horizontal features (e.g., ascender
57 * height & x-height, or crossbars) on the pixel grid and minimizing the
58 * amount of antialiasing applied to them, while placing vertical
59 * features (vertical stems) on the pixel grid without hinting, thus
60 * representing the stem position and weight accurately. Sometimes the
61 * vertical stems may be only partially black. In this context,
62 * `antialiasing' means that stems are not positioned exactly on pixel
63 * borders, causing a fuzzy appearance.
64 *
65 * There are two principles behind this approach.
66 *
67 * 1) No hinting in the horizontal direction: Unlike `superhinted'
68 * TrueType, which changes glyph widths to accommodate regular
69 * inter-glyph spacing, Adobe's approach is `faithful to the design' in
70 * representing both the glyph width and the inter-glyph spacing
71 * designed for the font. This makes the screen display as close as it
72 * can be to the result one would get with infinite resolution, while
73 * preserving what is considered the key characteristics of each glyph.
74 * Note that the distances between unhinted and grid-fitted positions at
75 * small sizes are comparable to kerning values and thus would be
76 * noticeable (and distracting) while reading if hinting were applied.
77 *
78 * One of the reasons to not hint horizontally is antialiasing for LCD
79 * screens: The pixel geometry of modern displays supplies three
80 * vertical sub-pixels as the eye moves horizontally across each visible
81 * pixel. On devices where we can be certain this characteristic is
82 * present a rasterizer can take advantage of the sub-pixels to add
83 * increments of weight. In Western writing systems this turns out to
84 * be the more critical direction anyway; the weights and spacing of
85 * vertical stems (see above) are central to Armenian, Cyrillic, Greek,
86 * and Latin type designs. Even when the rasterizer uses greyscale
87 * antialiasing instead of color (a necessary compromise when one
88 * doesn't know the screen characteristics), the unhinted vertical
89 * features preserve the design's weight and spacing much better than
90 * aliased type would.
91 *
92 * 2) Alignment in the vertical direction: Weights and spacing along the
93 * y~axis are less critical; what is much more important is the visual
94 * alignment of related features (like cap-height and x-height). The
95 * sense of alignment for these is enhanced by the sharpness of grid-fit
96 * edges, while the cruder vertical resolution (full pixels instead of
97 * 1/3 pixels) is less of a problem.
98 *
99 * On the technical side, horizontal alignment zones for ascender,
100 * x-height, and other important height values (traditionally called
101 * `blue zones') as defined in the font are positioned independently,
102 * each being rounded to the nearest pixel edge, taking care of
103 * overshoot suppression at small sizes, stem darkening, and scaling.
104 *
105 * Hstems (this is, hint values defined in the font to help align
106 * horizontal features) that fall within a blue zone are said to be
107 * `captured' and are aligned to that zone. Uncaptured stems are moved
108 * in one of four ways, top edge up or down, bottom edge up or down.
109 * Unless there are conflicting hstems, the smallest movement is taken
110 * to minimize distortion.
111 *
112 * @order:
113 * hinting-engine[cff]
114 * no-stem-darkening[cff]
115 * darkening-parameters[cff]
116 * random-seed
117 *
118 */
119
120
121 /**************************************************************************
122 *
123 * @property:
124 * hinting-engine[cff]
125 *
126 * @description:
127 * Thanks to Adobe, which contributed a new hinting (and parsing)
128 * engine, an application can select between `freetype' and `adobe' if
129 * compiled with CFF_CONFIG_OPTION_OLD_ENGINE. If this configuration
130 * macro isn't defined, `hinting-engine' does nothing.
131 *
132 * The default engine is `freetype' if CFF_CONFIG_OPTION_OLD_ENGINE is
133 * defined, and `adobe' otherwise.
134 *
135 * The following example code demonstrates how to select Adobe's hinting
136 * engine (omitting the error handling).
137 *
138 * {
139 * FT_Library library;
140 * FT_UInt hinting_engine = FT_CFF_HINTING_ADOBE;
141 *
142 *
143 * FT_Init_FreeType( &library );
144 *
145 * FT_Property_Set( library, "cff",
146 * "hinting-engine", &hinting_engine );
147 * }
148 *
149 * @note:
150 * This property can be used with @FT_Property_Get also.
151 *
152 * This property can be set via the `FREETYPE_PROPERTIES' environment
153 * variable (using values `adobe' or `freetype').
154 */
155
156
157 /**************************************************************************
158 *
159 * @enum:
160 * FT_CFF_HINTING_XXX
161 *
162 * @description:
163 * A list of constants used for the @hinting-engine[cff] property to
164 * select the hinting engine for CFF fonts.
165 *
166 * @values:
167 * FT_CFF_HINTING_FREETYPE ::
168 * Use the old FreeType hinting engine.
169 *
170 * FT_CFF_HINTING_ADOBE ::
171 * Use the hinting engine contributed by Adobe.
172 *
173 */
174 #define FT_CFF_HINTING_FREETYPE 0
175 #define FT_CFF_HINTING_ADOBE 1
176
177
178 /**************************************************************************
179 *
180 * @property:
181 * no-stem-darkening[cff]
182 *
183 * @description:
184 * By default, the Adobe CFF engine darkens stems at smaller sizes,
185 * regardless of hinting, to enhance contrast. This feature requires
186 * a rendering system with proper gamma correction. Setting this
187 * property, stem darkening gets switched off.
188 *
189 * Note that stem darkening is never applied if @FT_LOAD_NO_SCALE is set.
190 *
191 * {
192 * FT_Library library;
193 * FT_Bool no_stem_darkening = TRUE;
194 *
195 *
196 * FT_Init_FreeType( &library );
197 *
198 * FT_Property_Set( library, "cff",
199 * "no-stem-darkening", &no_stem_darkening );
200 * }
201 *
202 * @note:
203 * This property can be used with @FT_Property_Get also.
204 *
205 * This property can be set via the `FREETYPE_PROPERTIES' environment
206 * variable (using values 1 and 0 for `on' and `off', respectively).
207 * It can also be set per face using @FT_Face_Properties with
208 * @FT_PARAM_TAG_STEM_DARKENING.
209 *
210 */
211
212
213 /**************************************************************************
214 *
215 * @property:
216 * darkening-parameters[cff]
217 *
218 * @description:
219 * By default, the Adobe CFF engine darkens stems as follows (if the
220 * `no-stem-darkening' property isn't set):
221 *
222 * {
223 * stem width <= 0.5px: darkening amount = 0.4px
224 * stem width = 1px: darkening amount = 0.275px
225 * stem width = 1.667px: darkening amount = 0.275px
226 * stem width >= 2.333px: darkening amount = 0px
227 * }
228 *
229 * and piecewise linear in-between. At configuration time, these four
230 * control points can be set with the macro
231 * `CFF_CONFIG_OPTION_DARKENING_PARAMETERS'. At runtime, the control
232 * points can be changed using the `darkening-parameters' property, as
233 * the following example demonstrates.
234 *
235 * {
236 * FT_Library library;
237 * FT_Int darken_params[8] = { 500, 300, // x1, y1
238 * 1000, 200, // x2, y2
239 * 1500, 100, // x3, y3
240 * 2000, 0 }; // x4, y4
241 *
242 *
243 * FT_Init_FreeType( &library );
244 *
245 * FT_Property_Set( library, "cff",
246 * "darkening-parameters", darken_params );
247 * }
248 *
249 * The x~values give the stem width, and the y~values the darkening
250 * amount. The unit is 1000th of pixels. All coordinate values must be
251 * positive; the x~values must be monotonically increasing; the
252 * y~values must be monotonically decreasing and smaller than or
253 * equal to 500 (corresponding to half a pixel); the slope of each
254 * linear piece must be shallower than -1 (e.g., -.4).
255 *
256 * @note:
257 * This property can be used with @FT_Property_Get also.
258 *
259 * This property can be set via the `FREETYPE_PROPERTIES' environment
260 * variable, using eight comma-separated integers without spaces. Here
261 * the above example, using `\' to break the line for readability.
262 *
263 * {
264 * FREETYPE_PROPERTIES=\
265 * cff:darkening-parameters=500,300,1000,200,1500,100,2000,0
266 * }
267 */
268
269
270 /**************************************************************************
271 *
272 * @property:
273 * random-seed
274 *
275 * @description:
276 * By default, the seed value for the CFF `random' operator is set to a
277 * random value. However, mainly for debugging purposes, it is often
278 * necessary to use a known value as a seed so that the pseudo-random
279 * number sequences generated by `random' are repeatable.
280 *
281 * The `random-seed' property does that. Its argument is a signed 32bit
282 * integer; if the value is zero or negative, the seed given by the
283 * `intitialRandomSeed' private DICT operator in a CFF file gets used
284 * (or a default value if there is no such operator). If the value is
285 * positive, use it instead of `initialRandomSeed', which is
286 * consequently ignored.
287 *
288 * @note:
289 * This property can be set via the `FREETYPE_PROPERTIES' environment
290 * variable. It can also be set per face using @FT_Face_Properties with
291 * @FT_PARAM_TAG_RANDOM_SEED.
292 *
293 */
294
295
296 /**************************************************************************
297 *
298 * @constant:
299 * FT_PARAM_TAG_RANDOM_SEED
300 *
301 * @description:
302 * An @FT_Parameter tag to be used with @FT_Face_Properties. The
303 * corresponding 32bit signed integer argument overrides the CFF
304 * module's random seed value with a face-specific one; see
305 * @random-seed.
306 *
307 */
308 #define FT_PARAM_TAG_RANDOM_SEED \
309 FT_MAKE_TAG( 's', 'e', 'e', 'd' )
310
311
312 /* */
313
314
315 FT_END_HEADER
316
317
318 #endif /* FTCFFDRV_H_ */
319
320
321 /* END */