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