ReactOS 0.4.15-dev-8344-g0574987
freetype.h
Go to the documentation of this file.
1/***************************************************************************/
2/* */
3/* freetype.h */
4/* */
5/* FreeType high-level API and common types (specification only). */
6/* */
7/* Copyright 1996-2018 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 FREETYPE_H_
20#define FREETYPE_H_
21
22
23#ifndef FT_FREETYPE_H
24#error "`ft2build.h' hasn't been included yet!"
25#error "Please always use macros to include FreeType header files."
26#error "Example:"
27#error " #include <ft2build.h>"
28#error " #include FT_FREETYPE_H"
29#endif
30
31
32#include <ft2build.h>
33#include FT_CONFIG_CONFIG_H
34#include FT_TYPES_H
35#include FT_ERRORS_H
36
37
39
40
41
42 /*************************************************************************/
43 /* */
44 /* <Section> */
45 /* header_inclusion */
46 /* */
47 /* <Title> */
48 /* FreeType's header inclusion scheme */
49 /* */
50 /* <Abstract> */
51 /* How client applications should include FreeType header files. */
52 /* */
53 /* <Description> */
54 /* To be as flexible as possible (and for historical reasons), */
55 /* FreeType uses a very special inclusion scheme to load header */
56 /* files, for example */
57 /* */
58 /* { */
59 /* #include <ft2build.h> */
60 /* */
61 /* #include FT_FREETYPE_H */
62 /* #include FT_OUTLINE_H */
63 /* } */
64 /* */
65 /* A compiler and its preprocessor only needs an include path to find */
66 /* the file `ft2build.h'; the exact locations and names of the other */
67 /* FreeType header files are hidden by preprocessor macro names, */
68 /* loaded by `ft2build.h'. The API documentation always gives the */
69 /* header macro name needed for a particular function. */
70 /* */
71 /*************************************************************************/
72
73
74 /*************************************************************************/
75 /* */
76 /* <Section> */
77 /* user_allocation */
78 /* */
79 /* <Title> */
80 /* User allocation */
81 /* */
82 /* <Abstract> */
83 /* How client applications should allocate FreeType data structures. */
84 /* */
85 /* <Description> */
86 /* FreeType assumes that structures allocated by the user and passed */
87 /* as arguments are zeroed out except for the actual data. In other */
88 /* words, it is recommended to use `calloc' (or variants of it) */
89 /* instead of `malloc' for allocation. */
90 /* */
91 /*************************************************************************/
92
93
94
95 /*************************************************************************/
96 /*************************************************************************/
97 /* */
98 /* B A S I C T Y P E S */
99 /* */
100 /*************************************************************************/
101 /*************************************************************************/
102
103
104 /*************************************************************************/
105 /* */
106 /* <Section> */
107 /* base_interface */
108 /* */
109 /* <Title> */
110 /* Base Interface */
111 /* */
112 /* <Abstract> */
113 /* The FreeType~2 base font interface. */
114 /* */
115 /* <Description> */
116 /* This section describes the most important public high-level API */
117 /* functions of FreeType~2. */
118 /* */
119 /* <Order> */
120 /* FT_Library */
121 /* FT_Face */
122 /* FT_Size */
123 /* FT_GlyphSlot */
124 /* FT_CharMap */
125 /* FT_Encoding */
126 /* FT_ENC_TAG */
127 /* */
128 /* FT_FaceRec */
129 /* */
130 /* FT_FACE_FLAG_SCALABLE */
131 /* FT_FACE_FLAG_FIXED_SIZES */
132 /* FT_FACE_FLAG_FIXED_WIDTH */
133 /* FT_FACE_FLAG_HORIZONTAL */
134 /* FT_FACE_FLAG_VERTICAL */
135 /* FT_FACE_FLAG_COLOR */
136 /* FT_FACE_FLAG_SFNT */
137 /* FT_FACE_FLAG_CID_KEYED */
138 /* FT_FACE_FLAG_TRICKY */
139 /* FT_FACE_FLAG_KERNING */
140 /* FT_FACE_FLAG_MULTIPLE_MASTERS */
141 /* FT_FACE_FLAG_VARIATION */
142 /* FT_FACE_FLAG_GLYPH_NAMES */
143 /* FT_FACE_FLAG_EXTERNAL_STREAM */
144 /* FT_FACE_FLAG_HINTER */
145 /* */
146 /* FT_HAS_HORIZONTAL */
147 /* FT_HAS_VERTICAL */
148 /* FT_HAS_KERNING */
149 /* FT_HAS_FIXED_SIZES */
150 /* FT_HAS_GLYPH_NAMES */
151 /* FT_HAS_COLOR */
152 /* FT_HAS_MULTIPLE_MASTERS */
153 /* */
154 /* FT_IS_SFNT */
155 /* FT_IS_SCALABLE */
156 /* FT_IS_FIXED_WIDTH */
157 /* FT_IS_CID_KEYED */
158 /* FT_IS_TRICKY */
159 /* FT_IS_NAMED_INSTANCE */
160 /* FT_IS_VARIATION */
161 /* */
162 /* FT_STYLE_FLAG_BOLD */
163 /* FT_STYLE_FLAG_ITALIC */
164 /* */
165 /* FT_SizeRec */
166 /* FT_Size_Metrics */
167 /* */
168 /* FT_GlyphSlotRec */
169 /* FT_Glyph_Metrics */
170 /* FT_SubGlyph */
171 /* */
172 /* FT_Bitmap_Size */
173 /* */
174 /* FT_Init_FreeType */
175 /* FT_Done_FreeType */
176 /* */
177 /* FT_New_Face */
178 /* FT_Done_Face */
179 /* FT_Reference_Face */
180 /* FT_New_Memory_Face */
181 /* FT_Face_Properties */
182 /* FT_Open_Face */
183 /* FT_Open_Args */
184 /* FT_Parameter */
185 /* FT_Attach_File */
186 /* FT_Attach_Stream */
187 /* */
188 /* FT_Set_Char_Size */
189 /* FT_Set_Pixel_Sizes */
190 /* FT_Request_Size */
191 /* FT_Select_Size */
192 /* FT_Size_Request_Type */
193 /* FT_Size_RequestRec */
194 /* FT_Size_Request */
195 /* FT_Set_Transform */
196 /* FT_Load_Glyph */
197 /* FT_Get_Char_Index */
198 /* FT_Get_First_Char */
199 /* FT_Get_Next_Char */
200 /* FT_Get_Name_Index */
201 /* FT_Load_Char */
202 /* */
203 /* FT_OPEN_MEMORY */
204 /* FT_OPEN_STREAM */
205 /* FT_OPEN_PATHNAME */
206 /* FT_OPEN_DRIVER */
207 /* FT_OPEN_PARAMS */
208 /* */
209 /* FT_LOAD_DEFAULT */
210 /* FT_LOAD_RENDER */
211 /* FT_LOAD_MONOCHROME */
212 /* FT_LOAD_LINEAR_DESIGN */
213 /* FT_LOAD_NO_SCALE */
214 /* FT_LOAD_NO_HINTING */
215 /* FT_LOAD_NO_BITMAP */
216 /* FT_LOAD_NO_AUTOHINT */
217 /* FT_LOAD_COLOR */
218 /* */
219 /* FT_LOAD_VERTICAL_LAYOUT */
220 /* FT_LOAD_IGNORE_TRANSFORM */
221 /* FT_LOAD_FORCE_AUTOHINT */
222 /* FT_LOAD_NO_RECURSE */
223 /* FT_LOAD_PEDANTIC */
224 /* */
225 /* FT_LOAD_TARGET_NORMAL */
226 /* FT_LOAD_TARGET_LIGHT */
227 /* FT_LOAD_TARGET_MONO */
228 /* FT_LOAD_TARGET_LCD */
229 /* FT_LOAD_TARGET_LCD_V */
230 /* */
231 /* FT_LOAD_TARGET_MODE */
232 /* */
233 /* FT_Render_Glyph */
234 /* FT_Render_Mode */
235 /* FT_Get_Kerning */
236 /* FT_Kerning_Mode */
237 /* FT_Get_Track_Kerning */
238 /* FT_Get_Glyph_Name */
239 /* FT_Get_Postscript_Name */
240 /* */
241 /* FT_CharMapRec */
242 /* FT_Select_Charmap */
243 /* FT_Set_Charmap */
244 /* FT_Get_Charmap_Index */
245 /* */
246 /* FT_Get_FSType_Flags */
247 /* FT_Get_SubGlyph_Info */
248 /* */
249 /* FT_Face_Internal */
250 /* FT_Size_Internal */
251 /* FT_Slot_Internal */
252 /* */
253 /* FT_FACE_FLAG_XXX */
254 /* FT_STYLE_FLAG_XXX */
255 /* FT_OPEN_XXX */
256 /* FT_LOAD_XXX */
257 /* FT_LOAD_TARGET_XXX */
258 /* FT_SUBGLYPH_FLAG_XXX */
259 /* FT_FSTYPE_XXX */
260 /* */
261 /* FT_HAS_FAST_GLYPHS */
262 /* */
263 /*************************************************************************/
264
265
266 /*************************************************************************/
267 /* */
268 /* <Struct> */
269 /* FT_Glyph_Metrics */
270 /* */
271 /* <Description> */
272 /* A structure to model the metrics of a single glyph. The values */
273 /* are expressed in 26.6 fractional pixel format; if the flag */
274 /* @FT_LOAD_NO_SCALE has been used while loading the glyph, values */
275 /* are expressed in font units instead. */
276 /* */
277 /* <Fields> */
278 /* width :: */
279 /* The glyph's width. */
280 /* */
281 /* height :: */
282 /* The glyph's height. */
283 /* */
284 /* horiBearingX :: */
285 /* Left side bearing for horizontal layout. */
286 /* */
287 /* horiBearingY :: */
288 /* Top side bearing for horizontal layout. */
289 /* */
290 /* horiAdvance :: */
291 /* Advance width for horizontal layout. */
292 /* */
293 /* vertBearingX :: */
294 /* Left side bearing for vertical layout. */
295 /* */
296 /* vertBearingY :: */
297 /* Top side bearing for vertical layout. Larger positive values */
298 /* mean further below the vertical glyph origin. */
299 /* */
300 /* vertAdvance :: */
301 /* Advance height for vertical layout. Positive values mean the */
302 /* glyph has a positive advance downward. */
303 /* */
304 /* <Note> */
305 /* If not disabled with @FT_LOAD_NO_HINTING, the values represent */
306 /* dimensions of the hinted glyph (in case hinting is applicable). */
307 /* */
308 /* Stroking a glyph with an outside border does not increase */
309 /* `horiAdvance' or `vertAdvance'; you have to manually adjust these */
310 /* values to account for the added width and height. */
311 /* */
312 /* FreeType doesn't use the `VORG' table data for CFF fonts because */
313 /* it doesn't have an interface to quickly retrieve the glyph height. */
314 /* The y~coordinate of the vertical origin can be simply computed as */
315 /* `vertBearingY + height' after loading a glyph. */
316 /* */
317 typedef struct FT_Glyph_Metrics_
318 {
321
325
329
331
332
333 /*************************************************************************/
334 /* */
335 /* <Struct> */
336 /* FT_Bitmap_Size */
337 /* */
338 /* <Description> */
339 /* This structure models the metrics of a bitmap strike (i.e., a set */
340 /* of glyphs for a given point size and resolution) in a bitmap font. */
341 /* It is used for the `available_sizes' field of @FT_Face. */
342 /* */
343 /* <Fields> */
344 /* height :: The vertical distance, in pixels, between two */
345 /* consecutive baselines. It is always positive. */
346 /* */
347 /* width :: The average width, in pixels, of all glyphs in the */
348 /* strike. */
349 /* */
350 /* size :: The nominal size of the strike in 26.6 fractional */
351 /* points. This field is not very useful. */
352 /* */
353 /* x_ppem :: The horizontal ppem (nominal width) in 26.6 fractional */
354 /* pixels. */
355 /* */
356 /* y_ppem :: The vertical ppem (nominal height) in 26.6 fractional */
357 /* pixels. */
358 /* */
359 /* <Note> */
360 /* Windows FNT: */
361 /* The nominal size given in a FNT font is not reliable. If the */
362 /* driver finds it incorrect, it sets `size' to some calculated */
363 /* values, and `x_ppem' and `y_ppem' to the pixel width and height */
364 /* given in the font, respectively. */
365 /* */
366 /* TrueType embedded bitmaps: */
367 /* `size', `width', and `height' values are not contained in the */
368 /* bitmap strike itself. They are computed from the global font */
369 /* parameters. */
370 /* */
371 typedef struct FT_Bitmap_Size_
372 {
375
377
380
382
383
384 /*************************************************************************/
385 /*************************************************************************/
386 /* */
387 /* O B J E C T C L A S S E S */
388 /* */
389 /*************************************************************************/
390 /*************************************************************************/
391
392 /*************************************************************************/
393 /* */
394 /* <Type> */
395 /* FT_Library */
396 /* */
397 /* <Description> */
398 /* A handle to a FreeType library instance. Each `library' is */
399 /* completely independent from the others; it is the `root' of a set */
400 /* of objects like fonts, faces, sizes, etc. */
401 /* */
402 /* It also embeds a memory manager (see @FT_Memory), as well as a */
403 /* scan-line converter object (see @FT_Raster). */
404 /* */
405 /* In multi-threaded applications it is easiest to use one */
406 /* `FT_Library' object per thread. In case this is too cumbersome, */
407 /* a single `FT_Library' object across threads is possible also */
408 /* (since FreeType version 2.5.6), as long as a mutex lock is used */
409 /* around @FT_New_Face and @FT_Done_Face. */
410 /* */
411 /* <Note> */
412 /* Library objects are normally created by @FT_Init_FreeType, and */
413 /* destroyed with @FT_Done_FreeType. If you need reference-counting */
414 /* (cf. @FT_Reference_Library), use @FT_New_Library and */
415 /* @FT_Done_Library. */
416 /* */
417 typedef struct FT_LibraryRec_ *FT_Library;
418
419
420 /*************************************************************************/
421 /* */
422 /* <Section> */
423 /* module_management */
424 /* */
425 /*************************************************************************/
426
427 /*************************************************************************/
428 /* */
429 /* <Type> */
430 /* FT_Module */
431 /* */
432 /* <Description> */
433 /* A handle to a given FreeType module object. A module can be a */
434 /* font driver, a renderer, or anything else that provides services */
435 /* to the former. */
436 /* */
437 typedef struct FT_ModuleRec_* FT_Module;
438
439
440 /*************************************************************************/
441 /* */
442 /* <Type> */
443 /* FT_Driver */
444 /* */
445 /* <Description> */
446 /* A handle to a given FreeType font driver object. A font driver */
447 /* is a module capable of creating faces from font files. */
448 /* */
449 typedef struct FT_DriverRec_* FT_Driver;
450
451
452 /*************************************************************************/
453 /* */
454 /* <Type> */
455 /* FT_Renderer */
456 /* */
457 /* <Description> */
458 /* A handle to a given FreeType renderer. A renderer is a module in */
459 /* charge of converting a glyph's outline image to a bitmap. It */
460 /* supports a single glyph image format, and one or more target */
461 /* surface depths. */
462 /* */
464
465
466 /*************************************************************************/
467 /* */
468 /* <Section> */
469 /* base_interface */
470 /* */
471 /*************************************************************************/
472
473 /*************************************************************************/
474 /* */
475 /* <Type> */
476 /* FT_Face */
477 /* */
478 /* <Description> */
479 /* A handle to a typographic face object. A face object models a */
480 /* given typeface, in a given style. */
481 /* */
482 /* <Note> */
483 /* A face object also owns a single @FT_GlyphSlot object, as well */
484 /* as one or more @FT_Size objects. */
485 /* */
486 /* Use @FT_New_Face or @FT_Open_Face to create a new face object from */
487 /* a given filepath or a custom input stream. */
488 /* */
489 /* Use @FT_Done_Face to destroy it (along with its slot and sizes). */
490 /* */
491 /* An `FT_Face' object can only be safely used from one thread at a */
492 /* time. Similarly, creation and destruction of `FT_Face' with the */
493 /* same @FT_Library object can only be done from one thread at a */
494 /* time. On the other hand, functions like @FT_Load_Glyph and its */
495 /* siblings are thread-safe and do not need the lock to be held as */
496 /* long as the same `FT_Face' object is not used from multiple */
497 /* threads at the same time. */
498 /* */
499 /* <Also> */
500 /* See @FT_FaceRec for the publicly accessible fields of a given face */
501 /* object. */
502 /* */
503 typedef struct FT_FaceRec_* FT_Face;
504
505
506 /*************************************************************************/
507 /* */
508 /* <Type> */
509 /* FT_Size */
510 /* */
511 /* <Description> */
512 /* A handle to an object that models a face scaled to a given */
513 /* character size. */
514 /* */
515 /* <Note> */
516 /* An @FT_Face has one _active_ @FT_Size object that is used by */
517 /* functions like @FT_Load_Glyph to determine the scaling */
518 /* transformation that in turn is used to load and hint glyphs and */
519 /* metrics. */
520 /* */
521 /* You can use @FT_Set_Char_Size, @FT_Set_Pixel_Sizes, */
522 /* @FT_Request_Size or even @FT_Select_Size to change the content */
523 /* (i.e., the scaling values) of the active @FT_Size. */
524 /* */
525 /* You can use @FT_New_Size to create additional size objects for a */
526 /* given @FT_Face, but they won't be used by other functions until */
527 /* you activate it through @FT_Activate_Size. Only one size can be */
528 /* activated at any given time per face. */
529 /* */
530 /* <Also> */
531 /* See @FT_SizeRec for the publicly accessible fields of a given size */
532 /* object. */
533 /* */
534 typedef struct FT_SizeRec_* FT_Size;
535
536
537 /*************************************************************************/
538 /* */
539 /* <Type> */
540 /* FT_GlyphSlot */
541 /* */
542 /* <Description> */
543 /* A handle to a given `glyph slot'. A slot is a container that can */
544 /* hold any of the glyphs contained in its parent face. */
545 /* */
546 /* In other words, each time you call @FT_Load_Glyph or */
547 /* @FT_Load_Char, the slot's content is erased by the new glyph data, */
548 /* i.e., the glyph's metrics, its image (bitmap or outline), and */
549 /* other control information. */
550 /* */
551 /* <Also> */
552 /* See @FT_GlyphSlotRec for the publicly accessible glyph fields. */
553 /* */
555
556
557 /*************************************************************************/
558 /* */
559 /* <Type> */
560 /* FT_CharMap */
561 /* */
562 /* <Description> */
563 /* A handle to a character map (usually abbreviated to `charmap'). A */
564 /* charmap is used to translate character codes in a given encoding */
565 /* into glyph indexes for its parent's face. Some font formats may */
566 /* provide several charmaps per font. */
567 /* */
568 /* Each face object owns zero or more charmaps, but only one of them */
569 /* can be `active', providing the data used by @FT_Get_Char_Index or */
570 /* @FT_Load_Char. */
571 /* */
572 /* The list of available charmaps in a face is available through the */
573 /* `face->num_charmaps' and `face->charmaps' fields of @FT_FaceRec. */
574 /* */
575 /* The currently active charmap is available as `face->charmap'. */
576 /* You should call @FT_Set_Charmap to change it. */
577 /* */
578 /* <Note> */
579 /* When a new face is created (either through @FT_New_Face or */
580 /* @FT_Open_Face), the library looks for a Unicode charmap within */
581 /* the list and automatically activates it. If there is no Unicode */
582 /* charmap, FreeType doesn't set an `active' charmap. */
583 /* */
584 /* <Also> */
585 /* See @FT_CharMapRec for the publicly accessible fields of a given */
586 /* character map. */
587 /* */
588 typedef struct FT_CharMapRec_* FT_CharMap;
589
590
591 /*************************************************************************/
592 /* */
593 /* <Macro> */
594 /* FT_ENC_TAG */
595 /* */
596 /* <Description> */
597 /* This macro converts four-letter tags into an unsigned long. It is */
598 /* used to define `encoding' identifiers (see @FT_Encoding). */
599 /* */
600 /* <Note> */
601 /* Since many 16-bit compilers don't like 32-bit enumerations, you */
602 /* should redefine this macro in case of problems to something like */
603 /* this: */
604 /* */
605 /* { */
606 /* #define FT_ENC_TAG( value, a, b, c, d ) value */
607 /* } */
608 /* */
609 /* to get a simple enumeration without assigning special numbers. */
610 /* */
611
612#ifndef FT_ENC_TAG
613#define FT_ENC_TAG( value, a, b, c, d ) \
614 value = ( ( (FT_UInt32)(a) << 24 ) | \
615 ( (FT_UInt32)(b) << 16 ) | \
616 ( (FT_UInt32)(c) << 8 ) | \
617 (FT_UInt32)(d) )
618
619#endif /* FT_ENC_TAG */
620
621
622 /*************************************************************************/
623 /* */
624 /* <Enum> */
625 /* FT_Encoding */
626 /* */
627 /* <Description> */
628 /* An enumeration to specify character sets supported by charmaps. */
629 /* Used in the @FT_Select_Charmap API function. */
630 /* */
631 /* <Note> */
632 /* Despite the name, this enumeration lists specific character */
633 /* repertories (i.e., charsets), and not text encoding methods (e.g., */
634 /* UTF-8, UTF-16, etc.). */
635 /* */
636 /* Other encodings might be defined in the future. */
637 /* */
638 /* <Values> */
639 /* FT_ENCODING_NONE :: */
640 /* The encoding value~0 is reserved. */
641 /* */
642 /* FT_ENCODING_UNICODE :: */
643 /* The Unicode character set. This value covers all versions of */
644 /* the Unicode repertoire, including ASCII and Latin-1. Most fonts */
645 /* include a Unicode charmap, but not all of them. */
646 /* */
647 /* For example, if you want to access Unicode value U+1F028 (and */
648 /* the font contains it), use value 0x1F028 as the input value for */
649 /* @FT_Get_Char_Index. */
650 /* */
651 /* FT_ENCODING_MS_SYMBOL :: */
652 /* Microsoft Symbol encoding, used to encode mathematical symbols */
653 /* and wingdings. For more information, see */
654 /* `https://www.microsoft.com/typography/otspec/recom.htm', */
655 /* `http://www.kostis.net/charsets/symbol.htm', and */
656 /* `http://www.kostis.net/charsets/wingding.htm'. */
657 /* */
658 /* This encoding uses character codes from the PUA (Private Unicode */
659 /* Area) in the range U+F020-U+F0FF. */
660 /* */
661 /* FT_ENCODING_SJIS :: */
662 /* Shift JIS encoding for Japanese. More info at */
663 /* `https://en.wikipedia.org/wiki/Shift_JIS'. See note on */
664 /* multi-byte encodings below. */
665 /* */
666 /* FT_ENCODING_PRC :: */
667 /* Corresponds to encoding systems mainly for Simplified Chinese as */
668 /* used in People's Republic of China (PRC). The encoding layout */
669 /* is based on GB~2312 and its supersets GBK and GB~18030. */
670 /* */
671 /* FT_ENCODING_BIG5 :: */
672 /* Corresponds to an encoding system for Traditional Chinese as */
673 /* used in Taiwan and Hong Kong. */
674 /* */
675 /* FT_ENCODING_WANSUNG :: */
676 /* Corresponds to the Korean encoding system known as Extended */
677 /* Wansung (MS Windows code page 949). */
678 /* For more information see */
679 /* `https://www.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WindowsBestFit/bestfit949.txt'. */
680 /* */
681 /* FT_ENCODING_JOHAB :: */
682 /* The Korean standard character set (KS~C 5601-1992), which */
683 /* corresponds to MS Windows code page 1361. This character set */
684 /* includes all possible Hangul character combinations. */
685 /* */
686 /* FT_ENCODING_ADOBE_LATIN_1 :: */
687 /* Corresponds to a Latin-1 encoding as defined in a Type~1 */
688 /* PostScript font. It is limited to 256 character codes. */
689 /* */
690 /* FT_ENCODING_ADOBE_STANDARD :: */
691 /* Adobe Standard encoding, as found in Type~1, CFF, and */
692 /* OpenType/CFF fonts. It is limited to 256 character codes. */
693 /* */
694 /* FT_ENCODING_ADOBE_EXPERT :: */
695 /* Adobe Expert encoding, as found in Type~1, CFF, and OpenType/CFF */
696 /* fonts. It is limited to 256 character codes. */
697 /* */
698 /* FT_ENCODING_ADOBE_CUSTOM :: */
699 /* Corresponds to a custom encoding, as found in Type~1, CFF, and */
700 /* OpenType/CFF fonts. It is limited to 256 character codes. */
701 /* */
702 /* FT_ENCODING_APPLE_ROMAN :: */
703 /* Apple roman encoding. Many TrueType and OpenType fonts contain */
704 /* a charmap for this 8-bit encoding, since older versions of Mac */
705 /* OS are able to use it. */
706 /* */
707 /* FT_ENCODING_OLD_LATIN_2 :: */
708 /* This value is deprecated and was neither used nor reported by */
709 /* FreeType. Don't use or test for it. */
710 /* */
711 /* FT_ENCODING_MS_SJIS :: */
712 /* Same as FT_ENCODING_SJIS. Deprecated. */
713 /* */
714 /* FT_ENCODING_MS_GB2312 :: */
715 /* Same as FT_ENCODING_PRC. Deprecated. */
716 /* */
717 /* FT_ENCODING_MS_BIG5 :: */
718 /* Same as FT_ENCODING_BIG5. Deprecated. */
719 /* */
720 /* FT_ENCODING_MS_WANSUNG :: */
721 /* Same as FT_ENCODING_WANSUNG. Deprecated. */
722 /* */
723 /* FT_ENCODING_MS_JOHAB :: */
724 /* Same as FT_ENCODING_JOHAB. Deprecated. */
725 /* */
726 /* <Note> */
727 /* By default, FreeType automatically synthesizes a Unicode charmap */
728 /* for PostScript fonts, using their glyph name dictionaries. */
729 /* However, it also reports the encodings defined explicitly in the */
730 /* font file, for the cases when they are needed, with the Adobe */
731 /* values as well. */
732 /* */
733 /* FT_ENCODING_NONE is set by the BDF and PCF drivers if the charmap */
734 /* is neither Unicode nor ISO-8859-1 (otherwise it is set to */
735 /* FT_ENCODING_UNICODE). Use @FT_Get_BDF_Charset_ID to find out */
736 /* which encoding is really present. If, for example, the */
737 /* `cs_registry' field is `KOI8' and the `cs_encoding' field is `R', */
738 /* the font is encoded in KOI8-R. */
739 /* */
740 /* FT_ENCODING_NONE is always set (with a single exception) by the */
741 /* winfonts driver. Use @FT_Get_WinFNT_Header and examine the */
742 /* `charset' field of the @FT_WinFNT_HeaderRec structure to find out */
743 /* which encoding is really present. For example, */
744 /* @FT_WinFNT_ID_CP1251 (204) means Windows code page 1251 (for */
745 /* Russian). */
746 /* */
747 /* FT_ENCODING_NONE is set if `platform_id' is @TT_PLATFORM_MACINTOSH */
748 /* and `encoding_id' is not `TT_MAC_ID_ROMAN' (otherwise it is set to */
749 /* FT_ENCODING_APPLE_ROMAN). */
750 /* */
751 /* If `platform_id' is @TT_PLATFORM_MACINTOSH, use the function */
752 /* @FT_Get_CMap_Language_ID to query the Mac language ID that may */
753 /* be needed to be able to distinguish Apple encoding variants. See */
754 /* */
755 /* https://www.unicode.org/Public/MAPPINGS/VENDORS/APPLE/Readme.txt */
756 /* */
757 /* to get an idea how to do that. Basically, if the language ID */
758 /* is~0, don't use it, otherwise subtract 1 from the language ID. */
759 /* Then examine `encoding_id'. If, for example, `encoding_id' is */
760 /* `TT_MAC_ID_ROMAN' and the language ID (minus~1) is */
761 /* `TT_MAC_LANGID_GREEK', it is the Greek encoding, not Roman. */
762 /* `TT_MAC_ID_ARABIC' with `TT_MAC_LANGID_FARSI' means the Farsi */
763 /* variant the Arabic encoding. */
764 /* */
765 typedef enum FT_Encoding_
766 {
767 FT_ENC_TAG( FT_ENCODING_NONE, 0, 0, 0, 0 ),
768
769 FT_ENC_TAG( FT_ENCODING_MS_SYMBOL, 's', 'y', 'm', 'b' ),
770 FT_ENC_TAG( FT_ENCODING_UNICODE, 'u', 'n', 'i', 'c' ),
771
772 FT_ENC_TAG( FT_ENCODING_SJIS, 's', 'j', 'i', 's' ),
773 FT_ENC_TAG( FT_ENCODING_PRC, 'g', 'b', ' ', ' ' ),
774 FT_ENC_TAG( FT_ENCODING_BIG5, 'b', 'i', 'g', '5' ),
775 FT_ENC_TAG( FT_ENCODING_WANSUNG, 'w', 'a', 'n', 's' ),
776 FT_ENC_TAG( FT_ENCODING_JOHAB, 'j', 'o', 'h', 'a' ),
777
778 /* for backward compatibility */
779 FT_ENCODING_GB2312 = FT_ENCODING_PRC,
780 FT_ENCODING_MS_SJIS = FT_ENCODING_SJIS,
781 FT_ENCODING_MS_GB2312 = FT_ENCODING_PRC,
782 FT_ENCODING_MS_BIG5 = FT_ENCODING_BIG5,
783 FT_ENCODING_MS_WANSUNG = FT_ENCODING_WANSUNG,
784 FT_ENCODING_MS_JOHAB = FT_ENCODING_JOHAB,
785
786 FT_ENC_TAG( FT_ENCODING_ADOBE_STANDARD, 'A', 'D', 'O', 'B' ),
787 FT_ENC_TAG( FT_ENCODING_ADOBE_EXPERT, 'A', 'D', 'B', 'E' ),
788 FT_ENC_TAG( FT_ENCODING_ADOBE_CUSTOM, 'A', 'D', 'B', 'C' ),
789 FT_ENC_TAG( FT_ENCODING_ADOBE_LATIN_1, 'l', 'a', 't', '1' ),
790
791 FT_ENC_TAG( FT_ENCODING_OLD_LATIN_2, 'l', 'a', 't', '2' ),
792
793 FT_ENC_TAG( FT_ENCODING_APPLE_ROMAN, 'a', 'r', 'm', 'n' )
794
796
797
798 /* these constants are deprecated; use the corresponding `FT_Encoding' */
799 /* values instead */
800#define ft_encoding_none FT_ENCODING_NONE
801#define ft_encoding_unicode FT_ENCODING_UNICODE
802#define ft_encoding_symbol FT_ENCODING_MS_SYMBOL
803#define ft_encoding_latin_1 FT_ENCODING_ADOBE_LATIN_1
804#define ft_encoding_latin_2 FT_ENCODING_OLD_LATIN_2
805#define ft_encoding_sjis FT_ENCODING_SJIS
806#define ft_encoding_gb2312 FT_ENCODING_PRC
807#define ft_encoding_big5 FT_ENCODING_BIG5
808#define ft_encoding_wansung FT_ENCODING_WANSUNG
809#define ft_encoding_johab FT_ENCODING_JOHAB
810
811#define ft_encoding_adobe_standard FT_ENCODING_ADOBE_STANDARD
812#define ft_encoding_adobe_expert FT_ENCODING_ADOBE_EXPERT
813#define ft_encoding_adobe_custom FT_ENCODING_ADOBE_CUSTOM
814#define ft_encoding_apple_roman FT_ENCODING_APPLE_ROMAN
815
816
817 /*************************************************************************/
818 /* */
819 /* <Struct> */
820 /* FT_CharMapRec */
821 /* */
822 /* <Description> */
823 /* The base charmap structure. */
824 /* */
825 /* <Fields> */
826 /* face :: A handle to the parent face object. */
827 /* */
828 /* encoding :: An @FT_Encoding tag identifying the charmap. Use */
829 /* this with @FT_Select_Charmap. */
830 /* */
831 /* platform_id :: An ID number describing the platform for the */
832 /* following encoding ID. This comes directly from */
833 /* the TrueType specification and gets emulated for */
834 /* other formats. */
835 /* */
836 /* encoding_id :: A platform specific encoding number. This also */
837 /* comes from the TrueType specification and gets */
838 /* emulated similarly. */
839 /* */
840 typedef struct FT_CharMapRec_
841 {
846
848
849
850 /*************************************************************************/
851 /*************************************************************************/
852 /* */
853 /* B A S E O B J E C T C L A S S E S */
854 /* */
855 /*************************************************************************/
856 /*************************************************************************/
857
858
859 /*************************************************************************/
860 /* */
861 /* <Type> */
862 /* FT_Face_Internal */
863 /* */
864 /* <Description> */
865 /* An opaque handle to an `FT_Face_InternalRec' structure that models */
866 /* the private data of a given @FT_Face object. */
867 /* */
868 /* This structure might change between releases of FreeType~2 and is */
869 /* not generally available to client applications. */
870 /* */
872
873
874 /*************************************************************************/
875 /* */
876 /* <Struct> */
877 /* FT_FaceRec */
878 /* */
879 /* <Description> */
880 /* FreeType root face class structure. A face object models a */
881 /* typeface in a font file. */
882 /* */
883 /* <Fields> */
884 /* num_faces :: The number of faces in the font file. Some */
885 /* font formats can have multiple faces in */
886 /* a single font file. */
887 /* */
888 /* face_index :: This field holds two different values. */
889 /* Bits 0-15 are the index of the face in the */
890 /* font file (starting with value~0). They */
891 /* are set to~0 if there is only one face in */
892 /* the font file. */
893 /* */
894 /* [Since 2.6.1] Bits 16-30 are relevant to GX */
895 /* and OpenType variation fonts only, holding */
896 /* the named instance index for the current */
897 /* face index (starting with value~1; value~0 */
898 /* indicates font access without a named */
899 /* instance). For non-variation fonts, bits */
900 /* 16-30 are ignored. If we have the third */
901 /* named instance of face~4, say, `face_index' */
902 /* is set to 0x00030004. */
903 /* */
904 /* Bit 31 is always zero (this is, */
905 /* `face_index' is always a positive value). */
906 /* */
907 /* [Since 2.9] Changing the design coordinates */
908 /* with @FT_Set_Var_Design_Coordinates or */
909 /* @FT_Set_Var_Blend_Coordinates does not */
910 /* influence the named instance index value */
911 /* (only @FT_Set_Named_Instance does that). */
912 /* */
913 /* face_flags :: A set of bit flags that give important */
914 /* information about the face; see */
915 /* @FT_FACE_FLAG_XXX for the details. */
916 /* */
917 /* style_flags :: The lower 16~bits contain a set of bit */
918 /* flags indicating the style of the face; see */
919 /* @FT_STYLE_FLAG_XXX for the details. */
920 /* */
921 /* [Since 2.6.1] Bits 16-30 hold the number */
922 /* of named instances available for the */
923 /* current face if we have a GX or OpenType */
924 /* variation (sub)font. Bit 31 is always zero */
925 /* (this is, `style_flags' is always a */
926 /* positive value). Note that a variation */
927 /* font has always at least one named */
928 /* instance, namely the default instance. */
929 /* */
930 /* num_glyphs :: The number of glyphs in the face. If the */
931 /* face is scalable and has sbits (see */
932 /* `num_fixed_sizes'), it is set to the number */
933 /* of outline glyphs. */
934 /* */
935 /* For CID-keyed fonts (not in an SFNT */
936 /* wrapper) this value gives the highest CID */
937 /* used in the font. */
938 /* */
939 /* family_name :: The face's family name. This is an ASCII */
940 /* string, usually in English, that describes */
941 /* the typeface's family (like `Times New */
942 /* Roman', `Bodoni', `Garamond', etc). This */
943 /* is a least common denominator used to list */
944 /* fonts. Some formats (TrueType & OpenType) */
945 /* provide localized and Unicode versions of */
946 /* this string. Applications should use the */
947 /* format specific interface to access them. */
948 /* Can be NULL (e.g., in fonts embedded in a */
949 /* PDF file). */
950 /* */
951 /* In case the font doesn't provide a specific */
952 /* family name entry, FreeType tries to */
953 /* synthesize one, deriving it from other name */
954 /* entries. */
955 /* */
956 /* style_name :: The face's style name. This is an ASCII */
957 /* string, usually in English, that describes */
958 /* the typeface's style (like `Italic', */
959 /* `Bold', `Condensed', etc). Not all font */
960 /* formats provide a style name, so this field */
961 /* is optional, and can be set to NULL. As */
962 /* for `family_name', some formats provide */
963 /* localized and Unicode versions of this */
964 /* string. Applications should use the format */
965 /* specific interface to access them. */
966 /* */
967 /* num_fixed_sizes :: The number of bitmap strikes in the face. */
968 /* Even if the face is scalable, there might */
969 /* still be bitmap strikes, which are called */
970 /* `sbits' in that case. */
971 /* */
972 /* available_sizes :: An array of @FT_Bitmap_Size for all bitmap */
973 /* strikes in the face. It is set to NULL if */
974 /* there is no bitmap strike. */
975 /* */
976 /* Note that FreeType tries to sanitize the */
977 /* strike data since they are sometimes sloppy */
978 /* or incorrect, but this can easily fail. */
979 /* */
980 /* num_charmaps :: The number of charmaps in the face. */
981 /* */
982 /* charmaps :: An array of the charmaps of the face. */
983 /* */
984 /* generic :: A field reserved for client uses. See the */
985 /* @FT_Generic type description. */
986 /* */
987 /* bbox :: The font bounding box. Coordinates are */
988 /* expressed in font units (see */
989 /* `units_per_EM'). The box is large enough */
990 /* to contain any glyph from the font. Thus, */
991 /* `bbox.yMax' can be seen as the `maximum */
992 /* ascender', and `bbox.yMin' as the `minimum */
993 /* descender'. Only relevant for scalable */
994 /* formats. */
995 /* */
996 /* Note that the bounding box might be off by */
997 /* (at least) one pixel for hinted fonts. See */
998 /* @FT_Size_Metrics for further discussion. */
999 /* */
1000 /* units_per_EM :: The number of font units per EM square for */
1001 /* this face. This is typically 2048 for */
1002 /* TrueType fonts, and 1000 for Type~1 fonts. */
1003 /* Only relevant for scalable formats. */
1004 /* */
1005 /* ascender :: The typographic ascender of the face, */
1006 /* expressed in font units. For font formats */
1007 /* not having this information, it is set to */
1008 /* `bbox.yMax'. Only relevant for scalable */
1009 /* formats. */
1010 /* */
1011 /* descender :: The typographic descender of the face, */
1012 /* expressed in font units. For font formats */
1013 /* not having this information, it is set to */
1014 /* `bbox.yMin'. Note that this field is */
1015 /* negative for values below the baseline. */
1016 /* Only relevant for scalable formats. */
1017 /* */
1018 /* height :: This value is the vertical distance */
1019 /* between two consecutive baselines, */
1020 /* expressed in font units. It is always */
1021 /* positive. Only relevant for scalable */
1022 /* formats. */
1023 /* */
1024 /* If you want the global glyph height, use */
1025 /* `ascender - descender'. */
1026 /* */
1027 /* max_advance_width :: The maximum advance width, in font units, */
1028 /* for all glyphs in this face. This can be */
1029 /* used to make word wrapping computations */
1030 /* faster. Only relevant for scalable */
1031 /* formats. */
1032 /* */
1033 /* max_advance_height :: The maximum advance height, in font units, */
1034 /* for all glyphs in this face. This is only */
1035 /* relevant for vertical layouts, and is set */
1036 /* to `height' for fonts that do not provide */
1037 /* vertical metrics. Only relevant for */
1038 /* scalable formats. */
1039 /* */
1040 /* underline_position :: The position, in font units, of the */
1041 /* underline line for this face. It is the */
1042 /* center of the underlining stem. Only */
1043 /* relevant for scalable formats. */
1044 /* */
1045 /* underline_thickness :: The thickness, in font units, of the */
1046 /* underline for this face. Only relevant for */
1047 /* scalable formats. */
1048 /* */
1049 /* glyph :: The face's associated glyph slot(s). */
1050 /* */
1051 /* size :: The current active size for this face. */
1052 /* */
1053 /* charmap :: The current active charmap for this face. */
1054 /* */
1055 /* <Note> */
1056 /* Fields may be changed after a call to @FT_Attach_File or */
1057 /* @FT_Attach_Stream. */
1058 /* */
1059 /* For an OpenType variation font, the values of the following fields */
1060 /* can change after a call to @FT_Set_Var_Design_Coordinates (and */
1061 /* friends) if the font contains an `MVAR' table: `ascender', */
1062 /* `descender', `height', `underline_position', and */
1063 /* `underline_thickness'. */
1064 /* */
1065 /* Especially for TrueType fonts see also the documentation for */
1066 /* @FT_Size_Metrics. */
1067 /* */
1068 typedef struct FT_FaceRec_
1069 {
1072
1075
1077
1080
1083
1086
1087 FT_Generic generic;
1088
1089 /*# The following member variables (down to `underline_thickness') */
1090 /*# are only relevant to scalable outlines; cf. @FT_Bitmap_Size */
1091 /*# for bitmap fonts. */
1093
1098
1101
1104
1108
1109 /*@private begin */
1110
1114
1116
1117 FT_Generic autohint; /* face-specific auto-hinter data */
1118 void* extensions; /* unused */
1119
1121
1122 /*@private end */
1123
1125
1126
1127 /*************************************************************************/
1128 /* */
1129 /* <Enum> */
1130 /* FT_FACE_FLAG_XXX */
1131 /* */
1132 /* <Description> */
1133 /* A list of bit flags used in the `face_flags' field of the */
1134 /* @FT_FaceRec structure. They inform client applications of */
1135 /* properties of the corresponding face. */
1136 /* */
1137 /* <Values> */
1138 /* FT_FACE_FLAG_SCALABLE :: */
1139 /* The face contains outline glyphs. Note that a face can contain */
1140 /* bitmap strikes also, i.e., a face can have both this flag and */
1141 /* @FT_FACE_FLAG_FIXED_SIZES set. */
1142 /* */
1143 /* FT_FACE_FLAG_FIXED_SIZES :: */
1144 /* The face contains bitmap strikes. See also the */
1145 /* `num_fixed_sizes' and `available_sizes' fields of @FT_FaceRec. */
1146 /* */
1147 /* FT_FACE_FLAG_FIXED_WIDTH :: */
1148 /* The face contains fixed-width characters (like Courier, Lucida, */
1149 /* MonoType, etc.). */
1150 /* */
1151 /* FT_FACE_FLAG_SFNT :: */
1152 /* The face uses the SFNT storage scheme. For now, this means */
1153 /* TrueType and OpenType. */
1154 /* */
1155 /* FT_FACE_FLAG_HORIZONTAL :: */
1156 /* The face contains horizontal glyph metrics. This should be set */
1157 /* for all common formats. */
1158 /* */
1159 /* FT_FACE_FLAG_VERTICAL :: */
1160 /* The face contains vertical glyph metrics. This is only */
1161 /* available in some formats, not all of them. */
1162 /* */
1163 /* FT_FACE_FLAG_KERNING :: */
1164 /* The face contains kerning information. If set, the kerning */
1165 /* distance can be retrieved using the function @FT_Get_Kerning. */
1166 /* Otherwise the function always return the vector (0,0). Note */
1167 /* that FreeType doesn't handle kerning data from the SFNT `GPOS' */
1168 /* table (as present in many OpenType fonts). */
1169 /* */
1170 /* FT_FACE_FLAG_FAST_GLYPHS :: */
1171 /* THIS FLAG IS DEPRECATED. DO NOT USE OR TEST IT. */
1172 /* */
1173 /* FT_FACE_FLAG_MULTIPLE_MASTERS :: */
1174 /* The face contains multiple masters and is capable of */
1175 /* interpolating between them. Supported formats are Adobe MM, */
1176 /* TrueType GX, and OpenType variation fonts. */
1177 /* */
1178 /* See the multiple-masters specific API for details. */
1179 /* */
1180 /* FT_FACE_FLAG_GLYPH_NAMES :: */
1181 /* The face contains glyph names, which can be retrieved using */
1182 /* @FT_Get_Glyph_Name. Note that some TrueType fonts contain */
1183 /* broken glyph name tables. Use the function */
1184 /* @FT_Has_PS_Glyph_Names when needed. */
1185 /* */
1186 /* FT_FACE_FLAG_EXTERNAL_STREAM :: */
1187 /* Used internally by FreeType to indicate that a face's stream was */
1188 /* provided by the client application and should not be destroyed */
1189 /* when @FT_Done_Face is called. Don't read or test this flag. */
1190 /* */
1191 /* FT_FACE_FLAG_HINTER :: */
1192 /* The font driver has a hinting machine of its own. For example, */
1193 /* with TrueType fonts, it makes sense to use data from the SFNT */
1194 /* `gasp' table only if the native TrueType hinting engine (with */
1195 /* the bytecode interpreter) is available and active. */
1196 /* */
1197 /* FT_FACE_FLAG_CID_KEYED :: */
1198 /* The face is CID-keyed. In that case, the face is not accessed */
1199 /* by glyph indices but by CID values. For subsetted CID-keyed */
1200 /* fonts this has the consequence that not all index values are a */
1201 /* valid argument to @FT_Load_Glyph. Only the CID values for which */
1202 /* corresponding glyphs in the subsetted font exist make */
1203 /* `FT_Load_Glyph' return successfully; in all other cases you get */
1204 /* an `FT_Err_Invalid_Argument' error. */
1205 /* */
1206 /* Note that CID-keyed fonts that are in an SFNT wrapper (this is, */
1207 /* all OpenType/CFF fonts) don't have this flag set since the */
1208 /* glyphs are accessed in the normal way (using contiguous */
1209 /* indices); the `CID-ness' isn't visible to the application. */
1210 /* */
1211 /* FT_FACE_FLAG_TRICKY :: */
1212 /* The face is `tricky', this is, it always needs the font format's */
1213 /* native hinting engine to get a reasonable result. A typical */
1214 /* example is the old Chinese font `mingli.ttf' (but not */
1215 /* `mingliu.ttc') that uses TrueType bytecode instructions to move */
1216 /* and scale all of its subglyphs. */
1217 /* */
1218 /* It is not possible to auto-hint such fonts using */
1219 /* @FT_LOAD_FORCE_AUTOHINT; it will also ignore */
1220 /* @FT_LOAD_NO_HINTING. You have to set both @FT_LOAD_NO_HINTING */
1221 /* and @FT_LOAD_NO_AUTOHINT to really disable hinting; however, you */
1222 /* probably never want this except for demonstration purposes. */
1223 /* */
1224 /* Currently, there are about a dozen TrueType fonts in the list of */
1225 /* tricky fonts; they are hard-coded in file `ttobjs.c'. */
1226 /* */
1227 /* FT_FACE_FLAG_COLOR :: */
1228 /* [Since 2.5.1] The face has color glyph tables. To access color */
1229 /* glyphs use @FT_LOAD_COLOR. */
1230 /* */
1231 /* FT_FACE_FLAG_VARIATION :: */
1232 /* [Since 2.9] Set if the current face (or named instance) has been */
1233 /* altered with @FT_Set_MM_Design_Coordinates, */
1234 /* @FT_Set_Var_Design_Coordinates, or */
1235 /* @FT_Set_Var_Blend_Coordinates. This flag is unset by a call to */
1236 /* @FT_Set_Named_Instance. */
1237 /* */
1238#define FT_FACE_FLAG_SCALABLE ( 1L << 0 )
1239#define FT_FACE_FLAG_FIXED_SIZES ( 1L << 1 )
1240#define FT_FACE_FLAG_FIXED_WIDTH ( 1L << 2 )
1241#define FT_FACE_FLAG_SFNT ( 1L << 3 )
1242#define FT_FACE_FLAG_HORIZONTAL ( 1L << 4 )
1243#define FT_FACE_FLAG_VERTICAL ( 1L << 5 )
1244#define FT_FACE_FLAG_KERNING ( 1L << 6 )
1245#define FT_FACE_FLAG_FAST_GLYPHS ( 1L << 7 )
1246#define FT_FACE_FLAG_MULTIPLE_MASTERS ( 1L << 8 )
1247#define FT_FACE_FLAG_GLYPH_NAMES ( 1L << 9 )
1248#define FT_FACE_FLAG_EXTERNAL_STREAM ( 1L << 10 )
1249#define FT_FACE_FLAG_HINTER ( 1L << 11 )
1250#define FT_FACE_FLAG_CID_KEYED ( 1L << 12 )
1251#define FT_FACE_FLAG_TRICKY ( 1L << 13 )
1252#define FT_FACE_FLAG_COLOR ( 1L << 14 )
1253#define FT_FACE_FLAG_VARIATION ( 1L << 15 )
1254
1255
1256 /*************************************************************************
1257 *
1258 * @macro:
1259 * FT_HAS_HORIZONTAL( face )
1260 *
1261 * @description:
1262 * A macro that returns true whenever a face object contains
1263 * horizontal metrics (this is true for all font formats though).
1264 *
1265 * @also:
1266 * @FT_HAS_VERTICAL can be used to check for vertical metrics.
1267 *
1268 */
1269#define FT_HAS_HORIZONTAL( face ) \
1270 ( (face)->face_flags & FT_FACE_FLAG_HORIZONTAL )
1271
1272
1273 /*************************************************************************
1274 *
1275 * @macro:
1276 * FT_HAS_VERTICAL( face )
1277 *
1278 * @description:
1279 * A macro that returns true whenever a face object contains real
1280 * vertical metrics (and not only synthesized ones).
1281 *
1282 */
1283#define FT_HAS_VERTICAL( face ) \
1284 ( (face)->face_flags & FT_FACE_FLAG_VERTICAL )
1285
1286
1287 /*************************************************************************
1288 *
1289 * @macro:
1290 * FT_HAS_KERNING( face )
1291 *
1292 * @description:
1293 * A macro that returns true whenever a face object contains kerning
1294 * data that can be accessed with @FT_Get_Kerning.
1295 *
1296 */
1297#define FT_HAS_KERNING( face ) \
1298 ( (face)->face_flags & FT_FACE_FLAG_KERNING )
1299
1300
1301 /*************************************************************************
1302 *
1303 * @macro:
1304 * FT_IS_SCALABLE( face )
1305 *
1306 * @description:
1307 * A macro that returns true whenever a face object contains a scalable
1308 * font face (true for TrueType, Type~1, Type~42, CID, OpenType/CFF,
1309 * and PFR font formats).
1310 *
1311 */
1312#define FT_IS_SCALABLE( face ) \
1313 ( (face)->face_flags & FT_FACE_FLAG_SCALABLE )
1314
1315
1316 /*************************************************************************
1317 *
1318 * @macro:
1319 * FT_IS_SFNT( face )
1320 *
1321 * @description:
1322 * A macro that returns true whenever a face object contains a font
1323 * whose format is based on the SFNT storage scheme. This usually
1324 * means: TrueType fonts, OpenType fonts, as well as SFNT-based embedded
1325 * bitmap fonts.
1326 *
1327 * If this macro is true, all functions defined in @FT_SFNT_NAMES_H and
1328 * @FT_TRUETYPE_TABLES_H are available.
1329 *
1330 */
1331#define FT_IS_SFNT( face ) \
1332 ( (face)->face_flags & FT_FACE_FLAG_SFNT )
1333
1334
1335 /*************************************************************************
1336 *
1337 * @macro:
1338 * FT_IS_FIXED_WIDTH( face )
1339 *
1340 * @description:
1341 * A macro that returns true whenever a face object contains a font face
1342 * that contains fixed-width (or `monospace', `fixed-pitch', etc.)
1343 * glyphs.
1344 *
1345 */
1346#define FT_IS_FIXED_WIDTH( face ) \
1347 ( (face)->face_flags & FT_FACE_FLAG_FIXED_WIDTH )
1348
1349
1350 /*************************************************************************
1351 *
1352 * @macro:
1353 * FT_HAS_FIXED_SIZES( face )
1354 *
1355 * @description:
1356 * A macro that returns true whenever a face object contains some
1357 * embedded bitmaps. See the `available_sizes' field of the
1358 * @FT_FaceRec structure.
1359 *
1360 */
1361#define FT_HAS_FIXED_SIZES( face ) \
1362 ( (face)->face_flags & FT_FACE_FLAG_FIXED_SIZES )
1363
1364
1365 /*************************************************************************
1366 *
1367 * @macro:
1368 * FT_HAS_FAST_GLYPHS( face )
1369 *
1370 * @description:
1371 * Deprecated.
1372 *
1373 */
1374#define FT_HAS_FAST_GLYPHS( face ) 0
1375
1376
1377 /*************************************************************************
1378 *
1379 * @macro:
1380 * FT_HAS_GLYPH_NAMES( face )
1381 *
1382 * @description:
1383 * A macro that returns true whenever a face object contains some glyph
1384 * names that can be accessed through @FT_Get_Glyph_Name.
1385 *
1386 */
1387#define FT_HAS_GLYPH_NAMES( face ) \
1388 ( (face)->face_flags & FT_FACE_FLAG_GLYPH_NAMES )
1389
1390
1391 /*************************************************************************
1392 *
1393 * @macro:
1394 * FT_HAS_MULTIPLE_MASTERS( face )
1395 *
1396 * @description:
1397 * A macro that returns true whenever a face object contains some
1398 * multiple masters. The functions provided by @FT_MULTIPLE_MASTERS_H
1399 * are then available to choose the exact design you want.
1400 *
1401 */
1402#define FT_HAS_MULTIPLE_MASTERS( face ) \
1403 ( (face)->face_flags & FT_FACE_FLAG_MULTIPLE_MASTERS )
1404
1405
1406 /*************************************************************************
1407 *
1408 * @macro:
1409 * FT_IS_NAMED_INSTANCE( face )
1410 *
1411 * @description:
1412 * A macro that returns true whenever a face object is a named instance
1413 * of a GX or OpenType variation font.
1414 *
1415 * [Since 2.9] Changing the design coordinates with
1416 * @FT_Set_Var_Design_Coordinates or @FT_Set_Var_Blend_Coordinates does
1417 * not influence the return value of this macro (only
1418 * @FT_Set_Named_Instance does that).
1419 *
1420 * @since:
1421 * 2.7
1422 *
1423 */
1424#define FT_IS_NAMED_INSTANCE( face ) \
1425 ( (face)->face_index & 0x7FFF0000L )
1426
1427
1428 /*************************************************************************
1429 *
1430 * @macro:
1431 * FT_IS_VARIATION( face )
1432 *
1433 * @description:
1434 * A macro that returns true whenever a face object has been altered
1435 * by @FT_Set_MM_Design_Coordinates, @FT_Set_Var_Design_Coordinates, or
1436 * @FT_Set_Var_Blend_Coordinates.
1437 *
1438 * @since:
1439 * 2.9
1440 *
1441 */
1442#define FT_IS_VARIATION( face ) \
1443 ( (face)->face_flags & FT_FACE_FLAG_VARIATION )
1444
1445
1446 /*************************************************************************
1447 *
1448 * @macro:
1449 * FT_IS_CID_KEYED( face )
1450 *
1451 * @description:
1452 * A macro that returns true whenever a face object contains a CID-keyed
1453 * font. See the discussion of @FT_FACE_FLAG_CID_KEYED for more
1454 * details.
1455 *
1456 * If this macro is true, all functions defined in @FT_CID_H are
1457 * available.
1458 *
1459 */
1460#define FT_IS_CID_KEYED( face ) \
1461 ( (face)->face_flags & FT_FACE_FLAG_CID_KEYED )
1462
1463
1464 /*************************************************************************
1465 *
1466 * @macro:
1467 * FT_IS_TRICKY( face )
1468 *
1469 * @description:
1470 * A macro that returns true whenever a face represents a `tricky' font.
1471 * See the discussion of @FT_FACE_FLAG_TRICKY for more details.
1472 *
1473 */
1474#define FT_IS_TRICKY( face ) \
1475 ( (face)->face_flags & FT_FACE_FLAG_TRICKY )
1476
1477
1478 /*************************************************************************
1479 *
1480 * @macro:
1481 * FT_HAS_COLOR( face )
1482 *
1483 * @description:
1484 * A macro that returns true whenever a face object contains
1485 * tables for color glyphs.
1486 *
1487 * @since:
1488 * 2.5.1
1489 *
1490 */
1491#define FT_HAS_COLOR( face ) \
1492 ( (face)->face_flags & FT_FACE_FLAG_COLOR )
1493
1494
1495 /*************************************************************************/
1496 /* */
1497 /* <Const> */
1498 /* FT_STYLE_FLAG_XXX */
1499 /* */
1500 /* <Description> */
1501 /* A list of bit flags to indicate the style of a given face. These */
1502 /* are used in the `style_flags' field of @FT_FaceRec. */
1503 /* */
1504 /* <Values> */
1505 /* FT_STYLE_FLAG_ITALIC :: */
1506 /* The face style is italic or oblique. */
1507 /* */
1508 /* FT_STYLE_FLAG_BOLD :: */
1509 /* The face is bold. */
1510 /* */
1511 /* <Note> */
1512 /* The style information as provided by FreeType is very basic. More */
1513 /* details are beyond the scope and should be done on a higher level */
1514 /* (for example, by analyzing various fields of the `OS/2' table in */
1515 /* SFNT based fonts). */
1516 /* */
1517#define FT_STYLE_FLAG_ITALIC ( 1 << 0 )
1518#define FT_STYLE_FLAG_BOLD ( 1 << 1 )
1519
1520
1521 /*************************************************************************/
1522 /* */
1523 /* <Type> */
1524 /* FT_Size_Internal */
1525 /* */
1526 /* <Description> */
1527 /* An opaque handle to an `FT_Size_InternalRec' structure, used to */
1528 /* model private data of a given @FT_Size object. */
1529 /* */
1531
1532
1533 /*************************************************************************/
1534 /* */
1535 /* <Struct> */
1536 /* FT_Size_Metrics */
1537 /* */
1538 /* <Description> */
1539 /* The size metrics structure gives the metrics of a size object. */
1540 /* */
1541 /* <Fields> */
1542 /* x_ppem :: The width of the scaled EM square in pixels, hence */
1543 /* the term `ppem' (pixels per EM). It is also */
1544 /* referred to as `nominal width'. */
1545 /* */
1546 /* y_ppem :: The height of the scaled EM square in pixels, */
1547 /* hence the term `ppem' (pixels per EM). It is also */
1548 /* referred to as `nominal height'. */
1549 /* */
1550 /* x_scale :: A 16.16 fractional scaling value to convert */
1551 /* horizontal metrics from font units to 26.6 */
1552 /* fractional pixels. Only relevant for scalable */
1553 /* font formats. */
1554 /* */
1555 /* y_scale :: A 16.16 fractional scaling value to convert */
1556 /* vertical metrics from font units to 26.6 */
1557 /* fractional pixels. Only relevant for scalable */
1558 /* font formats. */
1559 /* */
1560 /* ascender :: The ascender in 26.6 fractional pixels, rounded up */
1561 /* to an integer value. See @FT_FaceRec for the */
1562 /* details. */
1563 /* */
1564 /* descender :: The descender in 26.6 fractional pixels, rounded */
1565 /* down to an integer value. See @FT_FaceRec for the */
1566 /* details. */
1567 /* */
1568 /* height :: The height in 26.6 fractional pixels, rounded to */
1569 /* an integer value. See @FT_FaceRec for the */
1570 /* details. */
1571 /* */
1572 /* max_advance :: The maximum advance width in 26.6 fractional */
1573 /* pixels, rounded to an integer value. See */
1574 /* @FT_FaceRec for the details. */
1575 /* */
1576 /* <Note> */
1577 /* The scaling values, if relevant, are determined first during a */
1578 /* size changing operation. The remaining fields are then set by the */
1579 /* driver. For scalable formats, they are usually set to scaled */
1580 /* values of the corresponding fields in @FT_FaceRec. Some values */
1581 /* like ascender or descender are rounded for historical reasons; */
1582 /* more precise values (for outline fonts) can be derived by scaling */
1583 /* the corresponding @FT_FaceRec values manually, with code similar */
1584 /* to the following. */
1585 /* */
1586 /* { */
1587 /* scaled_ascender = FT_MulFix( face->ascender, */
1588 /* size_metrics->y_scale ); */
1589 /* } */
1590 /* */
1591 /* Note that due to glyph hinting and the selected rendering mode */
1592 /* these values are usually not exact; consequently, they must be */
1593 /* treated as unreliable with an error margin of at least one pixel! */
1594 /* */
1595 /* Indeed, the only way to get the exact metrics is to render _all_ */
1596 /* glyphs. As this would be a definite performance hit, it is up to */
1597 /* client applications to perform such computations. */
1598 /* */
1599 /* The `FT_Size_Metrics' structure is valid for bitmap fonts also. */
1600 /* */
1601 /* */
1602 /* *TrueType* *fonts* *with* *native* *bytecode* *hinting* */
1603 /* */
1604 /* All applications that handle TrueType fonts with native hinting */
1605 /* must be aware that TTFs expect different rounding of vertical font */
1606 /* dimensions. The application has to cater for this, especially if */
1607 /* it wants to rely on a TTF's vertical data (for example, to */
1608 /* properly align box characters vertically). */
1609 /* */
1610 /* Only the application knows _in_ _advance_ that it is going to use */
1611 /* native hinting for TTFs! FreeType, on the other hand, selects the */
1612 /* hinting mode not at the time of creating an @FT_Size object but */
1613 /* much later, namely while calling @FT_Load_Glyph. */
1614 /* */
1615 /* Here is some pseudo code that illustrates a possible solution. */
1616 /* */
1617 /* { */
1618 /* font_format = FT_Get_Font_Format( face ); */
1619 /* */
1620 /* if ( !strcmp( font_format, "TrueType" ) && */
1621 /* do_native_bytecode_hinting ) */
1622 /* { */
1623 /* ascender = ROUND( FT_MulFix( face->ascender, */
1624 /* size_metrics->y_scale ) ); */
1625 /* descender = ROUND( FT_MulFix( face->descender, */
1626 /* size_metrics->y_scale ) ); */
1627 /* } */
1628 /* else */
1629 /* { */
1630 /* ascender = size_metrics->ascender; */
1631 /* descender = size_metrics->descender; */
1632 /* } */
1633 /* */
1634 /* height = size_metrics->height; */
1635 /* max_advance = size_metrics->max_advance; */
1636 /* } */
1637 /* */
1638 typedef struct FT_Size_Metrics_
1639 {
1640 FT_UShort x_ppem; /* horizontal pixels per EM */
1641 FT_UShort y_ppem; /* vertical pixels per EM */
1642
1643 FT_Fixed x_scale; /* scaling values used to convert font */
1644 FT_Fixed y_scale; /* units to 26.6 fractional pixels */
1645
1646 FT_Pos ascender; /* ascender in 26.6 frac. pixels */
1647 FT_Pos descender; /* descender in 26.6 frac. pixels */
1648 FT_Pos height; /* text height in 26.6 frac. pixels */
1649 FT_Pos max_advance; /* max horizontal advance, in 26.6 pixels */
1650
1652
1653
1654 /*************************************************************************/
1655 /* */
1656 /* <Struct> */
1657 /* FT_SizeRec */
1658 /* */
1659 /* <Description> */
1660 /* FreeType root size class structure. A size object models a face */
1661 /* object at a given size. */
1662 /* */
1663 /* <Fields> */
1664 /* face :: Handle to the parent face object. */
1665 /* */
1666 /* generic :: A typeless pointer, unused by the FreeType library or */
1667 /* any of its drivers. It can be used by client */
1668 /* applications to link their own data to each size */
1669 /* object. */
1670 /* */
1671 /* metrics :: Metrics for this size object. This field is read-only. */
1672 /* */
1673 typedef struct FT_SizeRec_
1674 {
1675 FT_Face face; /* parent face object */
1676 FT_Generic generic; /* generic pointer for client uses */
1677 FT_Size_Metrics metrics; /* size metrics */
1679
1681
1682
1683 /*************************************************************************/
1684 /* */
1685 /* <Struct> */
1686 /* FT_SubGlyph */
1687 /* */
1688 /* <Description> */
1689 /* The subglyph structure is an internal object used to describe */
1690 /* subglyphs (for example, in the case of composites). */
1691 /* */
1692 /* <Note> */
1693 /* The subglyph implementation is not part of the high-level API, */
1694 /* hence the forward structure declaration. */
1695 /* */
1696 /* You can however retrieve subglyph information with */
1697 /* @FT_Get_SubGlyph_Info. */
1698 /* */
1700
1701
1702 /*************************************************************************/
1703 /* */
1704 /* <Type> */
1705 /* FT_Slot_Internal */
1706 /* */
1707 /* <Description> */
1708 /* An opaque handle to an `FT_Slot_InternalRec' structure, used to */
1709 /* model private data of a given @FT_GlyphSlot object. */
1710 /* */
1712
1713
1714 /*************************************************************************/
1715 /* */
1716 /* <Struct> */
1717 /* FT_GlyphSlotRec */
1718 /* */
1719 /* <Description> */
1720 /* FreeType root glyph slot class structure. A glyph slot is a */
1721 /* container where individual glyphs can be loaded, be they in */
1722 /* outline or bitmap format. */
1723 /* */
1724 /* <Fields> */
1725 /* library :: A handle to the FreeType library instance */
1726 /* this slot belongs to. */
1727 /* */
1728 /* face :: A handle to the parent face object. */
1729 /* */
1730 /* next :: In some cases (like some font tools), several */
1731 /* glyph slots per face object can be a good */
1732 /* thing. As this is rare, the glyph slots are */
1733 /* listed through a direct, single-linked list */
1734 /* using its `next' field. */
1735 /* */
1736 /* generic :: A typeless pointer unused by the FreeType */
1737 /* library or any of its drivers. It can be */
1738 /* used by client applications to link their own */
1739 /* data to each glyph slot object. */
1740 /* */
1741 /* metrics :: The metrics of the last loaded glyph in the */
1742 /* slot. The returned values depend on the last */
1743 /* load flags (see the @FT_Load_Glyph API */
1744 /* function) and can be expressed either in 26.6 */
1745 /* fractional pixels or font units. */
1746 /* */
1747 /* Note that even when the glyph image is */
1748 /* transformed, the metrics are not. */
1749 /* */
1750 /* linearHoriAdvance :: The advance width of the unhinted glyph. */
1751 /* Its value is expressed in 16.16 fractional */
1752 /* pixels, unless @FT_LOAD_LINEAR_DESIGN is set */
1753 /* when loading the glyph. This field can be */
1754 /* important to perform correct WYSIWYG layout. */
1755 /* Only relevant for outline glyphs. */
1756 /* */
1757 /* linearVertAdvance :: The advance height of the unhinted glyph. */
1758 /* Its value is expressed in 16.16 fractional */
1759 /* pixels, unless @FT_LOAD_LINEAR_DESIGN is set */
1760 /* when loading the glyph. This field can be */
1761 /* important to perform correct WYSIWYG layout. */
1762 /* Only relevant for outline glyphs. */
1763 /* */
1764 /* advance :: This shorthand is, depending on */
1765 /* @FT_LOAD_IGNORE_TRANSFORM, the transformed */
1766 /* (hinted) advance width for the glyph, in 26.6 */
1767 /* fractional pixel format. As specified with */
1768 /* @FT_LOAD_VERTICAL_LAYOUT, it uses either the */
1769 /* `horiAdvance' or the `vertAdvance' value of */
1770 /* `metrics' field. */
1771 /* */
1772 /* format :: This field indicates the format of the image */
1773 /* contained in the glyph slot. Typically */
1774 /* @FT_GLYPH_FORMAT_BITMAP, */
1775 /* @FT_GLYPH_FORMAT_OUTLINE, or */
1776 /* @FT_GLYPH_FORMAT_COMPOSITE, but other values */
1777 /* are possible. */
1778 /* */
1779 /* bitmap :: This field is used as a bitmap descriptor. */
1780 /* Note that the address and content of the */
1781 /* bitmap buffer can change between calls of */
1782 /* @FT_Load_Glyph and a few other functions. */
1783 /* */
1784 /* bitmap_left :: The bitmap's left bearing expressed in */
1785 /* integer pixels. */
1786 /* */
1787 /* bitmap_top :: The bitmap's top bearing expressed in integer */
1788 /* pixels. This is the distance from the */
1789 /* baseline to the top-most glyph scanline, */
1790 /* upwards y~coordinates being *positive*. */
1791 /* */
1792 /* outline :: The outline descriptor for the current glyph */
1793 /* image if its format is */
1794 /* @FT_GLYPH_FORMAT_OUTLINE. Once a glyph is */
1795 /* loaded, `outline' can be transformed, */
1796 /* distorted, emboldened, etc. However, it must */
1797 /* not be freed. */
1798 /* */
1799 /* num_subglyphs :: The number of subglyphs in a composite glyph. */
1800 /* This field is only valid for the composite */
1801 /* glyph format that should normally only be */
1802 /* loaded with the @FT_LOAD_NO_RECURSE flag. */
1803 /* */
1804 /* subglyphs :: An array of subglyph descriptors for */
1805 /* composite glyphs. There are `num_subglyphs' */
1806 /* elements in there. Currently internal to */
1807 /* FreeType. */
1808 /* */
1809 /* control_data :: Certain font drivers can also return the */
1810 /* control data for a given glyph image (e.g. */
1811 /* TrueType bytecode, Type~1 charstrings, etc.). */
1812 /* This field is a pointer to such data; it is */
1813 /* currently internal to FreeType. */
1814 /* */
1815 /* control_len :: This is the length in bytes of the control */
1816 /* data. Currently internal to FreeType. */
1817 /* */
1818 /* other :: Reserved. */
1819 /* */
1820 /* lsb_delta :: The difference between hinted and unhinted */
1821 /* left side bearing while auto-hinting is */
1822 /* active. Zero otherwise. */
1823 /* */
1824 /* rsb_delta :: The difference between hinted and unhinted */
1825 /* right side bearing while auto-hinting is */
1826 /* active. Zero otherwise. */
1827 /* */
1828 /* <Note> */
1829 /* If @FT_Load_Glyph is called with default flags (see */
1830 /* @FT_LOAD_DEFAULT) the glyph image is loaded in the glyph slot in */
1831 /* its native format (e.g., an outline glyph for TrueType and Type~1 */
1832 /* formats). [Since 2.9] The prospective bitmap metrics are */
1833 /* calculated according to @FT_LOAD_TARGET_XXX and other flags even */
1834 /* for the outline glyph, even if @FT_LOAD_RENDER is not set. */
1835 /* */
1836 /* This image can later be converted into a bitmap by calling */
1837 /* @FT_Render_Glyph. This function searches the current renderer for */
1838 /* the native image's format, then invokes it. */
1839 /* */
1840 /* The renderer is in charge of transforming the native image through */
1841 /* the slot's face transformation fields, then converting it into a */
1842 /* bitmap that is returned in `slot->bitmap'. */
1843 /* */
1844 /* Note that `slot->bitmap_left' and `slot->bitmap_top' are also used */
1845 /* to specify the position of the bitmap relative to the current pen */
1846 /* position (e.g., coordinates (0,0) on the baseline). Of course, */
1847 /* `slot->format' is also changed to @FT_GLYPH_FORMAT_BITMAP. */
1848 /* */
1849 /* Here is a small pseudo code fragment that shows how to use */
1850 /* `lsb_delta' and `rsb_delta' to do fractional positioning of */
1851 /* glyphs: */
1852 /* */
1853 /* { */
1854 /* FT_GlyphSlot slot = face->glyph; */
1855 /* FT_Pos origin_x = 0; */
1856 /* */
1857 /* */
1858 /* for all glyphs do */
1859 /* <load glyph with `FT_Load_Glyph'> */
1860 /* */
1861 /* FT_Outline_Translate( slot->outline, origin_x & 63, 0 ); */
1862 /* */
1863 /* <save glyph image, or render glyph, or ...> */
1864 /* */
1865 /* <compute kern between current and next glyph */
1866 /* and add it to `origin_x'> */
1867 /* */
1868 /* origin_x += slot->advance.x; */
1869 /* origin_x += slot->rsb_delta - slot->lsb_delta; */
1870 /* endfor */
1871 /* } */
1872 /* */
1873 /* Here is another small pseudo code fragment that shows how to use */
1874 /* `lsb_delta' and `rsb_delta' to improve integer positioning of */
1875 /* glyphs: */
1876 /* */
1877 /* { */
1878 /* FT_GlyphSlot slot = face->glyph; */
1879 /* FT_Pos origin_x = 0; */
1880 /* FT_Pos prev_rsb_delta = 0; */
1881 /* */
1882 /* */
1883 /* for all glyphs do */
1884 /* <compute kern between current and previous glyph */
1885 /* and add it to `origin_x'> */
1886 /* */
1887 /* <load glyph with `FT_Load_Glyph'> */
1888 /* */
1889 /* if ( prev_rsb_delta - slot->lsb_delta > 32 ) */
1890 /* origin_x -= 64; */
1891 /* else if ( prev_rsb_delta - slot->lsb_delta < -31 ) */
1892 /* origin_x += 64; */
1893 /* */
1894 /* prev_rsb_delta = slot->rsb_delta; */
1895 /* */
1896 /* <save glyph image, or render glyph, or ...> */
1897 /* */
1898 /* origin_x += slot->advance.x; */
1899 /* endfor */
1900 /* } */
1901 /* */
1902 /* If you use strong auto-hinting, you *must* apply these delta */
1903 /* values! Otherwise you will experience far too large inter-glyph */
1904 /* spacing at small rendering sizes in most cases. Note that it */
1905 /* doesn't harm to use the above code for other hinting modes also, */
1906 /* since the delta values are zero then. */
1907 /* */
1908 typedef struct FT_GlyphSlotRec_
1909 {
1913 FT_UInt reserved; /* retained for binary compatibility */
1914 FT_Generic generic;
1915
1920
1922
1926
1928
1931
1934
1937
1938 void* other;
1939
1941
1943
1944
1945 /*************************************************************************/
1946 /*************************************************************************/
1947 /* */
1948 /* F U N C T I O N S */
1949 /* */
1950 /*************************************************************************/
1951 /*************************************************************************/
1952
1953
1954 /*************************************************************************/
1955 /* */
1956 /* <Function> */
1957 /* FT_Init_FreeType */
1958 /* */
1959 /* <Description> */
1960 /* Initialize a new FreeType library object. The set of modules */
1961 /* that are registered by this function is determined at build time. */
1962 /* */
1963 /* <Output> */
1964 /* alibrary :: A handle to a new library object. */
1965 /* */
1966 /* <Return> */
1967 /* FreeType error code. 0~means success. */
1968 /* */
1969 /* <Note> */
1970 /* In case you want to provide your own memory allocating routines, */
1971 /* use @FT_New_Library instead, followed by a call to */
1972 /* @FT_Add_Default_Modules (or a series of calls to @FT_Add_Module) */
1973 /* and @FT_Set_Default_Properties. */
1974 /* */
1975 /* See the documentation of @FT_Library and @FT_Face for */
1976 /* multi-threading issues. */
1977 /* */
1978 /* If you need reference-counting (cf. @FT_Reference_Library), use */
1979 /* @FT_New_Library and @FT_Done_Library. */
1980 /* */
1981 /* If compilation option FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES is */
1982 /* set, this function reads the `FREETYPE_PROPERTIES' environment */
1983 /* variable to control driver properties. See section @properties */
1984 /* for more. */
1985 /* */
1987 FT_Init_FreeType( FT_Library *alibrary );
1988
1989
1990 /*************************************************************************/
1991 /* */
1992 /* <Function> */
1993 /* FT_Done_FreeType */
1994 /* */
1995 /* <Description> */
1996 /* Destroy a given FreeType library object and all of its children, */
1997 /* including resources, drivers, faces, sizes, etc. */
1998 /* */
1999 /* <Input> */
2000 /* library :: A handle to the target library object. */
2001 /* */
2002 /* <Return> */
2003 /* FreeType error code. 0~means success. */
2004 /* */
2007
2008
2009 /*************************************************************************/
2010 /* */
2011 /* <Enum> */
2012 /* FT_OPEN_XXX */
2013 /* */
2014 /* <Description> */
2015 /* A list of bit field constants used within the `flags' field of the */
2016 /* @FT_Open_Args structure. */
2017 /* */
2018 /* <Values> */
2019 /* FT_OPEN_MEMORY :: This is a memory-based stream. */
2020 /* */
2021 /* FT_OPEN_STREAM :: Copy the stream from the `stream' field. */
2022 /* */
2023 /* FT_OPEN_PATHNAME :: Create a new input stream from a C~path */
2024 /* name. */
2025 /* */
2026 /* FT_OPEN_DRIVER :: Use the `driver' field. */
2027 /* */
2028 /* FT_OPEN_PARAMS :: Use the `num_params' and `params' fields. */
2029 /* */
2030 /* <Note> */
2031 /* The `FT_OPEN_MEMORY', `FT_OPEN_STREAM', and `FT_OPEN_PATHNAME' */
2032 /* flags are mutually exclusive. */
2033 /* */
2034#define FT_OPEN_MEMORY 0x1
2035#define FT_OPEN_STREAM 0x2
2036#define FT_OPEN_PATHNAME 0x4
2037#define FT_OPEN_DRIVER 0x8
2038#define FT_OPEN_PARAMS 0x10
2039
2040
2041 /* these constants are deprecated; use the corresponding `FT_OPEN_XXX' */
2042 /* values instead */
2043#define ft_open_memory FT_OPEN_MEMORY
2044#define ft_open_stream FT_OPEN_STREAM
2045#define ft_open_pathname FT_OPEN_PATHNAME
2046#define ft_open_driver FT_OPEN_DRIVER
2047#define ft_open_params FT_OPEN_PARAMS
2048
2049
2050 /*************************************************************************/
2051 /* */
2052 /* <Struct> */
2053 /* FT_Parameter */
2054 /* */
2055 /* <Description> */
2056 /* A simple structure to pass more or less generic parameters to */
2057 /* @FT_Open_Face and @FT_Face_Properties. */
2058 /* */
2059 /* <Fields> */
2060 /* tag :: A four-byte identification tag. */
2061 /* */
2062 /* data :: A pointer to the parameter data. */
2063 /* */
2064 /* <Note> */
2065 /* The ID and function of parameters are driver-specific. See the */
2066 /* various FT_PARAM_TAG_XXX flags for more information. */
2067 /* */
2068 typedef struct FT_Parameter_
2069 {
2072
2074
2075
2076 /*************************************************************************/
2077 /* */
2078 /* <Struct> */
2079 /* FT_Open_Args */
2080 /* */
2081 /* <Description> */
2082 /* A structure to indicate how to open a new font file or stream. A */
2083 /* pointer to such a structure can be used as a parameter for the */
2084 /* functions @FT_Open_Face and @FT_Attach_Stream. */
2085 /* */
2086 /* <Fields> */
2087 /* flags :: A set of bit flags indicating how to use the */
2088 /* structure. */
2089 /* */
2090 /* memory_base :: The first byte of the file in memory. */
2091 /* */
2092 /* memory_size :: The size in bytes of the file in memory. */
2093 /* */
2094 /* pathname :: A pointer to an 8-bit file pathname. */
2095 /* */
2096 /* stream :: A handle to a source stream object. */
2097 /* */
2098 /* driver :: This field is exclusively used by @FT_Open_Face; */
2099 /* it simply specifies the font driver to use for */
2100 /* opening the face. If set to NULL, FreeType tries */
2101 /* to load the face with each one of the drivers in */
2102 /* its list. */
2103 /* */
2104 /* num_params :: The number of extra parameters. */
2105 /* */
2106 /* params :: Extra parameters passed to the font driver when */
2107 /* opening a new face. */
2108 /* */
2109 /* <Note> */
2110 /* The stream type is determined by the contents of `flags' that */
2111 /* are tested in the following order by @FT_Open_Face: */
2112 /* */
2113 /* If the @FT_OPEN_MEMORY bit is set, assume that this is a */
2114 /* memory file of `memory_size' bytes, located at `memory_address'. */
2115 /* The data are not copied, and the client is responsible for */
2116 /* releasing and destroying them _after_ the corresponding call to */
2117 /* @FT_Done_Face. */
2118 /* */
2119 /* Otherwise, if the @FT_OPEN_STREAM bit is set, assume that a */
2120 /* custom input stream `stream' is used. */
2121 /* */
2122 /* Otherwise, if the @FT_OPEN_PATHNAME bit is set, assume that this */
2123 /* is a normal file and use `pathname' to open it. */
2124 /* */
2125 /* If the @FT_OPEN_DRIVER bit is set, @FT_Open_Face only tries to */
2126 /* open the file with the driver whose handler is in `driver'. */
2127 /* */
2128 /* If the @FT_OPEN_PARAMS bit is set, the parameters given by */
2129 /* `num_params' and `params' is used. They are ignored otherwise. */
2130 /* */
2131 /* Ideally, both the `pathname' and `params' fields should be tagged */
2132 /* as `const'; this is missing for API backward compatibility. In */
2133 /* other words, applications should treat them as read-only. */
2134 /* */
2135 typedef struct FT_Open_Args_
2136 {
2145
2147
2148
2149 /*************************************************************************/
2150 /* */
2151 /* <Function> */
2152 /* FT_New_Face */
2153 /* */
2154 /* <Description> */
2155 /* Call @FT_Open_Face to open a font by its pathname. */
2156 /* */
2157 /* <InOut> */
2158 /* library :: A handle to the library resource. */
2159 /* */
2160 /* <Input> */
2161 /* pathname :: A path to the font file. */
2162 /* */
2163 /* face_index :: See @FT_Open_Face for a detailed description of this */
2164 /* parameter. */
2165 /* */
2166 /* <Output> */
2167 /* aface :: A handle to a new face object. If `face_index' is */
2168 /* greater than or equal to zero, it must be non-NULL. */
2169 /* */
2170 /* <Return> */
2171 /* FreeType error code. 0~means success. */
2172 /* */
2173 /* <Note> */
2174 /* Use @FT_Done_Face to destroy the created @FT_Face object (along */
2175 /* with its slot and sizes). */
2176 /* */
2179 const char* filepathname,
2180 FT_Long face_index,
2181 FT_Face *aface );
2182
2183
2184 /*************************************************************************/
2185 /* */
2186 /* <Function> */
2187 /* FT_New_Memory_Face */
2188 /* */
2189 /* <Description> */
2190 /* Call @FT_Open_Face to open a font that has been loaded into */
2191 /* memory. */
2192 /* */
2193 /* <InOut> */
2194 /* library :: A handle to the library resource. */
2195 /* */
2196 /* <Input> */
2197 /* file_base :: A pointer to the beginning of the font data. */
2198 /* */
2199 /* file_size :: The size of the memory chunk used by the font data. */
2200 /* */
2201 /* face_index :: See @FT_Open_Face for a detailed description of this */
2202 /* parameter. */
2203 /* */
2204 /* <Output> */
2205 /* aface :: A handle to a new face object. If `face_index' is */
2206 /* greater than or equal to zero, it must be non-NULL. */
2207 /* */
2208 /* <Return> */
2209 /* FreeType error code. 0~means success. */
2210 /* */
2211 /* <Note> */
2212 /* You must not deallocate the memory before calling @FT_Done_Face. */
2213 /* */
2216 const FT_Byte* file_base,
2218 FT_Long face_index,
2219 FT_Face *aface );
2220
2221
2222 /*************************************************************************/
2223 /* */
2224 /* <Function> */
2225 /* FT_Open_Face */
2226 /* */
2227 /* <Description> */
2228 /* Create a face object from a given resource described by */
2229 /* @FT_Open_Args. */
2230 /* */
2231 /* <InOut> */
2232 /* library :: A handle to the library resource. */
2233 /* */
2234 /* <Input> */
2235 /* args :: A pointer to an `FT_Open_Args' structure that must */
2236 /* be filled by the caller. */
2237 /* */
2238 /* face_index :: This field holds two different values. Bits 0-15 */
2239 /* are the index of the face in the font file (starting */
2240 /* with value~0). Set it to~0 if there is only one */
2241 /* face in the font file. */
2242 /* */
2243 /* [Since 2.6.1] Bits 16-30 are relevant to GX and */
2244 /* OpenType variation fonts only, specifying the named */
2245 /* instance index for the current face index (starting */
2246 /* with value~1; value~0 makes FreeType ignore named */
2247 /* instances). For non-variation fonts, bits 16-30 are */
2248 /* ignored. Assuming that you want to access the third */
2249 /* named instance in face~4, `face_index' should be set */
2250 /* to 0x00030004. If you want to access face~4 without */
2251 /* variation handling, simply set `face_index' to */
2252 /* value~4. */
2253 /* */
2254 /* `FT_Open_Face' and its siblings can be used to */
2255 /* quickly check whether the font format of a given */
2256 /* font resource is supported by FreeType. In general, */
2257 /* if the `face_index' argument is negative, the */
2258 /* function's return value is~0 if the font format is */
2259 /* recognized, or non-zero otherwise. The function */
2260 /* allocates a more or less empty face handle in */
2261 /* `*aface' (if `aface' isn't NULL); the only two */
2262 /* useful fields in this special case are */
2263 /* `face->num_faces' and `face->style_flags'. For any */
2264 /* negative value of `face_index', `face->num_faces' */
2265 /* gives the number of faces within the font file. For */
2266 /* the negative value `-(N+1)' (with `N' a non-negative */
2267 /* 16-bit value), bits 16-30 in `face->style_flags' */
2268 /* give the number of named instances in face `N' if we */
2269 /* have a variation font (or zero otherwise). After */
2270 /* examination, the returned @FT_Face structure should */
2271 /* be deallocated with a call to @FT_Done_Face. */
2272 /* */
2273 /* <Output> */
2274 /* aface :: A handle to a new face object. If `face_index' is */
2275 /* greater than or equal to zero, it must be non-NULL. */
2276 /* */
2277 /* <Return> */
2278 /* FreeType error code. 0~means success. */
2279 /* */
2280 /* <Note> */
2281 /* Unlike FreeType 1.x, this function automatically creates a glyph */
2282 /* slot for the face object that can be accessed directly through */
2283 /* `face->glyph'. */
2284 /* */
2285 /* Each new face object created with this function also owns a */
2286 /* default @FT_Size object, accessible as `face->size'. */
2287 /* */
2288 /* One @FT_Library instance can have multiple face objects, this is, */
2289 /* @FT_Open_Face and its siblings can be called multiple times using */
2290 /* the same `library' argument. */
2291 /* */
2292 /* See the discussion of reference counters in the description of */
2293 /* @FT_Reference_Face. */
2294 /* */
2295 /* To loop over all faces, use code similar to the following snippet */
2296 /* (omitting the error handling). */
2297 /* */
2298 /* { */
2299 /* ... */
2300 /* FT_Face face; */
2301 /* FT_Long i, num_faces; */
2302 /* */
2303 /* */
2304 /* error = FT_Open_Face( library, args, -1, &face ); */
2305 /* if ( error ) { ... } */
2306 /* */
2307 /* num_faces = face->num_faces; */
2308 /* FT_Done_Face( face ); */
2309 /* */
2310 /* for ( i = 0; i < num_faces; i++ ) */
2311 /* { */
2312 /* ... */
2313 /* error = FT_Open_Face( library, args, i, &face ); */
2314 /* ... */
2315 /* FT_Done_Face( face ); */
2316 /* ... */
2317 /* } */
2318 /* } */
2319 /* */
2320 /* To loop over all valid values for `face_index', use something */
2321 /* similar to the following snippet, again without error handling. */
2322 /* The code accesses all faces immediately (thus only a single call */
2323 /* of `FT_Open_Face' within the do-loop), with and without named */
2324 /* instances. */
2325 /* */
2326 /* { */
2327 /* ... */
2328 /* FT_Face face; */
2329 /* */
2330 /* FT_Long num_faces = 0; */
2331 /* FT_Long num_instances = 0; */
2332 /* */
2333 /* FT_Long face_idx = 0; */
2334 /* FT_Long instance_idx = 0; */
2335 /* */
2336 /* */
2337 /* do */
2338 /* { */
2339 /* FT_Long id = ( instance_idx << 16 ) + face_idx; */
2340 /* */
2341 /* */
2342 /* error = FT_Open_Face( library, args, id, &face ); */
2343 /* if ( error ) { ... } */
2344 /* */
2345 /* num_faces = face->num_faces; */
2346 /* num_instances = face->style_flags >> 16; */
2347 /* */
2348 /* ... */
2349 /* */
2350 /* FT_Done_Face( face ); */
2351 /* */
2352 /* if ( instance_idx < num_instances ) */
2353 /* instance_idx++; */
2354 /* else */
2355 /* { */
2356 /* face_idx++; */
2357 /* instance_idx = 0; */
2358 /* } */
2359 /* */
2360 /* } while ( face_idx < num_faces ) */
2361 /* } */
2362 /* */
2365 const FT_Open_Args* args,
2366 FT_Long face_index,
2367 FT_Face *aface );
2368
2369
2370 /*************************************************************************/
2371 /* */
2372 /* <Function> */
2373 /* FT_Attach_File */
2374 /* */
2375 /* <Description> */
2376 /* Call @FT_Attach_Stream to attach a file. */
2377 /* */
2378 /* <InOut> */
2379 /* face :: The target face object. */
2380 /* */
2381 /* <Input> */
2382 /* filepathname :: The pathname. */
2383 /* */
2384 /* <Return> */
2385 /* FreeType error code. 0~means success. */
2386 /* */
2389 const char* filepathname );
2390
2391
2392 /*************************************************************************/
2393 /* */
2394 /* <Function> */
2395 /* FT_Attach_Stream */
2396 /* */
2397 /* <Description> */
2398 /* `Attach' data to a face object. Normally, this is used to read */
2399 /* additional information for the face object. For example, you can */
2400 /* attach an AFM file that comes with a Type~1 font to get the */
2401 /* kerning values and other metrics. */
2402 /* */
2403 /* <InOut> */
2404 /* face :: The target face object. */
2405 /* */
2406 /* <Input> */
2407 /* parameters :: A pointer to @FT_Open_Args that must be filled by */
2408 /* the caller. */
2409 /* */
2410 /* <Return> */
2411 /* FreeType error code. 0~means success. */
2412 /* */
2413 /* <Note> */
2414 /* The meaning of the `attach' (i.e., what really happens when the */
2415 /* new file is read) is not fixed by FreeType itself. It really */
2416 /* depends on the font format (and thus the font driver). */
2417 /* */
2418 /* Client applications are expected to know what they are doing */
2419 /* when invoking this function. Most drivers simply do not implement */
2420 /* file or stream attachments. */
2421 /* */
2424 FT_Open_Args* parameters );
2425
2426
2427 /*************************************************************************/
2428 /* */
2429 /* <Function> */
2430 /* FT_Reference_Face */
2431 /* */
2432 /* <Description> */
2433 /* A counter gets initialized to~1 at the time an @FT_Face structure */
2434 /* is created. This function increments the counter. @FT_Done_Face */
2435 /* then only destroys a face if the counter is~1, otherwise it simply */
2436 /* decrements the counter. */
2437 /* */
2438 /* This function helps in managing life-cycles of structures that */
2439 /* reference @FT_Face objects. */
2440 /* */
2441 /* <Input> */
2442 /* face :: A handle to a target face object. */
2443 /* */
2444 /* <Return> */
2445 /* FreeType error code. 0~means success. */
2446 /* */
2447 /* <Since> */
2448 /* 2.4.2 */
2449 /* */
2452
2453
2454 /*************************************************************************/
2455 /* */
2456 /* <Function> */
2457 /* FT_Done_Face */
2458 /* */
2459 /* <Description> */
2460 /* Discard a given face object, as well as all of its child slots and */
2461 /* sizes. */
2462 /* */
2463 /* <Input> */
2464 /* face :: A handle to a target face object. */
2465 /* */
2466 /* <Return> */
2467 /* FreeType error code. 0~means success. */
2468 /* */
2469 /* <Note> */
2470 /* See the discussion of reference counters in the description of */
2471 /* @FT_Reference_Face. */
2472 /* */
2475
2476
2477 /*************************************************************************/
2478 /* */
2479 /* <Function> */
2480 /* FT_Select_Size */
2481 /* */
2482 /* <Description> */
2483 /* Select a bitmap strike. To be more precise, this function sets */
2484 /* the scaling factors of the active @FT_Size object in a face so */
2485 /* that bitmaps from this particular strike are taken by */
2486 /* @FT_Load_Glyph and friends. */
2487 /* */
2488 /* <InOut> */
2489 /* face :: A handle to a target face object. */
2490 /* */
2491 /* <Input> */
2492 /* strike_index :: The index of the bitmap strike in the */
2493 /* `available_sizes' field of @FT_FaceRec structure. */
2494 /* */
2495 /* <Return> */
2496 /* FreeType error code. 0~means success. */
2497 /* */
2498 /* <Note> */
2499 /* For bitmaps embedded in outline fonts it is common that only a */
2500 /* subset of the available glyphs at a given ppem value is available. */
2501 /* FreeType silently uses outlines if there is no bitmap for a given */
2502 /* glyph index. */
2503 /* */
2504 /* For GX and OpenType variation fonts, a bitmap strike makes sense */
2505 /* only if the default instance is active (this is, no glyph */
2506 /* variation takes place); otherwise, FreeType simply ignores bitmap */
2507 /* strikes. The same is true for all named instances that are */
2508 /* different from the default instance. */
2509 /* */
2510 /* Don't use this function if you are using the FreeType cache API. */
2511 /* */
2514 FT_Int strike_index );
2515
2516
2517 /*************************************************************************/
2518 /* */
2519 /* <Enum> */
2520 /* FT_Size_Request_Type */
2521 /* */
2522 /* <Description> */
2523 /* An enumeration type that lists the supported size request types, */
2524 /* i.e., what input size (in font units) maps to the requested output */
2525 /* size (in pixels, as computed from the arguments of */
2526 /* @FT_Size_Request). */
2527 /* */
2528 /* <Values> */
2529 /* FT_SIZE_REQUEST_TYPE_NOMINAL :: */
2530 /* The nominal size. The `units_per_EM' field of @FT_FaceRec is */
2531 /* used to determine both scaling values. */
2532 /* */
2533 /* This is the standard scaling found in most applications. In */
2534 /* particular, use this size request type for TrueType fonts if */
2535 /* they provide optical scaling or something similar. Note, */
2536 /* however, that `units_per_EM' is a rather abstract value which */
2537 /* bears no relation to the actual size of the glyphs in a font. */
2538 /* */
2539 /* FT_SIZE_REQUEST_TYPE_REAL_DIM :: */
2540 /* The real dimension. The sum of the `ascender' and (minus of) */
2541 /* the `descender' fields of @FT_FaceRec is used to determine both */
2542 /* scaling values. */
2543 /* */
2544 /* FT_SIZE_REQUEST_TYPE_BBOX :: */
2545 /* The font bounding box. The width and height of the `bbox' field */
2546 /* of @FT_FaceRec are used to determine the horizontal and vertical */
2547 /* scaling value, respectively. */
2548 /* */
2549 /* FT_SIZE_REQUEST_TYPE_CELL :: */
2550 /* The `max_advance_width' field of @FT_FaceRec is used to */
2551 /* determine the horizontal scaling value; the vertical scaling */
2552 /* value is determined the same way as */
2553 /* @FT_SIZE_REQUEST_TYPE_REAL_DIM does. Finally, both scaling */
2554 /* values are set to the smaller one. This type is useful if you */
2555 /* want to specify the font size for, say, a window of a given */
2556 /* dimension and 80x24 cells. */
2557 /* */
2558 /* FT_SIZE_REQUEST_TYPE_SCALES :: */
2559 /* Specify the scaling values directly. */
2560 /* */
2561 /* <Note> */
2562 /* The above descriptions only apply to scalable formats. For bitmap */
2563 /* formats, the behaviour is up to the driver. */
2564 /* */
2565 /* See the note section of @FT_Size_Metrics if you wonder how size */
2566 /* requesting relates to scaling values. */
2567 /* */
2569 {
2575
2577
2579
2580
2581 /*************************************************************************/
2582 /* */
2583 /* <Struct> */
2584 /* FT_Size_RequestRec */
2585 /* */
2586 /* <Description> */
2587 /* A structure to model a size request. */
2588 /* */
2589 /* <Fields> */
2590 /* type :: See @FT_Size_Request_Type. */
2591 /* */
2592 /* width :: The desired width, given as a 26.6 fractional */
2593 /* point value (with 72pt = 1in). */
2594 /* */
2595 /* height :: The desired height, given as a 26.6 fractional */
2596 /* point value (with 72pt = 1in). */
2597 /* */
2598 /* horiResolution :: The horizontal resolution (dpi, i.e., pixels per */
2599 /* inch). If set to zero, `width' is treated as a */
2600 /* 26.6 fractional *pixel* value, which gets */
2601 /* internally rounded to an integer. */
2602 /* */
2603 /* vertResolution :: The vertical resolution (dpi, i.e., pixels per */
2604 /* inch). If set to zero, `height' is treated as a */
2605 /* 26.6 fractional *pixel* value, which gets */
2606 /* internally rounded to an integer. */
2607 /* */
2608 /* <Note> */
2609 /* If `width' is zero, the horizontal scaling value is set equal */
2610 /* to the vertical scaling value, and vice versa. */
2611 /* */
2612 /* If `type' is FT_SIZE_REQUEST_TYPE_SCALES, `width' and `height' are */
2613 /* interpreted directly as 16.16 fractional scaling values, without */
2614 /* any further modification, and both `horiResolution' and */
2615 /* `vertResolution' are ignored. */
2616 /* */
2617 typedef struct FT_Size_RequestRec_
2618 {
2624
2626
2627
2628 /*************************************************************************/
2629 /* */
2630 /* <Struct> */
2631 /* FT_Size_Request */
2632 /* */
2633 /* <Description> */
2634 /* A handle to a size request structure. */
2635 /* */
2637
2638
2639 /*************************************************************************/
2640 /* */
2641 /* <Function> */
2642 /* FT_Request_Size */
2643 /* */
2644 /* <Description> */
2645 /* Resize the scale of the active @FT_Size object in a face. */
2646 /* */
2647 /* <InOut> */
2648 /* face :: A handle to a target face object. */
2649 /* */
2650 /* <Input> */
2651 /* req :: A pointer to a @FT_Size_RequestRec. */
2652 /* */
2653 /* <Return> */
2654 /* FreeType error code. 0~means success. */
2655 /* */
2656 /* <Note> */
2657 /* Although drivers may select the bitmap strike matching the */
2658 /* request, you should not rely on this if you intend to select a */
2659 /* particular bitmap strike. Use @FT_Select_Size instead in that */
2660 /* case. */
2661 /* */
2662 /* The relation between the requested size and the resulting glyph */
2663 /* size is dependent entirely on how the size is defined in the */
2664 /* source face. The font designer chooses the final size of each */
2665 /* glyph relative to this size. For more information refer to */
2666 /* `https://www.freetype.org/freetype2/docs/glyphs/glyphs-2.html'. */
2667 /* */
2668 /* Contrary to @FT_Set_Char_Size, this function doesn't have special */
2669 /* code to normalize zero-valued widths, heights, or resolutions */
2670 /* (which lead to errors in most cases). */
2671 /* */
2672 /* Don't use this function if you are using the FreeType cache API. */
2673 /* */
2676 FT_Size_Request req );
2677
2678
2679 /*************************************************************************/
2680 /* */
2681 /* <Function> */
2682 /* FT_Set_Char_Size */
2683 /* */
2684 /* <Description> */
2685 /* Call @FT_Request_Size to request the nominal size (in points). */
2686 /* */
2687 /* <InOut> */
2688 /* face :: A handle to a target face object. */
2689 /* */
2690 /* <Input> */
2691 /* char_width :: The nominal width, in 26.6 fractional points. */
2692 /* */
2693 /* char_height :: The nominal height, in 26.6 fractional points. */
2694 /* */
2695 /* horz_resolution :: The horizontal resolution in dpi. */
2696 /* */
2697 /* vert_resolution :: The vertical resolution in dpi. */
2698 /* */
2699 /* <Return> */
2700 /* FreeType error code. 0~means success. */
2701 /* */
2702 /* <Note> */
2703 /* While this function allows fractional points as input values, the */
2704 /* resulting ppem value for the given resolution is always rounded to */
2705 /* the nearest integer. */
2706 /* */
2707 /* If either the character width or height is zero, it is set equal */
2708 /* to the other value. */
2709 /* */
2710 /* If either the horizontal or vertical resolution is zero, it is set */
2711 /* equal to the other value. */
2712 /* */
2713 /* A character width or height smaller than 1pt is set to 1pt; if */
2714 /* both resolution values are zero, they are set to 72dpi. */
2715 /* */
2716 /* Don't use this function if you are using the FreeType cache API. */
2717 /* */
2720 FT_F26Dot6 char_width,
2721 FT_F26Dot6 char_height,
2722 FT_UInt horz_resolution,
2723 FT_UInt vert_resolution );
2724
2725
2726 /*************************************************************************/
2727 /* */
2728 /* <Function> */
2729 /* FT_Set_Pixel_Sizes */
2730 /* */
2731 /* <Description> */
2732 /* Call @FT_Request_Size to request the nominal size (in pixels). */
2733 /* */
2734 /* <InOut> */
2735 /* face :: A handle to the target face object. */
2736 /* */
2737 /* <Input> */
2738 /* pixel_width :: The nominal width, in pixels. */
2739 /* */
2740 /* pixel_height :: The nominal height, in pixels. */
2741 /* */
2742 /* <Return> */
2743 /* FreeType error code. 0~means success. */
2744 /* */
2745 /* <Note> */
2746 /* You should not rely on the resulting glyphs matching or being */
2747 /* constrained to this pixel size. Refer to @FT_Request_Size to */
2748 /* understand how requested sizes relate to actual sizes. */
2749 /* */
2750 /* Don't use this function if you are using the FreeType cache API. */
2751 /* */
2754 FT_UInt pixel_width,
2755 FT_UInt pixel_height );
2756
2757
2758 /*************************************************************************/
2759 /* */
2760 /* <Function> */
2761 /* FT_Load_Glyph */
2762 /* */
2763 /* <Description> */
2764 /* Load a glyph into the glyph slot of a face object. */
2765 /* */
2766 /* <InOut> */
2767 /* face :: A handle to the target face object where the glyph */
2768 /* is loaded. */
2769 /* */
2770 /* <Input> */
2771 /* glyph_index :: The index of the glyph in the font file. For */
2772 /* CID-keyed fonts (either in PS or in CFF format) */
2773 /* this argument specifies the CID value. */
2774 /* */
2775 /* load_flags :: A flag indicating what to load for this glyph. The */
2776 /* @FT_LOAD_XXX constants can be used to control the */
2777 /* glyph loading process (e.g., whether the outline */
2778 /* should be scaled, whether to load bitmaps or not, */
2779 /* whether to hint the outline, etc). */
2780 /* */
2781 /* <Return> */
2782 /* FreeType error code. 0~means success. */
2783 /* */
2784 /* <Note> */
2785 /* The loaded glyph may be transformed. See @FT_Set_Transform for */
2786 /* the details. */
2787 /* */
2788 /* For subsetted CID-keyed fonts, `FT_Err_Invalid_Argument' is */
2789 /* returned for invalid CID values (this is, for CID values that */
2790 /* don't have a corresponding glyph in the font). See the discussion */
2791 /* of the @FT_FACE_FLAG_CID_KEYED flag for more details. */
2792 /* */
2793 /* If you receive `FT_Err_Glyph_Too_Big', try getting the glyph */
2794 /* outline at EM size, then scale it manually and fill it as a */
2795 /* graphics operation. */
2796 /* */
2799 FT_UInt glyph_index,
2800 FT_Int32 load_flags );
2801
2802
2803 /*************************************************************************/
2804 /* */
2805 /* <Function> */
2806 /* FT_Load_Char */
2807 /* */
2808 /* <Description> */
2809 /* Load a glyph into the glyph slot of a face object, accessed by its */
2810 /* character code. */
2811 /* */
2812 /* <InOut> */
2813 /* face :: A handle to a target face object where the glyph */
2814 /* is loaded. */
2815 /* */
2816 /* <Input> */
2817 /* char_code :: The glyph's character code, according to the */
2818 /* current charmap used in the face. */
2819 /* */
2820 /* load_flags :: A flag indicating what to load for this glyph. The */
2821 /* @FT_LOAD_XXX constants can be used to control the */
2822 /* glyph loading process (e.g., whether the outline */
2823 /* should be scaled, whether to load bitmaps or not, */
2824 /* whether to hint the outline, etc). */
2825 /* */
2826 /* <Return> */
2827 /* FreeType error code. 0~means success. */
2828 /* */
2829 /* <Note> */
2830 /* This function simply calls @FT_Get_Char_Index and @FT_Load_Glyph. */
2831 /* */
2832 /* Many fonts contain glyphs that can't be loaded by this function */
2833 /* since its glyph indices are not listed in any of the font's */
2834 /* charmaps. */
2835 /* */
2838 FT_ULong char_code,
2839 FT_Int32 load_flags );
2840
2841
2842 /*************************************************************************
2843 *
2844 * @enum:
2845 * FT_LOAD_XXX
2846 *
2847 * @description:
2848 * A list of bit field constants for @FT_Load_Glyph to indicate what
2849 * kind of operations to perform during glyph loading.
2850 *
2851 * @values:
2852 * FT_LOAD_DEFAULT ::
2853 * Corresponding to~0, this value is used as the default glyph load
2854 * operation. In this case, the following happens:
2855 *
2856 * 1. FreeType looks for a bitmap for the glyph corresponding to the
2857 * face's current size. If one is found, the function returns.
2858 * The bitmap data can be accessed from the glyph slot (see note
2859 * below).
2860 *
2861 * 2. If no embedded bitmap is searched for or found, FreeType looks
2862 * for a scalable outline. If one is found, it is loaded from
2863 * the font file, scaled to device pixels, then `hinted' to the
2864 * pixel grid in order to optimize it. The outline data can be
2865 * accessed from the glyph slot (see note below).
2866 *
2867 * Note that by default the glyph loader doesn't render outlines into
2868 * bitmaps. The following flags are used to modify this default
2869 * behaviour to more specific and useful cases.
2870 *
2871 * FT_LOAD_NO_SCALE ::
2872 * Don't scale the loaded outline glyph but keep it in font units.
2873 *
2874 * This flag implies @FT_LOAD_NO_HINTING and @FT_LOAD_NO_BITMAP, and
2875 * unsets @FT_LOAD_RENDER.
2876 *
2877 * If the font is `tricky' (see @FT_FACE_FLAG_TRICKY for more), using
2878 * FT_LOAD_NO_SCALE usually yields meaningless outlines because the
2879 * subglyphs must be scaled and positioned with hinting instructions.
2880 * This can be solved by loading the font without FT_LOAD_NO_SCALE and
2881 * setting the character size to `font->units_per_EM'.
2882 *
2883 * FT_LOAD_NO_HINTING ::
2884 * Disable hinting. This generally generates `blurrier' bitmap glyphs
2885 * when the glyph are rendered in any of the anti-aliased modes. See
2886 * also the note below.
2887 *
2888 * This flag is implied by @FT_LOAD_NO_SCALE.
2889 *
2890 * FT_LOAD_RENDER ::
2891 * Call @FT_Render_Glyph after the glyph is loaded. By default, the
2892 * glyph is rendered in @FT_RENDER_MODE_NORMAL mode. This can be
2893 * overridden by @FT_LOAD_TARGET_XXX or @FT_LOAD_MONOCHROME.
2894 *
2895 * This flag is unset by @FT_LOAD_NO_SCALE.
2896 *
2897 * FT_LOAD_NO_BITMAP ::
2898 * Ignore bitmap strikes when loading. Bitmap-only fonts ignore this
2899 * flag.
2900 *
2901 * @FT_LOAD_NO_SCALE always sets this flag.
2902 *
2903 * FT_LOAD_VERTICAL_LAYOUT ::
2904 * Load the glyph for vertical text layout. In particular, the
2905 * `advance' value in the @FT_GlyphSlotRec structure is set to the
2906 * `vertAdvance' value of the `metrics' field.
2907 *
2908 * In case @FT_HAS_VERTICAL doesn't return true, you shouldn't use
2909 * this flag currently. Reason is that in this case vertical metrics
2910 * get synthesized, and those values are not always consistent across
2911 * various font formats.
2912 *
2913 * FT_LOAD_FORCE_AUTOHINT ::
2914 * Prefer the auto-hinter over the font's native hinter. See also
2915 * the note below.
2916 *
2917 * FT_LOAD_PEDANTIC ::
2918 * Make the font driver perform pedantic verifications during glyph
2919 * loading. This is mostly used to detect broken glyphs in fonts.
2920 * By default, FreeType tries to handle broken fonts also.
2921 *
2922 * In particular, errors from the TrueType bytecode engine are not
2923 * passed to the application if this flag is not set; this might
2924 * result in partially hinted or distorted glyphs in case a glyph's
2925 * bytecode is buggy.
2926 *
2927 * FT_LOAD_NO_RECURSE ::
2928 * Don't load composite glyphs recursively. Instead, the font
2929 * driver should set the `num_subglyph' and `subglyphs' values of
2930 * the glyph slot accordingly, and set `glyph->format' to
2931 * @FT_GLYPH_FORMAT_COMPOSITE. The description of subglyphs can
2932 * then be accessed with @FT_Get_SubGlyph_Info.
2933 *
2934 * This flag implies @FT_LOAD_NO_SCALE and @FT_LOAD_IGNORE_TRANSFORM.
2935 *
2936 * FT_LOAD_IGNORE_TRANSFORM ::
2937 * Ignore the transform matrix set by @FT_Set_Transform.
2938 *
2939 * FT_LOAD_MONOCHROME ::
2940 * This flag is used with @FT_LOAD_RENDER to indicate that you want to
2941 * render an outline glyph to a 1-bit monochrome bitmap glyph, with
2942 * 8~pixels packed into each byte of the bitmap data.
2943 *
2944 * Note that this has no effect on the hinting algorithm used. You
2945 * should rather use @FT_LOAD_TARGET_MONO so that the
2946 * monochrome-optimized hinting algorithm is used.
2947 *
2948 * FT_LOAD_LINEAR_DESIGN ::
2949 * Keep `linearHoriAdvance' and `linearVertAdvance' fields of
2950 * @FT_GlyphSlotRec in font units. See @FT_GlyphSlotRec for
2951 * details.
2952 *
2953 * FT_LOAD_NO_AUTOHINT ::
2954 * Disable the auto-hinter. See also the note below.
2955 *
2956 * FT_LOAD_COLOR ::
2957 * [Since 2.5] Load embedded color bitmap images. The resulting color
2958 * bitmaps, if available, will have the @FT_PIXEL_MODE_BGRA format.
2959 * If the flag is not set and color bitmaps are found, they are
2960 * converted to 256-level gray bitmaps transparently, using the
2961 * @FT_PIXEL_MODE_GRAY format.
2962 *
2963 * FT_LOAD_COMPUTE_METRICS ::
2964 * [Since 2.6.1] Compute glyph metrics from the glyph data, without
2965 * the use of bundled metrics tables (for example, the `hdmx' table in
2966 * TrueType fonts). This flag is mainly used by font validating or
2967 * font editing applications, which need to ignore, verify, or edit
2968 * those tables.
2969 *
2970 * Currently, this flag is only implemented for TrueType fonts.
2971 *
2972 * FT_LOAD_BITMAP_METRICS_ONLY ::
2973 * [Since 2.7.1] Request loading of the metrics and bitmap image
2974 * information of a (possibly embedded) bitmap glyph without
2975 * allocating or copying the bitmap image data itself. No effect if
2976 * the target glyph is not a bitmap image.
2977 *
2978 * This flag unsets @FT_LOAD_RENDER.
2979 *
2980 * FT_LOAD_CROP_BITMAP ::
2981 * Ignored. Deprecated.
2982 *
2983 * FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH ::
2984 * Ignored. Deprecated.
2985 *
2986 * @note:
2987 * By default, hinting is enabled and the font's native hinter (see
2988 * @FT_FACE_FLAG_HINTER) is preferred over the auto-hinter. You can
2989 * disable hinting by setting @FT_LOAD_NO_HINTING or change the
2990 * precedence by setting @FT_LOAD_FORCE_AUTOHINT. You can also set
2991 * @FT_LOAD_NO_AUTOHINT in case you don't want the auto-hinter to be
2992 * used at all.
2993 *
2994 * See the description of @FT_FACE_FLAG_TRICKY for a special exception
2995 * (affecting only a handful of Asian fonts).
2996 *
2997 * Besides deciding which hinter to use, you can also decide which
2998 * hinting algorithm to use. See @FT_LOAD_TARGET_XXX for details.
2999 *
3000 * Note that the auto-hinter needs a valid Unicode cmap (either a native
3001 * one or synthesized by FreeType) for producing correct results. If a
3002 * font provides an incorrect mapping (for example, assigning the
3003 * character code U+005A, LATIN CAPITAL LETTER Z, to a glyph depicting a
3004 * mathematical integral sign), the auto-hinter might produce useless
3005 * results.
3006 *
3007 */
3008#define FT_LOAD_DEFAULT 0x0
3009#define FT_LOAD_NO_SCALE ( 1L << 0 )
3010#define FT_LOAD_NO_HINTING ( 1L << 1 )
3011#define FT_LOAD_RENDER ( 1L << 2 )
3012#define FT_LOAD_NO_BITMAP ( 1L << 3 )
3013#define FT_LOAD_VERTICAL_LAYOUT ( 1L << 4 )
3014#define FT_LOAD_FORCE_AUTOHINT ( 1L << 5 )
3015#define FT_LOAD_CROP_BITMAP ( 1L << 6 )
3016#define FT_LOAD_PEDANTIC ( 1L << 7 )
3017#define FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH ( 1L << 9 )
3018#define FT_LOAD_NO_RECURSE ( 1L << 10 )
3019#define FT_LOAD_IGNORE_TRANSFORM ( 1L << 11 )
3020#define FT_LOAD_MONOCHROME ( 1L << 12 )
3021#define FT_LOAD_LINEAR_DESIGN ( 1L << 13 )
3022#define FT_LOAD_NO_AUTOHINT ( 1L << 15 )
3023 /* Bits 16-19 are used by `FT_LOAD_TARGET_' */
3024#define FT_LOAD_COLOR ( 1L << 20 )
3025#define FT_LOAD_COMPUTE_METRICS ( 1L << 21 )
3026#define FT_LOAD_BITMAP_METRICS_ONLY ( 1L << 22 )
3027
3028 /* */
3029
3030 /* used internally only by certain font drivers */
3031#define FT_LOAD_ADVANCE_ONLY ( 1L << 8 )
3032#define FT_LOAD_SBITS_ONLY ( 1L << 14 )
3033
3034
3035 /**************************************************************************
3036 *
3037 * @enum:
3038 * FT_LOAD_TARGET_XXX
3039 *
3040 * @description:
3041 * A list of values to select a specific hinting algorithm for the
3042 * hinter. You should OR one of these values to your `load_flags'
3043 * when calling @FT_Load_Glyph.
3044 *
3045 * Note that a font's native hinters may ignore the hinting algorithm
3046 * you have specified (e.g., the TrueType bytecode interpreter). You
3047 * can set @FT_LOAD_FORCE_AUTOHINT to ensure that the auto-hinter is
3048 * used.
3049 *
3050 * @values:
3051 * FT_LOAD_TARGET_NORMAL ::
3052 * The default hinting algorithm, optimized for standard gray-level
3053 * rendering. For monochrome output, use @FT_LOAD_TARGET_MONO
3054 * instead.
3055 *
3056 * FT_LOAD_TARGET_LIGHT ::
3057 * A lighter hinting algorithm for gray-level modes. Many generated
3058 * glyphs are fuzzier but better resemble their original shape. This
3059 * is achieved by snapping glyphs to the pixel grid only vertically
3060 * (Y-axis), as is done by FreeType's new CFF engine or Microsoft's
3061 * ClearType font renderer. This preserves inter-glyph spacing in
3062 * horizontal text. The snapping is done either by the native font
3063 * driver, if the driver itself and the font support it, or by the
3064 * auto-hinter.
3065 *
3066 * Advance widths are rounded to integer values; however, using the
3067 * `lsb_delta' and `rsb_delta' fields of @FT_GlyphSlotRec, it is
3068 * possible to get fractional advance widths for sub-pixel positioning
3069 * (which is recommended to use).
3070 *
3071 * If configuration option AF_CONFIG_OPTION_TT_SIZE_METRICS is active,
3072 * TrueType-like metrics are used to make this mode behave similarly
3073 * as in unpatched FreeType versions between 2.4.6 and 2.7.1
3074 * (inclusive).
3075 *
3076 * FT_LOAD_TARGET_MONO ::
3077 * Strong hinting algorithm that should only be used for monochrome
3078 * output. The result is probably unpleasant if the glyph is rendered
3079 * in non-monochrome modes.
3080 *
3081 * FT_LOAD_TARGET_LCD ::
3082 * A variant of @FT_LOAD_TARGET_LIGHT optimized for horizontally
3083 * decimated LCD displays.
3084 *
3085 * FT_LOAD_TARGET_LCD_V ::
3086 * A variant of @FT_LOAD_TARGET_NORMAL optimized for vertically
3087 * decimated LCD displays.
3088 *
3089 * @note:
3090 * You should use only _one_ of the FT_LOAD_TARGET_XXX values in your
3091 * `load_flags'. They can't be ORed.
3092 *
3093 * If @FT_LOAD_RENDER is also set, the glyph is rendered in the
3094 * corresponding mode (i.e., the mode that matches the used algorithm
3095 * best). An exception is FT_LOAD_TARGET_MONO since it implies
3096 * @FT_LOAD_MONOCHROME.
3097 *
3098 * You can use a hinting algorithm that doesn't correspond to the same
3099 * rendering mode. As an example, it is possible to use the `light'
3100 * hinting algorithm and have the results rendered in horizontal LCD
3101 * pixel mode, with code like
3102 *
3103 * {
3104 * FT_Load_Glyph( face, glyph_index,
3105 * load_flags | FT_LOAD_TARGET_LIGHT );
3106 *
3107 * FT_Render_Glyph( face->glyph, FT_RENDER_MODE_LCD );
3108 * }
3109 *
3110 * In general, you should stick with one rendering mode. For example,
3111 * switching between @FT_LOAD_TARGET_NORMAL and @FT_LOAD_TARGET_MONO
3112 * enforces a lot of recomputation for TrueType fonts, which is slow.
3113 * Another reason is caching: Selecting a different mode usually causes
3114 * changes in both the outlines and the rasterized bitmaps; it is thus
3115 * necessary to empty the cache after a mode switch to avoid false hits.
3116 *
3117 */
3118#define FT_LOAD_TARGET_( x ) ( (FT_Int32)( (x) & 15 ) << 16 )
3119
3120#define FT_LOAD_TARGET_NORMAL FT_LOAD_TARGET_( FT_RENDER_MODE_NORMAL )
3121#define FT_LOAD_TARGET_LIGHT FT_LOAD_TARGET_( FT_RENDER_MODE_LIGHT )
3122#define FT_LOAD_TARGET_MONO FT_LOAD_TARGET_( FT_RENDER_MODE_MONO )
3123#define FT_LOAD_TARGET_LCD FT_LOAD_TARGET_( FT_RENDER_MODE_LCD )
3124#define FT_LOAD_TARGET_LCD_V FT_LOAD_TARGET_( FT_RENDER_MODE_LCD_V )
3125
3126
3127 /**************************************************************************
3128 *
3129 * @macro:
3130 * FT_LOAD_TARGET_MODE
3131 *
3132 * @description:
3133 * Return the @FT_Render_Mode corresponding to a given
3134 * @FT_LOAD_TARGET_XXX value.
3135 *
3136 */
3137#define FT_LOAD_TARGET_MODE( x ) ( (FT_Render_Mode)( ( (x) >> 16 ) & 15 ) )
3138
3139
3140 /*************************************************************************/
3141 /* */
3142 /* <Function> */
3143 /* FT_Set_Transform */
3144 /* */
3145 /* <Description> */
3146 /* Set the transformation that is applied to glyph images when they */
3147 /* are loaded into a glyph slot through @FT_Load_Glyph. */
3148 /* */
3149 /* <InOut> */
3150 /* face :: A handle to the source face object. */
3151 /* */
3152 /* <Input> */
3153 /* matrix :: A pointer to the transformation's 2x2 matrix. Use NULL */
3154 /* for the identity matrix. */
3155 /* delta :: A pointer to the translation vector. Use NULL for the */
3156 /* null vector. */
3157 /* */
3158 /* <Note> */
3159 /* The transformation is only applied to scalable image formats after */
3160 /* the glyph has been loaded. It means that hinting is unaltered by */
3161 /* the transformation and is performed on the character size given in */
3162 /* the last call to @FT_Set_Char_Size or @FT_Set_Pixel_Sizes. */
3163 /* */
3164 /* Note that this also transforms the `face.glyph.advance' field, but */
3165 /* *not* the values in `face.glyph.metrics'. */
3166 /* */
3167 FT_EXPORT( void )
3170 FT_Vector* delta );
3171
3172
3173 /*************************************************************************/
3174 /* */
3175 /* <Enum> */
3176 /* FT_Render_Mode */
3177 /* */
3178 /* <Description> */
3179 /* Render modes supported by FreeType~2. Each mode corresponds to a */
3180 /* specific type of scanline conversion performed on the outline. */
3181 /* */
3182 /* For bitmap fonts and embedded bitmaps the `bitmap->pixel_mode' */
3183 /* field in the @FT_GlyphSlotRec structure gives the format of the */
3184 /* returned bitmap. */
3185 /* */
3186 /* All modes except @FT_RENDER_MODE_MONO use 256 levels of opacity, */
3187 /* indicating pixel coverage. Use linear alpha blending and gamma */
3188 /* correction to correctly render non-monochrome glyph bitmaps onto a */
3189 /* surface; see @FT_Render_Glyph. */
3190 /* */
3191 /* <Values> */
3192 /* FT_RENDER_MODE_NORMAL :: */
3193 /* Default render mode; it corresponds to 8-bit anti-aliased */
3194 /* bitmaps. */
3195 /* */
3196 /* FT_RENDER_MODE_LIGHT :: */
3197 /* This is equivalent to @FT_RENDER_MODE_NORMAL. It is only */
3198 /* defined as a separate value because render modes are also used */
3199 /* indirectly to define hinting algorithm selectors. See */
3200 /* @FT_LOAD_TARGET_XXX for details. */
3201 /* */
3202 /* FT_RENDER_MODE_MONO :: */
3203 /* This mode corresponds to 1-bit bitmaps (with 2~levels of */
3204 /* opacity). */
3205 /* */
3206 /* FT_RENDER_MODE_LCD :: */
3207 /* This mode corresponds to horizontal RGB and BGR sub-pixel */
3208 /* displays like LCD screens. It produces 8-bit bitmaps that are */
3209 /* 3~times the width of the original glyph outline in pixels, and */
3210 /* which use the @FT_PIXEL_MODE_LCD mode. */
3211 /* */
3212 /* FT_RENDER_MODE_LCD_V :: */
3213 /* This mode corresponds to vertical RGB and BGR sub-pixel displays */
3214 /* (like PDA screens, rotated LCD displays, etc.). It produces */
3215 /* 8-bit bitmaps that are 3~times the height of the original */
3216 /* glyph outline in pixels and use the @FT_PIXEL_MODE_LCD_V mode. */
3217 /* */
3218 /* <Note> */
3219 /* Should you define FT_CONFIG_OPTION_SUBPIXEL_RENDERING in your */
3220 /* `ftoption.h', which enables patented ClearType-style rendering, */
3221 /* the LCD-optimized glyph bitmaps should be filtered to reduce color */
3222 /* fringes inherent to this technology. You can either set up LCD */
3223 /* filtering with @FT_Library_SetLcdFilter or @FT_Face_Properties, */
3224 /* or do the filtering yourself. The default FreeType LCD rendering */
3225 /* technology does not require filtering. */
3226 /* */
3227 /* The selected render mode only affects vector glyphs of a font. */
3228 /* Embedded bitmaps often have a different pixel mode like */
3229 /* @FT_PIXEL_MODE_MONO. You can use @FT_Bitmap_Convert to transform */
3230 /* them into 8-bit pixmaps. */
3231 /* */
3232 typedef enum FT_Render_Mode_
3233 {
3239
3241
3243
3244
3245 /* these constants are deprecated; use the corresponding */
3246 /* `FT_Render_Mode' values instead */
3247#define ft_render_mode_normal FT_RENDER_MODE_NORMAL
3248#define ft_render_mode_mono FT_RENDER_MODE_MONO
3249
3250
3251 /*************************************************************************/
3252 /* */
3253 /* <Function> */
3254 /* FT_Render_Glyph */
3255 /* */
3256 /* <Description> */
3257 /* Convert a given glyph image to a bitmap. It does so by inspecting */
3258 /* the glyph image format, finding the relevant renderer, and */
3259 /* invoking it. */
3260 /* */
3261 /* <InOut> */
3262 /* slot :: A handle to the glyph slot containing the image to */
3263 /* convert. */
3264 /* */
3265 /* <Input> */
3266 /* render_mode :: The render mode used to render the glyph image into */
3267 /* a bitmap. See @FT_Render_Mode for a list of */
3268 /* possible values. */
3269 /* */
3270 /* <Return> */
3271 /* FreeType error code. 0~means success. */
3272 /* */
3273 /* <Note> */
3274 /* To get meaningful results, font scaling values must be set with */
3275 /* functions like @FT_Set_Char_Size before calling `FT_Render_Glyph'. */
3276 /* */
3277 /* When FreeType outputs a bitmap of a glyph, it really outputs an */
3278 /* alpha coverage map. If a pixel is completely covered by a */
3279 /* filled-in outline, the bitmap contains 0xFF at that pixel, meaning */
3280 /* that 0xFF/0xFF fraction of that pixel is covered, meaning the */
3281 /* pixel is 100% black (or 0% bright). If a pixel is only 50% */
3282 /* covered (value 0x80), the pixel is made 50% black (50% bright or a */
3283 /* middle shade of grey). 0% covered means 0% black (100% bright or */
3284 /* white). */
3285 /* */
3286 /* On high-DPI screens like on smartphones and tablets, the pixels */
3287 /* are so small that their chance of being completely covered and */
3288 /* therefore completely black are fairly good. On the low-DPI */
3289 /* screens, however, the situation is different. The pixels are too */
3290 /* large for most of the details of a glyph and shades of gray are */
3291 /* the norm rather than the exception. */
3292 /* */
3293 /* This is relevant because all our screens have a second problem: */
3294 /* they are not linear. 1~+~1 is not~2. Twice the value does not */
3295 /* result in twice the brightness. When a pixel is only 50% covered, */
3296 /* the coverage map says 50% black, and this translates to a pixel */
3297 /* value of 128 when you use 8~bits per channel (0-255). However, */
3298 /* this does not translate to 50% brightness for that pixel on our */
3299 /* sRGB and gamma~2.2 screens. Due to their non-linearity, they */
3300 /* dwell longer in the darks and only a pixel value of about 186 */
3301 /* results in 50% brightness -- 128 ends up too dark on both bright */
3302 /* and dark backgrounds. The net result is that dark text looks */
3303 /* burnt-out, pixely and blotchy on bright background, bright text */
3304 /* too frail on dark backgrounds, and colored text on colored */
3305 /* background (for example, red on green) seems to have dark halos or */
3306 /* `dirt' around it. The situation is especially ugly for diagonal */
3307 /* stems like in `w' glyph shapes where the quality of FreeType's */
3308 /* anti-aliasing depends on the correct display of grays. On */
3309 /* high-DPI screens where smaller, fully black pixels reign supreme, */
3310 /* this doesn't matter, but on our low-DPI screens with all the gray */
3311 /* shades, it does. 0% and 100% brightness are the same things in */
3312 /* linear and non-linear space, just all the shades in-between */
3313 /* aren't. */
3314 /* */
3315 /* The blending function for placing text over a background is */
3316 /* */
3317 /* { */
3318 /* dst = alpha * src + (1 - alpha) * dst , */
3319 /* } */
3320 /* */
3321 /* which is known as the OVER operator. */
3322 /* */
3323 /* To correctly composite an antialiased pixel of a glyph onto a */
3324 /* surface, */
3325 /* */
3326 /* 1. take the foreground and background colors (e.g., in sRGB space) */
3327 /* and apply gamma to get them in a linear space, */
3328 /* */
3329 /* 2. use OVER to blend the two linear colors using the glyph pixel */
3330 /* as the alpha value (remember, the glyph bitmap is an alpha */
3331 /* coverage bitmap), and */
3332 /* */
3333 /* 3. apply inverse gamma to the blended pixel and write it back to */
3334 /* the image. */
3335 /* */
3336 /* Internal testing at Adobe found that a target inverse gamma of~1.8 */
3337 /* for step~3 gives good results across a wide range of displays with */
3338 /* an sRGB gamma curve or a similar one. */
3339 /* */
3340 /* This process can cost performance. There is an approximation that */
3341 /* does not need to know about the background color; see */
3342 /* https://bel.fi/alankila/lcd/ and */
3343 /* https://bel.fi/alankila/lcd/alpcor.html for details. */
3344 /* */
3345 /* *ATTENTION*: Linear blending is even more important when dealing */
3346 /* with subpixel-rendered glyphs to prevent color-fringing! A */
3347 /* subpixel-rendered glyph must first be filtered with a filter that */
3348 /* gives equal weight to the three color primaries and does not */
3349 /* exceed a sum of 0x100, see section @lcd_filtering. Then the */
3350 /* only difference to gray linear blending is that subpixel-rendered */
3351 /* linear blending is done 3~times per pixel: red foreground subpixel */
3352 /* to red background subpixel and so on for green and blue. */
3353 /* */
3356 FT_Render_Mode render_mode );
3357
3358
3359 /*************************************************************************/
3360 /* */
3361 /* <Enum> */
3362 /* FT_Kerning_Mode */
3363 /* */
3364 /* <Description> */
3365 /* An enumeration to specify the format of kerning values returned by */
3366 /* @FT_Get_Kerning. */
3367 /* */
3368 /* <Values> */
3369 /* FT_KERNING_DEFAULT :: Return grid-fitted kerning distances in */
3370 /* 26.6 fractional pixels. */
3371 /* */
3372 /* FT_KERNING_UNFITTED :: Return un-grid-fitted kerning distances in */
3373 /* 26.6 fractional pixels. */
3374 /* */
3375 /* FT_KERNING_UNSCALED :: Return the kerning vector in original font */
3376 /* units. */
3377 /* */
3378 /* <Note> */
3379 /* FT_KERNING_DEFAULT returns full pixel values; it also makes */
3380 /* FreeType heuristically scale down kerning distances at small ppem */
3381 /* values so that they don't become too big. */
3382 /* */
3383 /* Both FT_KERNING_DEFAULT and FT_KERNING_UNFITTED use the current */
3384 /* horizontal scaling factor (as set e.g. with @FT_Set_Char_Size) to */
3385 /* convert font units to pixels. */
3386 /* */
3387 typedef enum FT_Kerning_Mode_
3388 {
3392
3394
3395
3396 /* these constants are deprecated; use the corresponding */
3397 /* `FT_Kerning_Mode' values instead */
3398#define ft_kerning_default FT_KERNING_DEFAULT
3399#define ft_kerning_unfitted FT_KERNING_UNFITTED
3400#define ft_kerning_unscaled FT_KERNING_UNSCALED
3401
3402
3403 /*************************************************************************/
3404 /* */
3405 /* <Function> */
3406 /* FT_Get_Kerning */
3407 /* */
3408 /* <Description> */
3409 /* Return the kerning vector between two glyphs of the same face. */
3410 /* */
3411 /* <Input> */
3412 /* face :: A handle to a source face object. */
3413 /* */
3414 /* left_glyph :: The index of the left glyph in the kern pair. */
3415 /* */
3416 /* right_glyph :: The index of the right glyph in the kern pair. */
3417 /* */
3418 /* kern_mode :: See @FT_Kerning_Mode for more information. */
3419 /* Determines the scale and dimension of the returned */
3420 /* kerning vector. */
3421 /* */
3422 /* <Output> */
3423 /* akerning :: The kerning vector. This is either in font units, */
3424 /* fractional pixels (26.6 format), or pixels for */
3425 /* scalable formats, and in pixels for fixed-sizes */
3426 /* formats. */
3427 /* */
3428 /* <Return> */
3429 /* FreeType error code. 0~means success. */
3430 /* */
3431 /* <Note> */
3432 /* Only horizontal layouts (left-to-right & right-to-left) are */
3433 /* supported by this method. Other layouts, or more sophisticated */
3434 /* kernings, are out of the scope of this API function -- they can be */
3435 /* implemented through format-specific interfaces. */
3436 /* */
3437 /* Kerning for OpenType fonts implemented in a `GPOS' table is not */
3438 /* supported; use @FT_HAS_KERNING to find out whether a font has data */
3439 /* that can be extracted with `FT_Get_Kerning'. */
3440 /* */
3445 FT_UInt kern_mode,
3446 FT_Vector *akerning );
3447
3448
3449 /*************************************************************************/
3450 /* */
3451 /* <Function> */
3452 /* FT_Get_Track_Kerning */
3453 /* */
3454 /* <Description> */
3455 /* Return the track kerning for a given face object at a given size. */
3456 /* */
3457 /* <Input> */
3458 /* face :: A handle to a source face object. */
3459 /* */
3460 /* point_size :: The point size in 16.16 fractional points. */
3461 /* */
3462 /* degree :: The degree of tightness. Increasingly negative */
3463 /* values represent tighter track kerning, while */
3464 /* increasingly positive values represent looser track */
3465 /* kerning. Value zero means no track kerning. */
3466 /* */
3467 /* <Output> */
3468 /* akerning :: The kerning in 16.16 fractional points, to be */
3469 /* uniformly applied between all glyphs. */
3470 /* */
3471 /* <Return> */
3472 /* FreeType error code. 0~means success. */
3473 /* */
3474 /* <Note> */
3475 /* Currently, only the Type~1 font driver supports track kerning, */
3476 /* using data from AFM files (if attached with @FT_Attach_File or */
3477 /* @FT_Attach_Stream). */
3478 /* */
3479 /* Only very few AFM files come with track kerning data; please refer */
3480 /* to Adobe's AFM specification for more details. */
3481 /* */
3484 FT_Fixed point_size,
3485 FT_Int degree,
3486 FT_Fixed* akerning );
3487
3488
3489 /*************************************************************************/
3490 /* */
3491 /* <Function> */
3492 /* FT_Get_Glyph_Name */
3493 /* */
3494 /* <Description> */
3495 /* Retrieve the ASCII name of a given glyph in a face. This only */
3496 /* works for those faces where @FT_HAS_GLYPH_NAMES(face) returns~1. */
3497 /* */
3498 /* <Input> */
3499 /* face :: A handle to a source face object. */
3500 /* */
3501 /* glyph_index :: The glyph index. */
3502 /* */
3503 /* buffer_max :: The maximum number of bytes available in the */
3504 /* buffer. */
3505 /* */
3506 /* <Output> */
3507 /* buffer :: A pointer to a target buffer where the name is */
3508 /* copied to. */
3509 /* */
3510 /* <Return> */
3511 /* FreeType error code. 0~means success. */
3512 /* */
3513 /* <Note> */
3514 /* An error is returned if the face doesn't provide glyph names or if */
3515 /* the glyph index is invalid. In all cases of failure, the first */
3516 /* byte of `buffer' is set to~0 to indicate an empty name. */
3517 /* */
3518 /* The glyph name is truncated to fit within the buffer if it is too */
3519 /* long. The returned string is always zero-terminated. */
3520 /* */
3521 /* Be aware that FreeType reorders glyph indices internally so that */
3522 /* glyph index~0 always corresponds to the `missing glyph' (called */
3523 /* `.notdef'). */
3524 /* */
3525 /* This function always returns an error if the config macro */
3526 /* `FT_CONFIG_OPTION_NO_GLYPH_NAMES' is not defined in `ftoption.h'. */
3527 /* */
3530 FT_UInt glyph_index,
3532 FT_UInt buffer_max );
3533
3534
3535 /*************************************************************************/
3536 /* */
3537 /* <Function> */
3538 /* FT_Get_Postscript_Name */
3539 /* */
3540 /* <Description> */
3541 /* Retrieve the ASCII PostScript name of a given face, if available. */
3542 /* This only works with PostScript, TrueType, and OpenType fonts. */
3543 /* */
3544 /* <Input> */
3545 /* face :: A handle to the source face object. */
3546 /* */
3547 /* <Return> */
3548 /* A pointer to the face's PostScript name. NULL if unavailable. */
3549 /* */
3550 /* <Note> */
3551 /* The returned pointer is owned by the face and is destroyed with */
3552 /* it. */
3553 /* */
3554 /* For variation fonts, this string changes if you select a different */
3555 /* instance, and you have to call `FT_Get_PostScript_Name' again to */
3556 /* retrieve it. FreeType follows Adobe TechNote #5902, `Generating */
3557 /* PostScript Names for Fonts Using OpenType Font Variations'. */
3558 /* */
3559 /* https://download.macromedia.com/pub/developer/opentype/tech-notes/5902.AdobePSNameGeneration.html */
3560 /* */
3561 /* [Since 2.9] Special PostScript names for named instances are only */
3562 /* returned if the named instance is set with @FT_Set_Named_Instance */
3563 /* (and the font has corresponding entries in its `fvar' table). If */
3564 /* @FT_IS_VARIATION returns true, the algorithmically derived */
3565 /* PostScript name is provided, not looking up special entries for */
3566 /* named instances. */
3567 /* */
3568 FT_EXPORT( const char* )
3570
3571
3572 /*************************************************************************/
3573 /* */
3574 /* <Function> */
3575 /* FT_Select_Charmap */
3576 /* */
3577 /* <Description> */
3578 /* Select a given charmap by its encoding tag (as listed in */
3579 /* `freetype.h'). */
3580 /* */
3581 /* <InOut> */
3582 /* face :: A handle to the source face object. */
3583 /* */
3584 /* <Input> */
3585 /* encoding :: A handle to the selected encoding. */
3586 /* */
3587 /* <Return> */
3588 /* FreeType error code. 0~means success. */
3589 /* */
3590 /* <Note> */
3591 /* This function returns an error if no charmap in the face */
3592 /* corresponds to the encoding queried here. */
3593 /* */
3594 /* Because many fonts contain more than a single cmap for Unicode */
3595 /* encoding, this function has some special code to select the one */
3596 /* that covers Unicode best (`best' in the sense that a UCS-4 cmap is */
3597 /* preferred to a UCS-2 cmap). It is thus preferable to */
3598 /* @FT_Set_Charmap in this case. */
3599 /* */
3603
3604
3605 /*************************************************************************/
3606 /* */
3607 /* <Function> */
3608 /* FT_Set_Charmap */
3609 /* */
3610 /* <Description> */
3611 /* Select a given charmap for character code to glyph index mapping. */
3612 /* */
3613 /* <InOut> */
3614 /* face :: A handle to the source face object. */
3615 /* */
3616 /* <Input> */
3617 /* charmap :: A handle to the selected charmap. */
3618 /* */
3619 /* <Return> */
3620 /* FreeType error code. 0~means success. */
3621 /* */
3622 /* <Note> */
3623 /* This function returns an error if the charmap is not part of */
3624 /* the face (i.e., if it is not listed in the `face->charmaps' */
3625 /* table). */
3626 /* */
3627 /* It also fails if an OpenType type~14 charmap is selected (which */
3628 /* doesn't map character codes to glyph indices at all). */
3629 /* */
3632 FT_CharMap charmap );
3633
3634
3635 /*************************************************************************
3636 *
3637 * @function:
3638 * FT_Get_Charmap_Index
3639 *
3640 * @description:
3641 * Retrieve index of a given charmap.
3642 *
3643 * @input:
3644 * charmap ::
3645 * A handle to a charmap.
3646 *
3647 * @return:
3648 * The index into the array of character maps within the face to which
3649 * `charmap' belongs. If an error occurs, -1 is returned.
3650 *
3651 */
3652 FT_EXPORT( FT_Int )
3654
3655
3656 /*************************************************************************/
3657 /* */
3658 /* <Function> */
3659 /* FT_Get_Char_Index */
3660 /* */
3661 /* <Description> */
3662 /* Return the glyph index of a given character code. This function */
3663 /* uses the currently selected charmap to do the mapping. */
3664 /* */
3665 /* <Input> */
3666 /* face :: A handle to the source face object. */
3667 /* */
3668 /* charcode :: The character code. */
3669 /* */
3670 /* <Return> */
3671 /* The glyph index. 0~means `undefined character code'. */
3672 /* */
3673 /* <Note> */
3674 /* If you use FreeType to manipulate the contents of font files */
3675 /* directly, be aware that the glyph index returned by this function */
3676 /* doesn't always correspond to the internal indices used within the */
3677 /* file. This is done to ensure that value~0 always corresponds to */
3678 /* the `missing glyph'. If the first glyph is not named `.notdef', */
3679 /* then for Type~1 and Type~42 fonts, `.notdef' will be moved into */
3680 /* the glyph ID~0 position, and whatever was there will be moved to */
3681 /* the position `.notdef' had. For Type~1 fonts, if there is no */
3682 /* `.notdef' glyph at all, then one will be created at index~0 and */
3683 /* whatever was there will be moved to the last index -- Type~42 */
3684 /* fonts are considered invalid under this condition. */
3685 /* */
3688 FT_ULong charcode );
3689
3690
3691 /*************************************************************************/
3692 /* */
3693 /* <Function> */
3694 /* FT_Get_First_Char */
3695 /* */
3696 /* <Description> */
3697 /* Return the first character code in the current charmap of a given */
3698 /* face, together with its corresponding glyph index. */
3699 /* */
3700 /* <Input> */
3701 /* face :: A handle to the source face object. */
3702 /* */
3703 /* <Output> */
3704 /* agindex :: Glyph index of first character code. 0~if charmap is */
3705 /* empty. */
3706 /* */
3707 /* <Return> */
3708 /* The charmap's first character code. */
3709 /* */
3710 /* <Note> */
3711 /* You should use this function together with @FT_Get_Next_Char to */
3712 /* parse all character codes available in a given charmap. The code */
3713 /* should look like this: */
3714 /* */
3715 /* { */
3716 /* FT_ULong charcode; */
3717 /* FT_UInt gindex; */
3718 /* */
3719 /* */
3720 /* charcode = FT_Get_First_Char( face, &gindex ); */
3721 /* while ( gindex != 0 ) */
3722 /* { */
3723 /* ... do something with (charcode,gindex) pair ... */
3724 /* */
3725 /* charcode = FT_Get_Next_Char( face, charcode, &gindex ); */
3726 /* } */
3727 /* } */
3728 /* */
3729 /* Be aware that character codes can have values up to 0xFFFFFFFF; */
3730 /* this might happen for non-Unicode or malformed cmaps. However, */
3731 /* even with regular Unicode encoding, so-called `last resort fonts' */
3732 /* (using SFNT cmap format 13, see function @FT_Get_CMap_Format) */
3733 /* normally have entries for all Unicode characters up to 0x1FFFFF, */
3734 /* which can cause *a lot* of iterations. */
3735 /* */
3736 /* Note that `*agindex' is set to~0 if the charmap is empty. The */
3737 /* result itself can be~0 in two cases: if the charmap is empty or */
3738 /* if the value~0 is the first valid character code. */
3739 /* */
3742 FT_UInt *agindex );
3743
3744
3745 /*************************************************************************/
3746 /* */
3747 /* <Function> */
3748 /* FT_Get_Next_Char */
3749 /* */
3750 /* <Description> */
3751 /* Return the next character code in the current charmap of a given */
3752 /* face following the value `char_code', as well as the corresponding */
3753 /* glyph index. */
3754 /* */
3755 /* <Input> */
3756 /* face :: A handle to the source face object. */
3757 /* */
3758 /* char_code :: The starting character code. */
3759 /* */
3760 /* <Output> */
3761 /* agindex :: Glyph index of next character code. 0~if charmap */
3762 /* is empty. */
3763 /* */
3764 /* <Return> */
3765 /* The charmap's next character code. */
3766 /* */
3767 /* <Note> */
3768 /* You should use this function with @FT_Get_First_Char to walk */
3769 /* over all character codes available in a given charmap. See the */
3770 /* note for that function for a simple code example. */
3771 /* */
3772 /* Note that `*agindex' is set to~0 when there are no more codes in */
3773 /* the charmap. */
3774 /* */
3777 FT_ULong char_code,
3778 FT_UInt *agindex );
3779
3780
3781 /*************************************************************************
3782 *
3783 * @function:
3784 * FT_Face_Properties
3785 *
3786 * @description:
3787 * Set or override certain (library or module-wide) properties on a
3788 * face-by-face basis. Useful for finer-grained control and avoiding
3789 * locks on shared structures (threads can modify their own faces as
3790 * they see fit).
3791 *
3792 * Contrary to @FT_Property_Set, this function uses @FT_Parameter so
3793 * that you can pass multiple properties to the target face in one call.
3794 * Note that only a subset of the available properties can be
3795 * controlled.
3796 *
3797 * * @FT_PARAM_TAG_STEM_DARKENING (stem darkening, corresponding to the
3798 * property `no-stem-darkening' provided by the `autofit', `cff',
3799 * `type1', and `t1cid' modules; see @no-stem-darkening).
3800 *
3801 * * @FT_PARAM_TAG_LCD_FILTER_WEIGHTS (LCD filter weights, corresponding
3802 * to function @FT_Library_SetLcdFilterWeights).
3803 *
3804 * * @FT_PARAM_TAG_RANDOM_SEED (seed value for the CFF, Type~1, and CID
3805 * `random' operator, corresponding to the `random-seed' property
3806 * provided by the `cff', `type1', and `t1cid' modules; see
3807 * @random-seed).
3808 *
3809 * Pass NULL as `data' in @FT_Parameter for a given tag to reset the
3810 * option and use the library or module default again.
3811 *
3812 * @input:
3813 * face ::
3814 * A handle to the source face object.
3815 *
3816 * num_properties ::
3817 * The number of properties that follow.
3818 *
3819 * properties ::
3820 * A handle to an @FT_Parameter array with `num_properties' elements.
3821 *
3822 * @return:
3823 * FreeType error code. 0~means success.
3824 *
3825 * @note:
3826 * Here an example that sets three properties. You must define
3827 * FT_CONFIG_OPTION_SUBPIXEL_RENDERING to make the LCD filter examples
3828 * work.
3829 *
3830 * {
3831 * FT_Parameter property1;
3832 * FT_Bool darken_stems = 1;
3833 *
3834 * FT_Parameter property2;
3835 * FT_LcdFiveTapFilter custom_weight =
3836 * { 0x11, 0x44, 0x56, 0x44, 0x11 };
3837 *
3838 * FT_Parameter property3;
3839 * FT_Int32 random_seed = 314159265;
3840 *
3841 * FT_Parameter properties[3] = { property1,
3842 * property2,
3843 * property3 };
3844 *
3845 *
3846 * property1.tag = FT_PARAM_TAG_STEM_DARKENING;
3847 * property1.data = &darken_stems;
3848 *
3849 * property2.tag = FT_PARAM_TAG_LCD_FILTER_WEIGHTS;
3850 * property2.data = custom_weight;
3851 *
3852 * property3.tag = FT_PARAM_TAG_RANDOM_SEED;
3853 * property3.data = &random_seed;
3854 *
3855 * FT_Face_Properties( face, 3, properties );
3856 * }
3857 *
3858 * The next example resets a single property to its default value.
3859 *
3860 * {
3861 * FT_Parameter property;
3862 *
3863 *
3864 * property.tag = FT_PARAM_TAG_LCD_FILTER_WEIGHTS;
3865 * property.data = NULL;
3866 *
3867 * FT_Face_Properties( face, 1, &property );
3868 * }
3869 *
3870 * @since:
3871 * 2.8
3872 *
3873 */
3876 FT_UInt num_properties,
3877 FT_Parameter* properties );
3878
3879
3880 /*************************************************************************/
3881 /* */
3882 /* <Function> */
3883 /* FT_Get_Name_Index */
3884 /* */
3885 /* <Description> */
3886 /* Return the glyph index of a given glyph name. */
3887 /* */
3888 /* <Input> */
3889 /* face :: A handle to the source face object. */
3890 /* */
3891 /* glyph_name :: The glyph name. */
3892 /* */
3893 /* <Return> */
3894 /* The glyph index. 0~means `undefined character code'. */
3895 /* */
3898 FT_String* glyph_name );
3899
3900
3901 /*************************************************************************
3902 *
3903 * @macro:
3904 * FT_SUBGLYPH_FLAG_XXX
3905 *
3906 * @description:
3907 * A list of constants describing subglyphs. Please refer to the
3908 * `glyf' table description in the OpenType specification for the
3909 * meaning of the various flags (which get synthesized for
3910 * non-OpenType subglyphs).
3911 *
3912 * @values:
3913 * FT_SUBGLYPH_FLAG_ARGS_ARE_WORDS ::
3914 * FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES ::
3915 * FT_SUBGLYPH_FLAG_ROUND_XY_TO_GRID ::
3916 * FT_SUBGLYPH_FLAG_SCALE ::
3917 * FT_SUBGLYPH_FLAG_XY_SCALE ::
3918 * FT_SUBGLYPH_FLAG_2X2 ::
3919 * FT_SUBGLYPH_FLAG_USE_MY_METRICS ::
3920 *
3921 */
3922#define FT_SUBGLYPH_FLAG_ARGS_ARE_WORDS 1
3923#define FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES 2
3924#define FT_SUBGLYPH_FLAG_ROUND_XY_TO_GRID 4
3925#define FT_SUBGLYPH_FLAG_SCALE 8
3926#define FT_SUBGLYPH_FLAG_XY_SCALE 0x40
3927#define FT_SUBGLYPH_FLAG_2X2 0x80
3928#define FT_SUBGLYPH_FLAG_USE_MY_METRICS 0x200
3929
3930
3931 /*************************************************************************
3932 *
3933 * @func:
3934 * FT_Get_SubGlyph_Info
3935 *
3936 * @description:
3937 * Retrieve a description of a given subglyph. Only use it if
3938 * `glyph->format' is @FT_GLYPH_FORMAT_COMPOSITE; an error is
3939 * returned otherwise.
3940 *
3941 * @input:
3942 * glyph ::
3943 * The source glyph slot.
3944 *
3945 * sub_index ::
3946 * The index of the subglyph. Must be less than
3947 * `glyph->num_subglyphs'.
3948 *
3949 * @output:
3950 * p_index ::
3951 * The glyph index of the subglyph.
3952 *
3953 * p_flags ::
3954 * The subglyph flags, see @FT_SUBGLYPH_FLAG_XXX.
3955 *
3956 * p_arg1 ::
3957 * The subglyph's first argument (if any).
3958 *
3959 * p_arg2 ::
3960 * The subglyph's second argument (if any).
3961 *
3962 * p_transform ::
3963 * The subglyph transformation (if any).
3964 *
3965 * @return:
3966 * FreeType error code. 0~means success.
3967 *
3968 * @note:
3969 * The values of `*p_arg1', `*p_arg2', and `*p_transform' must be
3970 * interpreted depending on the flags returned in `*p_flags'. See the
3971 * OpenType specification for details.
3972 *
3973 */
3976 FT_UInt sub_index,
3977 FT_Int *p_index,
3978 FT_UInt *p_flags,
3979 FT_Int *p_arg1,
3980 FT_Int *p_arg2,
3981 FT_Matrix *p_transform );
3982
3983
3984 /*************************************************************************/
3985 /* */
3986 /* <Enum> */
3987 /* FT_FSTYPE_XXX */
3988 /* */
3989 /* <Description> */
3990 /* A list of bit flags used in the `fsType' field of the OS/2 table */
3991 /* in a TrueType or OpenType font and the `FSType' entry in a */
3992 /* PostScript font. These bit flags are returned by */
3993 /* @FT_Get_FSType_Flags; they inform client applications of embedding */
3994 /* and subsetting restrictions associated with a font. */
3995 /* */
3996 /* See */
3997 /* https://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/FontPolicies.pdf */
3998 /* for more details. */
3999 /* */
4000 /* <Values> */
4001 /* FT_FSTYPE_INSTALLABLE_EMBEDDING :: */
4002 /* Fonts with no fsType bit set may be embedded and permanently */
4003 /* installed on the remote system by an application. */
4004 /* */
4005 /* FT_FSTYPE_RESTRICTED_LICENSE_EMBEDDING :: */
4006 /* Fonts that have only this bit set must not be modified, embedded */
4007 /* or exchanged in any manner without first obtaining permission of */
4008 /* the font software copyright owner. */
4009 /* */
4010 /* FT_FSTYPE_PREVIEW_AND_PRINT_EMBEDDING :: */
4011 /* The font may be embedded and temporarily loaded on the remote */
4012 /* system. Documents containing Preview & Print fonts must be */
4013 /* opened `read-only'; no edits can be applied to the document. */
4014 /* */
4015 /* FT_FSTYPE_EDITABLE_EMBEDDING :: */
4016 /* The font may be embedded but must only be installed temporarily */
4017 /* on other systems. In contrast to Preview & Print fonts, */
4018 /* documents containing editable fonts may be opened for reading, */
4019 /* editing is permitted, and changes may be saved. */
4020 /* */
4021 /* FT_FSTYPE_NO_SUBSETTING :: */
4022 /* The font may not be subsetted prior to embedding. */
4023 /* */
4024 /* FT_FSTYPE_BITMAP_EMBEDDING_ONLY :: */
4025 /* Only bitmaps contained in the font may be embedded; no outline */
4026 /* data may be embedded. If there are no bitmaps available in the */
4027 /* font, then the font is unembeddable. */
4028 /* */
4029 /* <Note> */
4030 /* The flags are ORed together, thus more than a single value can be */
4031 /* returned. */
4032 /* */
4033 /* While the `fsType' flags can indicate that a font may be embedded, */
4034 /* a license with the font vendor may be separately required to use */
4035 /* the font in this way. */
4036 /* */
4037#define FT_FSTYPE_INSTALLABLE_EMBEDDING 0x0000
4038#define FT_FSTYPE_RESTRICTED_LICENSE_EMBEDDING 0x0002
4039#define FT_FSTYPE_PREVIEW_AND_PRINT_EMBEDDING 0x0004
4040#define FT_FSTYPE_EDITABLE_EMBEDDING 0x0008
4041#define FT_FSTYPE_NO_SUBSETTING 0x0100
4042#define FT_FSTYPE_BITMAP_EMBEDDING_ONLY 0x0200
4043
4044
4045 /*************************************************************************/
4046 /* */
4047 /* <Function> */
4048 /* FT_Get_FSType_Flags */
4049 /* */
4050 /* <Description> */
4051 /* Return the `fsType' flags for a font. */
4052 /* */
4053 /* <Input> */
4054 /* face :: A handle to the source face object. */
4055 /* */
4056 /* <Return> */
4057 /* The `fsType' flags, see @FT_FSTYPE_XXX. */
4058 /* */
4059 /* <Note> */
4060 /* Use this function rather than directly reading the `fs_type' field */
4061 /* in the @PS_FontInfoRec structure, which is only guaranteed to */
4062 /* return the correct results for Type~1 fonts. */
4063 /* */
4064 /* <Since> */
4065 /* 2.3.8 */
4066 /* */
4069
4070
4071 /*************************************************************************/
4072 /* */
4073 /* <Section> */
4074 /* glyph_variants */
4075 /* */
4076 /* <Title> */
4077 /* Unicode Variation Sequences */
4078 /* */
4079 /* <Abstract> */
4080 /* The FreeType~2 interface to Unicode Variation Sequences (UVS), */
4081 /* using the SFNT cmap format~14. */
4082 /* */
4083 /* <Description> */
4084 /* Many characters, especially for CJK scripts, have variant forms. */
4085 /* They are a sort of grey area somewhere between being totally */
4086 /* irrelevant and semantically distinct; for this reason, the Unicode */
4087 /* consortium decided to introduce Variation Sequences (VS), */
4088 /* consisting of a Unicode base character and a variation selector */
4089 /* instead of further extending the already huge number of */
4090 /* characters. */
4091 /* */
4092 /* Unicode maintains two different sets, namely `Standardized */
4093 /* Variation Sequences' and registered `Ideographic Variation */
4094 /* Sequences' (IVS), collected in the `Ideographic Variation */
4095 /* Database' (IVD). */
4096 /* */
4097 /* https://unicode.org/Public/UCD/latest/ucd/StandardizedVariants.txt */
4098 /* https://unicode.org/reports/tr37/ */
4099 /* https://unicode.org/ivd/ */
4100 /* */
4101 /* To date (January 2017), the character with the most ideographic */
4102 /* variations is U+9089, having 32 such IVS. */
4103 /* */
4104 /* Three Mongolian Variation Selectors have the values U+180B-U+180D; */
4105 /* 256 generic Variation Selectors are encoded in the ranges */
4106 /* U+FE00-U+FE0F and U+E0100-U+E01EF. IVS currently use Variation */
4107 /* Selectors from the range U+E0100-U+E01EF only. */
4108 /* */
4109 /* A VS consists of the base character value followed by a single */
4110 /* Variation Selector. For example, to get the first variation of */
4111 /* U+9089, you have to write the character sequence `U+9089 U+E0100'. */
4112 /* */
4113 /* Adobe and MS decided to support both standardized and ideographic */
4114 /* VS with a new cmap subtable (format~14). It is an odd subtable */
4115 /* because it is not a mapping of input code points to glyphs, but */
4116 /* contains lists of all variations supported by the font. */
4117 /* */
4118 /* A variation may be either `default' or `non-default' for a given */
4119 /* font. A default variation is the one you will get for that code */
4120 /* point if you look it up in the standard Unicode cmap. A */
4121 /* non-default variation is a different glyph. */
4122 /* */
4123 /*************************************************************************/
4124
4125
4126 /*************************************************************************/
4127 /* */
4128 /* <Function> */
4129 /* FT_Face_GetCharVariantIndex */
4130 /* */
4131 /* <Description> */
4132 /* Return the glyph index of a given character code as modified by */
4133 /* the variation selector. */
4134 /* */
4135 /* <Input> */
4136 /* face :: */
4137 /* A handle to the source face object. */
4138 /* */
4139 /* charcode :: */
4140 /* The character code point in Unicode. */
4141 /* */
4142 /* variantSelector :: */
4143 /* The Unicode code point of the variation selector. */
4144 /* */
4145 /* <Return> */
4146 /* The glyph index. 0~means either `undefined character code', or */
4147 /* `undefined selector code', or `no variation selector cmap */
4148 /* subtable', or `current CharMap is not Unicode'. */
4149 /* */
4150 /* <Note> */
4151 /* If you use FreeType to manipulate the contents of font files */
4152 /* directly, be aware that the glyph index returned by this function */
4153 /* doesn't always correspond to the internal indices used within */
4154 /* the file. This is done to ensure that value~0 always corresponds */
4155 /* to the `missing glyph'. */
4156 /* */
4157 /* This function is only meaningful if */
4158 /* a) the font has a variation selector cmap sub table, */
4159 /* and */
4160 /* b) the current charmap has a Unicode encoding. */
4161 /* */
4162 /* <Since> */
4163 /* 2.3.6 */
4164 /* */
4167 FT_ULong charcode,
4168 FT_ULong variantSelector );
4169
4170
4171 /*************************************************************************/
4172 /* */
4173 /* <Function> */
4174 /* FT_Face_GetCharVariantIsDefault */
4175 /* */
4176 /* <Description> */
4177 /* Check whether this variation of this Unicode character is the one */
4178 /* to be found in the `cmap'. */
4179 /* */
4180 /* <Input> */
4181 /* face :: */
4182 /* A handle to the source face object. */
4183 /* */
4184 /* charcode :: */
4185 /* The character codepoint in Unicode. */
4186 /* */
4187 /* variantSelector :: */
4188 /* The Unicode codepoint of the variation selector. */
4189 /* */
4190 /* <Return> */
4191 /* 1~if found in the standard (Unicode) cmap, 0~if found in the */
4192 /* variation selector cmap, or -1 if it is not a variation. */
4193 /* */
4194 /* <Note> */
4195 /* This function is only meaningful if the font has a variation */
4196 /* selector cmap subtable. */
4197 /* */
4198 /* <Since> */
4199 /* 2.3.6 */
4200 /* */
4201 FT_EXPORT( FT_Int )
4203 FT_ULong charcode,
4204 FT_ULong variantSelector );
4205
4206
4207 /*************************************************************************/
4208 /* */
4209 /* <Function> */
4210 /* FT_Face_GetVariantSelectors */
4211 /* */
4212 /* <Description> */
4213 /* Return a zero-terminated list of Unicode variation selectors found */
4214 /* in the font. */
4215 /* */
4216 /* <Input> */
4217 /* face :: */
4218 /* A handle to the source face object. */
4219 /* */
4220 /* <Return> */
4221 /* A pointer to an array of selector code points, or NULL if there is */
4222 /* no valid variation selector cmap subtable. */
4223 /* */
4224 /* <Note> */
4225 /* The last item in the array is~0; the array is owned by the */
4226 /* @FT_Face object but can be overwritten or released on the next */
4227 /* call to a FreeType function. */
4228 /* */
4229 /* <Since> */
4230 /* 2.3.6 */
4231 /* */
4232 FT_EXPORT( FT_UInt32* )
4234
4235
4236 /*************************************************************************/
4237 /* */
4238 /* <Function> */
4239 /* FT_Face_GetVariantsOfChar */
4240 /* */
4241 /* <Description> */
4242 /* Return a zero-terminated list of Unicode variation selectors found */
4243 /* for the specified character code. */
4244 /* */
4245 /* <Input> */
4246 /* face :: */
4247 /* A handle to the source face object. */
4248 /* */
4249 /* charcode :: */
4250 /* The character codepoint in Unicode. */
4251 /* */
4252 /* <Return> */
4253 /* A pointer to an array of variation selector code points that are */
4254 /* active for the given character, or NULL if the corresponding list */
4255 /* is empty. */
4256 /* */
4257 /* <Note> */
4258 /* The last item in the array is~0; the array is owned by the */
4259 /* @FT_Face object but can be overwritten or released on the next */
4260 /* call to a FreeType function. */
4261 /* */
4262 /* <Since> */
4263 /* 2.3.6 */
4264 /* */
4265 FT_EXPORT( FT_UInt32* )
4267 FT_ULong charcode );
4268
4269
4270 /*************************************************************************/
4271 /* */
4272 /* <Function> */
4273 /* FT_Face_GetCharsOfVariant */
4274 /* */
4275 /* <Description> */
4276 /* Return a zero-terminated list of Unicode character codes found for */
4277 /* the specified variation selector. */
4278 /* */
4279 /* <Input> */
4280 /* face :: */
4281 /* A handle to the source face object. */
4282 /* */
4283 /* variantSelector :: */
4284 /* The variation selector code point in Unicode. */
4285 /* */
4286 /* <Return> */
4287 /* A list of all the code points that are specified by this selector */
4288 /* (both default and non-default codes are returned) or NULL if there */
4289 /* is no valid cmap or the variation selector is invalid. */
4290 /* */
4291 /* <Note> */
4292 /* The last item in the array is~0; the array is owned by the */
4293 /* @FT_Face object but can be overwritten or released on the next */
4294 /* call to a FreeType function. */
4295 /* */
4296 /* <Since> */
4297 /* 2.3.6 */
4298 /* */
4299 FT_EXPORT( FT_UInt32* )
4301 FT_ULong variantSelector );
4302
4303
4304 /*************************************************************************/
4305 /* */
4306 /* <Section> */
4307 /* computations */
4308 /* */
4309 /* <Title> */
4310 /* Computations */
4311 /* */
4312 /* <Abstract> */
4313 /* Crunching fixed numbers and vectors. */
4314 /* */
4315 /* <Description> */
4316 /* This section contains various functions used to perform */
4317 /* computations on 16.16 fixed-float numbers or 2d vectors. */
4318 /* */
4319 /* <Order> */
4320 /* FT_MulDiv */
4321 /* FT_MulFix */
4322 /* FT_DivFix */
4323 /* FT_RoundFix */
4324 /* FT_CeilFix */
4325 /* FT_FloorFix */
4326 /* FT_Vector_Transform */
4327 /* FT_Matrix_Multiply */
4328 /* FT_Matrix_Invert */
4329 /* */
4330 /*************************************************************************/
4331
4332
4333 /*************************************************************************/
4334 /* */
4335 /* <Function> */
4336 /* FT_MulDiv */
4337 /* */
4338 /* <Description> */
4339 /* Compute `(a*b)/c' with maximum accuracy, using a 64-bit */
4340 /* intermediate integer whenever necessary. */
4341 /* */
4342 /* This function isn't necessarily as fast as some processor specific */
4343 /* operations, but is at least completely portable. */
4344 /* */
4345 /* <Input> */
4346 /* a :: The first multiplier. */
4347 /* */
4348 /* b :: The second multiplier. */
4349 /* */
4350 /* c :: The divisor. */
4351 /* */
4352 /* <Return> */
4353 /* The result of `(a*b)/c'. This function never traps when trying to */
4354 /* divide by zero; it simply returns `MaxInt' or `MinInt' depending */
4355 /* on the signs of `a' and `b'. */
4356 /* */
4359 FT_Long b,
4360 FT_Long c );
4361
4362
4363 /*************************************************************************/
4364 /* */
4365 /* <Function> */
4366 /* FT_MulFix */
4367 /* */
4368 /* <Description> */
4369 /* Compute `(a*b)/0x10000' with maximum accuracy. Its main use is to */
4370 /* multiply a given value by a 16.16 fixed-point factor. */
4371 /* */
4372 /* <Input> */
4373 /* a :: The first multiplier. */
4374 /* */
4375 /* b :: The second multiplier. Use a 16.16 factor here whenever */
4376 /* possible (see note below). */
4377 /* */
4378 /* <Return> */
4379 /* The result of `(a*b)/0x10000'. */
4380 /* */
4381 /* <Note> */
4382 /* This function has been optimized for the case where the absolute */
4383 /* value of `a' is less than 2048, and `b' is a 16.16 scaling factor. */
4384 /* As this happens mainly when scaling from notional units to */
4385 /* fractional pixels in FreeType, it resulted in noticeable speed */
4386 /* improvements between versions 2.x and 1.x. */
4387 /* */
4388 /* As a conclusion, always try to place a 16.16 factor as the */
4389 /* _second_ argument of this function; this can make a great */
4390 /* difference. */
4391 /* */
4394 FT_Long b );
4395
4396
4397 /*************************************************************************/
4398 /* */
4399 /* <Function> */
4400 /* FT_DivFix */
4401 /* */
4402 /* <Description> */
4403 /* Compute `(a*0x10000)/b' with maximum accuracy. Its main use is to */
4404 /* divide a given value by a 16.16 fixed-point factor. */
4405 /* */
4406 /* <Input> */
4407 /* a :: The numerator. */
4408 /* */
4409 /* b :: The denominator. Use a 16.16 factor here. */
4410 /* */
4411 /* <Return> */
4412 /* The result of `(a*0x10000)/b'. */
4413 /* */
4416 FT_Long b );
4417
4418
4419 /*************************************************************************/
4420 /* */
4421 /* <Function> */
4422 /* FT_RoundFix */
4423 /* */
4424 /* <Description> */
4425 /* Round a 16.16 fixed number. */
4426 /* */
4427 /* <Input> */
4428 /* a :: The number to be rounded. */
4429 /* */
4430 /* <Return> */
4431 /* `a' rounded to the nearest 16.16 fixed integer, halfway cases away */
4432 /* from zero. */
4433 /* */
4434 /* <Note> */
4435 /* The function uses wrap-around arithmetic. */
4436 /* */
4439
4440
4441 /*************************************************************************/
4442 /* */
4443 /* <Function> */
4444 /* FT_CeilFix */
4445 /* */
4446 /* <Description> */
4447 /* Compute the smallest following integer of a 16.16 fixed number. */
4448 /* */
4449 /* <Input> */
4450 /* a :: The number for which the ceiling function is to be computed. */
4451 /* */
4452 /* <Return> */
4453 /* `a' rounded towards plus infinity. */
4454 /* */
4455 /* <Note> */
4456 /* The function uses wrap-around arithmetic. */
4457 /* */
4460
4461
4462 /*************************************************************************/
4463 /* */
4464 /* <Function> */
4465 /* FT_FloorFix */
4466 /* */
4467 /* <Description> */
4468 /* Compute the largest previous integer of a 16.16 fixed number. */
4469 /* */
4470 /* <Input> */
4471 /* a :: The number for which the floor function is to be computed. */
4472 /* */
4473 /* <Return> */
4474 /* `a' rounded towards minus infinity. */
4475 /* */
4478
4479
4480 /*************************************************************************/
4481 /* */
4482 /* <Function> */
4483 /* FT_Vector_Transform */
4484 /* */
4485 /* <Description> */
4486 /* Transform a single vector through a 2x2 matrix. */
4487 /* */
4488 /* <InOut> */
4489 /* vector :: The target vector to transform. */
4490 /* */
4491 /* <Input> */
4492 /* matrix :: A pointer to the source 2x2 matrix. */
4493 /* */
4494 /* <Note> */
4495 /* The result is undefined if either `vector' or `matrix' is invalid. */
4496 /* */
4497 FT_EXPORT( void )
4499 const FT_Matrix* matrix );
4500
4501
4502 /*************************************************************************/
4503 /* */
4504 /* <Section> */
4505 /* version */
4506 /* */
4507 /* <Title> */
4508 /* FreeType Version */
4509 /* */
4510 /* <Abstract> */
4511 /* Functions and macros related to FreeType versions. */
4512 /* */
4513 /* <Description> */
4514 /* Note that those functions and macros are of limited use because */
4515 /* even a new release of FreeType with only documentation changes */
4516 /* increases the version number. */
4517 /* */
4518 /* <Order> */
4519 /* FT_Library_Version */
4520 /* */
4521 /* FREETYPE_MAJOR */
4522 /* FREETYPE_MINOR */
4523 /* FREETYPE_PATCH */
4524 /* */
4525 /* FT_Face_CheckTrueTypePatents */
4526 /* FT_Face_SetUnpatentedHinting */
4527 /* */
4528 /* FREETYPE_XXX */
4529 /* */
4530 /*************************************************************************/
4531
4532
4533 /*************************************************************************
4534 *
4535 * @enum:
4536 * FREETYPE_XXX
4537 *
4538 * @description:
4539 * These three macros identify the FreeType source code version.
4540 * Use @FT_Library_Version to access them at runtime.
4541 *
4542 * @values:
4543 * FREETYPE_MAJOR :: The major version number.
4544 * FREETYPE_MINOR :: The minor version number.
4545 * FREETYPE_PATCH :: The patch level.
4546 *
4547 * @note:
4548 * The version number of FreeType if built as a dynamic link library
4549 * with the `libtool' package is _not_ controlled by these three
4550 * macros.
4551 *
4552 */
4553#define FREETYPE_MAJOR 2
4554#define FREETYPE_MINOR 9
4555#define FREETYPE_PATCH 0
4556
4557
4558 /*************************************************************************/
4559 /* */
4560 /* <Function> */
4561 /* FT_Library_Version */
4562 /* */
4563 /* <Description> */
4564 /* Return the version of the FreeType library being used. This is */
4565 /* useful when dynamically linking to the library, since one cannot */
4566 /* use the macros @FREETYPE_MAJOR, @FREETYPE_MINOR, and */
4567 /* @FREETYPE_PATCH. */
4568 /* */
4569 /* <Input> */
4570 /* library :: A source library handle. */
4571 /* */
4572 /* <Output> */
4573 /* amajor :: The major version number. */
4574 /* */
4575 /* aminor :: The minor version number. */
4576 /* */
4577 /* apatch :: The patch version number. */
4578 /* */
4579 /* <Note> */
4580 /* The reason why this function takes a `library' argument is because */
4581 /* certain programs implement library initialization in a custom way */
4582 /* that doesn't use @FT_Init_FreeType. */
4583 /* */
4584 /* In such cases, the library version might not be available before */
4585 /* the library object has been created. */
4586 /* */
4587 FT_EXPORT( void )
4589 FT_Int *amajor,
4590 FT_Int *aminor,
4591 FT_Int *apatch );
4592
4593
4594 /*************************************************************************/
4595 /* */
4596 /* <Function> */
4597 /* FT_Face_CheckTrueTypePatents */
4598 /* */
4599 /* <Description> */
4600 /* Deprecated, does nothing. */
4601 /* */
4602 /* <Input> */
4603 /* face :: A face handle. */
4604 /* */
4605 /* <Return> */
4606 /* Always returns false. */
4607 /* */
4608 /* <Note> */
4609 /* Since May 2010, TrueType hinting is no longer patented. */
4610 /* */
4611 /* <Since> */
4612 /* 2.3.5 */
4613 /* */
4616
4617
4618 /*************************************************************************/
4619 /* */
4620 /* <Function> */
4621 /* FT_Face_SetUnpatentedHinting */
4622 /* */
4623 /* <Description> */
4624 /* Deprecated, does nothing. */
4625 /* */
4626 /* <Input> */
4627 /* face :: A face handle. */
4628 /* */
4629 /* value :: New boolean setting. */
4630 /* */
4631 /* <Return> */
4632 /* Always returns false. */
4633 /* */
4634 /* <Note> */
4635 /* Since May 2010, TrueType hinting is no longer patented. */
4636 /* */
4637 /* <Since> */
4638 /* 2.3.5 */
4639 /* */
4642 FT_Bool value );
4643
4644 /* */
4645
4646
4648
4649#endif /* FREETYPE_H_ */
4650
4651
4652/* END */
FT_Library library
Definition: cffdrivr.c:654
FT_Load_Glyph(FT_Face face, FT_UInt glyph_index, FT_Int32 load_flags)
Definition: ftobjs.c:760
struct FT_Bitmap_Size_ FT_Bitmap_Size
enum FT_Size_Request_Type_ FT_Size_Request_Type
struct FT_CharMapRec_ FT_CharMapRec
FT_BEGIN_HEADER struct FT_Glyph_Metrics_ FT_Glyph_Metrics
FT_Set_Transform(FT_Face face, FT_Matrix *matrix, FT_Vector *delta)
Definition: ftobjs.c:653
struct FT_RendererRec_ * FT_Renderer
Definition: freetype.h:463
FT_Vector_Transform(FT_Vector *vec, const FT_Matrix *matrix)
Definition: ftoutln.c:688
struct FT_SubGlyphRec_ * FT_SubGlyph
Definition: freetype.h:1699
struct FT_Size_RequestRec_ FT_Size_RequestRec
FT_New_Face(FT_Library library, const char *filepathname, FT_Long face_index, FT_Face *aface)
Definition: ftobjs.c:1406
FT_RoundFix(FT_Fixed a)
Definition: ftcalc.c:88
FT_Face_GetVariantSelectors(FT_Face face)
Definition: ftobjs.c:3923
struct FT_Parameter_ FT_Parameter
FT_Face_CheckTrueTypePatents(FT_Face face)
Definition: ftpatent.c:31
FT_Size_Request_Type_
Definition: freetype.h:2569
@ FT_SIZE_REQUEST_TYPE_BBOX
Definition: freetype.h:2572
@ FT_SIZE_REQUEST_TYPE_NOMINAL
Definition: freetype.h:2570
@ FT_SIZE_REQUEST_TYPE_REAL_DIM
Definition: freetype.h:2571
@ FT_SIZE_REQUEST_TYPE_SCALES
Definition: freetype.h:2574
@ FT_SIZE_REQUEST_TYPE_MAX
Definition: freetype.h:2576
@ FT_SIZE_REQUEST_TYPE_CELL
Definition: freetype.h:2573
struct FT_Face_InternalRec_ * FT_Face_Internal
Definition: freetype.h:871
FT_Library_Version(FT_Library library, FT_Int *amajor, FT_Int *aminor, FT_Int *apatch)
Definition: ftobjs.c:5189
FT_Set_Pixel_Sizes(FT_Face face, FT_UInt pixel_width, FT_UInt pixel_height)
Definition: ftobjs.c:3309
FT_Done_Face(FT_Face face)
Definition: ftobjs.c:2721
FT_Get_First_Char(FT_Face face, FT_UInt *agindex)
Definition: ftobjs.c:3697
FT_Face_GetVariantsOfChar(FT_Face face, FT_ULong charcode)
Definition: ftobjs.c:3950
FT_Open_Face(FT_Library library, const FT_Open_Args *args, FT_Long face_index, FT_Face *aface)
Definition: ftobjs.c:2317
enum FT_Render_Mode_ FT_Render_Mode
struct FT_FaceRec_ FT_FaceRec
FT_Get_FSType_Flags(FT_Face face)
Definition: ftfstype.c:28
FT_Face_SetUnpatentedHinting(FT_Face face, FT_Bool value)
Definition: ftpatent.c:42
FT_DivFix(FT_Long a, FT_Long b)
Definition: ftcalc.c:608
FT_Get_Char_Index(FT_Face face, FT_ULong charcode)
Definition: ftobjs.c:3668
struct FT_DriverRec_ * FT_Driver
Definition: freetype.h:449
struct FT_Size_InternalRec_ * FT_Size_Internal
Definition: freetype.h:1530
FT_CeilFix(FT_Fixed a)
Definition: ftcalc.c:97
FT_Select_Charmap(FT_Face face, FT_Encoding encoding)
Definition: ftobjs.c:3457
FT_FloorFix(FT_Fixed a)
Definition: ftcalc.c:106
struct FT_ModuleRec_ * FT_Module
Definition: freetype.h:437
FT_Select_Size(FT_Face face, FT_Int strike_index)
Definition: ftobjs.c:3138
struct FT_GlyphSlotRec_ FT_GlyphSlotRec
struct FT_Size_RequestRec_ * FT_Size_Request
Definition: freetype.h:2636
FT_Request_Size(FT_Face face, FT_Size_Request req)
Definition: ftobjs.c:3192
struct FT_GlyphSlotRec_ * FT_GlyphSlot
Definition: freetype.h:554
struct FT_SizeRec_ * FT_Size
Definition: freetype.h:534
FT_Get_Postscript_Name(FT_Face face)
Definition: ftobjs.c:4084
struct FT_FaceRec_ * FT_Face
Definition: freetype.h:503
FT_Encoding_
Definition: freetype.h:766
@ FT_ENCODING_MS_JOHAB
Definition: freetype.h:784
@ FT_ENCODING_GB2312
Definition: freetype.h:779
@ FT_ENCODING_MS_SJIS
Definition: freetype.h:780
@ FT_ENCODING_MS_WANSUNG
Definition: freetype.h:783
@ FT_ENCODING_MS_BIG5
Definition: freetype.h:782
@ FT_ENCODING_MS_GB2312
Definition: freetype.h:781
FT_Face_GetCharVariantIndex(FT_Face face, FT_ULong charcode, FT_ULong variantSelector)
Definition: ftobjs.c:3834
FT_Get_Next_Char(FT_Face face, FT_ULong char_code, FT_UInt *agindex)
Definition: ftobjs.c:3722
enum FT_Kerning_Mode_ FT_Kerning_Mode
FT_Get_Charmap_Index(FT_CharMap charmap)
Definition: ftobjs.c:3534
FT_Set_Charmap(FT_Face face, FT_CharMap charmap)
Definition: ftobjs.c:3499
struct FT_LibraryRec_ * FT_Library
Definition: freetype.h:417
#define FT_ENC_TAG(value, a, b, c, d)
Definition: freetype.h:613
enum FT_Encoding_ FT_Encoding
struct FT_SizeRec_ FT_SizeRec
struct FT_Open_Args_ FT_Open_Args
FT_Get_Glyph_Name(FT_Face face, FT_UInt glyph_index, FT_Pointer buffer, FT_UInt buffer_max)
Definition: ftobjs.c:4047
struct FT_Slot_InternalRec_ * FT_Slot_Internal
Definition: freetype.h:1711
FT_Render_Glyph(FT_GlyphSlot slot, FT_Render_Mode render_mode)
Definition: ftobjs.c:4650
FT_Done_FreeType(FT_Library library)
Definition: ftinit.c:356
FT_Get_Track_Kerning(FT_Face face, FT_Fixed point_size, FT_Int degree, FT_Fixed *akerning)
Definition: ftobjs.c:3426
FT_Get_Name_Index(FT_Face face, FT_String *glyph_name)
Definition: ftobjs.c:4019
FT_Render_Mode_
Definition: freetype.h:3233
@ FT_RENDER_MODE_MONO
Definition: freetype.h:3236
@ FT_RENDER_MODE_NORMAL
Definition: freetype.h:3234
@ FT_RENDER_MODE_LIGHT
Definition: freetype.h:3235
@ FT_RENDER_MODE_MAX
Definition: freetype.h:3240
@ FT_RENDER_MODE_LCD_V
Definition: freetype.h:3238
@ FT_RENDER_MODE_LCD
Definition: freetype.h:3237
FT_Get_Kerning(FT_Face face, FT_UInt left_glyph, FT_UInt right_glyph, FT_UInt kern_mode, FT_Vector *akerning)
Definition: ftobjs.c:3347
FT_Kerning_Mode_
Definition: freetype.h:3388
@ FT_KERNING_UNFITTED
Definition: freetype.h:3390
@ FT_KERNING_UNSCALED
Definition: freetype.h:3391
@ FT_KERNING_DEFAULT
Definition: freetype.h:3389
FT_Attach_Stream(FT_Face face, FT_Open_Args *parameters)
Definition: ftobjs.c:2663
struct FT_Size_Metrics_ FT_Size_Metrics
FT_Get_SubGlyph_Info(FT_GlyphSlot glyph, FT_UInt sub_index, FT_Int *p_index, FT_UInt *p_flags, FT_Int *p_arg1, FT_Int *p_arg2, FT_Matrix *p_transform)
Definition: ftobjs.c:5373
FT_Face_GetCharVariantIsDefault(FT_Face face, FT_ULong charcode, FT_ULong variantSelector)
Definition: ftobjs.c:3880
FT_Face_GetCharsOfVariant(FT_Face face, FT_ULong variantSelector)
Definition: ftobjs.c:3984
FT_MulDiv(FT_Long a, FT_Long b, FT_Long c)
Definition: ftcalc.c:416
FT_Set_Char_Size(FT_Face face, FT_F26Dot6 char_width, FT_F26Dot6 char_height, FT_UInt horz_resolution, FT_UInt vert_resolution)
Definition: ftobjs.c:3267
FT_Face_Properties(FT_Face face, FT_UInt num_properties, FT_Parameter *properties)
Definition: ftobjs.c:3755
FT_Reference_Face(FT_Face face)
Definition: ftobjs.c:2707
FT_Attach_File(FT_Face face, const char *filepathname)
Definition: ftobjs.c:2641
FT_New_Memory_Face(FT_Library library, const FT_Byte *file_base, FT_Long file_size, FT_Long face_index, FT_Face *aface)
Definition: ftobjs.c:1431
FT_MulFix(FT_Long a, FT_Long b)
Definition: ftcalc.c:509
FT_Load_Char(FT_Face face, FT_ULong char_code, FT_Int32 load_flags)
Definition: ftobjs.c:1037
FT_Init_FreeType(FT_Library *alibrary)
Definition: ftinit.c:320
struct FT_CharMapRec_ * FT_CharMap
Definition: freetype.h:588
FT_Vector * vec
Definition: ftbbox.c:448
#define FT_EXPORT(x)
Definition: ftconfig.h:461
#define FT_END_HEADER
Definition: ftheader.h:54
#define FT_BEGIN_HEADER
Definition: ftheader.h:36
enum FT_Glyph_Format_ FT_Glyph_Format
FT_BEGIN_HEADER typedef signed long FT_Pos
Definition: ftimage.h:58
typedefFT_BEGIN_HEADER struct FT_MemoryRec_ * FT_Memory
Definition: ftsystem.h:66
FT_BEGIN_HEADER typedef unsigned char FT_Bool
Definition: fttypes.h:108
signed long FT_F26Dot6
Definition: fttypes.h:276
unsigned long FT_ULong
Definition: fttypes.h:253
unsigned char FT_Byte
Definition: fttypes.h:154
signed long FT_Fixed
Definition: fttypes.h:288
int FT_Error
Definition: fttypes.h:300
signed long FT_Long
Definition: fttypes.h:242
unsigned short FT_UShort
Definition: fttypes.h:209
char FT_String
Definition: fttypes.h:187
signed short FT_Short
Definition: fttypes.h:198
unsigned int FT_UInt
Definition: fttypes.h:231
signed int FT_Int
Definition: fttypes.h:220
GLuint buffer
Definition: glext.h:5915
const GLubyte * c
Definition: glext.h:8905
GLenum GLuint GLint GLenum face
Definition: glext.h:7025
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLuint GLenum matrix
Definition: glext.h:9407
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
static unsigned int file_size
Definition: regtests2xml.c:47
FT_Pos y_ppem
Definition: freetype.h:379
FT_Pos x_ppem
Definition: freetype.h:378
FT_Short width
Definition: freetype.h:374
FT_Short height
Definition: freetype.h:373
FT_Face face
Definition: freetype.h:842
FT_Encoding encoding
Definition: freetype.h:843
FT_UShort platform_id
Definition: freetype.h:844
FT_UShort encoding_id
Definition: freetype.h:845
FT_Driver driver
Definition: freetype.h:1111
FT_Size size
Definition: freetype.h:1106
FT_Generic autohint
Definition: freetype.h:1117
FT_ListRec sizes_list
Definition: freetype.h:1115
FT_Bitmap_Size * available_sizes
Definition: freetype.h:1082
FT_Long num_glyphs
Definition: freetype.h:1076
FT_Short height
Definition: freetype.h:1097
FT_Short underline_thickness
Definition: freetype.h:1103
FT_Int num_charmaps
Definition: freetype.h:1084
FT_Short descender
Definition: freetype.h:1096
FT_Stream stream
Definition: freetype.h:1113
FT_BBox bbox
Definition: freetype.h:1092
void * extensions
Definition: freetype.h:1118
FT_UShort units_per_EM
Definition: freetype.h:1094
FT_Int num_fixed_sizes
Definition: freetype.h:1081
FT_Long style_flags
Definition: freetype.h:1074
FT_CharMap * charmaps
Definition: freetype.h:1085
FT_Long face_index
Definition: freetype.h:1071
FT_Short max_advance_height
Definition: freetype.h:1100
FT_String * style_name
Definition: freetype.h:1079
FT_Short underline_position
Definition: freetype.h:1102
FT_Short max_advance_width
Definition: freetype.h:1099
FT_CharMap charmap
Definition: freetype.h:1107
FT_String * family_name
Definition: freetype.h:1078
FT_GlyphSlot glyph
Definition: freetype.h:1105
FT_Face_Internal internal
Definition: freetype.h:1120
FT_Long face_flags
Definition: freetype.h:1073
FT_Memory memory
Definition: freetype.h:1112
FT_Long num_faces
Definition: freetype.h:1070
FT_Short ascender
Definition: freetype.h:1095
FT_Vector advance
Definition: freetype.h:1919
FT_Int bitmap_top
Definition: freetype.h:1925
FT_SubGlyph subglyphs
Definition: freetype.h:1930
void * control_data
Definition: freetype.h:1932
FT_Pos rsb_delta
Definition: freetype.h:1936
FT_Library library
Definition: freetype.h:1910
FT_UInt num_subglyphs
Definition: freetype.h:1929
FT_Pos lsb_delta
Definition: freetype.h:1935
FT_Int bitmap_left
Definition: freetype.h:1924
FT_Bitmap bitmap
Definition: freetype.h:1923
FT_Outline outline
Definition: freetype.h:1927
FT_Slot_Internal internal
Definition: freetype.h:1940
FT_Fixed linearHoriAdvance
Definition: freetype.h:1917
FT_Fixed linearVertAdvance
Definition: freetype.h:1918
FT_Glyph_Metrics metrics
Definition: freetype.h:1916
FT_UInt reserved
Definition: freetype.h:1913
FT_GlyphSlot next
Definition: freetype.h:1912
FT_Glyph_Format format
Definition: freetype.h:1921
FT_Pos horiBearingX
Definition: freetype.h:322
FT_Pos vertAdvance
Definition: freetype.h:328
FT_Pos vertBearingY
Definition: freetype.h:327
FT_Pos vertBearingX
Definition: freetype.h:326
FT_Pos horiAdvance
Definition: freetype.h:324
FT_Pos horiBearingY
Definition: freetype.h:323
const FT_Byte * memory_base
Definition: freetype.h:2138
FT_UInt flags
Definition: freetype.h:2137
FT_Parameter * params
Definition: freetype.h:2144
FT_Module driver
Definition: freetype.h:2142
FT_Long memory_size
Definition: freetype.h:2139
FT_Stream stream
Definition: freetype.h:2141
FT_String * pathname
Definition: freetype.h:2140
FT_Int num_params
Definition: freetype.h:2143
FT_ULong tag
Definition: freetype.h:2070
FT_Pointer data
Definition: freetype.h:2071
FT_Face face
Definition: freetype.h:1675
FT_Size_Internal internal
Definition: freetype.h:1678
FT_Size_Metrics metrics
Definition: freetype.h:1677
FT_Fixed y_scale
Definition: freetype.h:1644
FT_Fixed x_scale
Definition: freetype.h:1643
FT_Pos descender
Definition: freetype.h:1647
FT_UShort x_ppem
Definition: freetype.h:1640
FT_UShort y_ppem
Definition: freetype.h:1641
FT_Pos max_advance
Definition: freetype.h:1649
FT_UInt horiResolution
Definition: freetype.h:2622
FT_Size_Request_Type type
Definition: freetype.h:2619
FT_UInt vertResolution
Definition: freetype.h:2623
Definition: vfat.h:185
Definition: match.c:390
FT_UInt left_glyph
Definition: ttdriver.c:201
FT_UInt FT_UInt right_glyph
Definition: ttdriver.c:202
Definition: pdh_main.c:94
static char * encoding
Definition: xmllint.c:155