Update readme.md
[openttd-joker.git] / lib / shared / include / freetype.h
blobbca93e5b8fd7ae672070dbc52566da68d7ad7507
1 /***************************************************************************/
2 /* */
3 /* freetype.h */
4 /* */
5 /* FreeType high-level API and common types (specification only). */
6 /* */
7 /* Copyright 1996-2015 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 /***************************************************************************/
19 #ifndef __FREETYPE_H__
20 #define __FREETYPE_H__
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
32 #include <ft2build.h>
33 #include FT_CONFIG_CONFIG_H
34 #include FT_TYPES_H
35 #include FT_ERRORS_H
38 FT_BEGIN_HEADER
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 /*************************************************************************/
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 /*************************************************************************/
95 /*************************************************************************/
96 /*************************************************************************/
97 /* */
98 /* B A S I C T Y P E S */
99 /* */
100 /*************************************************************************/
101 /*************************************************************************/
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_GLYPH_NAMES */
142 /* FT_FACE_FLAG_EXTERNAL_STREAM */
143 /* FT_FACE_FLAG_HINTER */
144 /* FT_FACE_FLAG_TRICKY */
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_MULTIPLE_MASTERS */
152 /* FT_HAS_COLOR */
153 /* */
154 /* FT_IS_SFNT */
155 /* FT_IS_SCALABLE */
156 /* FT_IS_FIXED_WIDTH */
157 /* FT_IS_CID_KEYED */
158 /* FT_IS_TRICKY */
159 /* */
160 /* FT_STYLE_FLAG_BOLD */
161 /* FT_STYLE_FLAG_ITALIC */
162 /* */
163 /* FT_SizeRec */
164 /* FT_Size_Metrics */
165 /* */
166 /* FT_GlyphSlotRec */
167 /* FT_Glyph_Metrics */
168 /* FT_SubGlyph */
169 /* */
170 /* FT_Bitmap_Size */
171 /* */
172 /* FT_Init_FreeType */
173 /* FT_Done_FreeType */
174 /* */
175 /* FT_New_Face */
176 /* FT_Done_Face */
177 /* FT_Reference_Face */
178 /* FT_New_Memory_Face */
179 /* FT_Open_Face */
180 /* FT_Open_Args */
181 /* FT_Parameter */
182 /* FT_Attach_File */
183 /* FT_Attach_Stream */
184 /* */
185 /* FT_Set_Char_Size */
186 /* FT_Set_Pixel_Sizes */
187 /* FT_Request_Size */
188 /* FT_Select_Size */
189 /* FT_Size_Request_Type */
190 /* FT_Size_RequestRec */
191 /* FT_Size_Request */
192 /* FT_Set_Transform */
193 /* FT_Load_Glyph */
194 /* FT_Get_Char_Index */
195 /* FT_Get_First_Char */
196 /* FT_Get_Next_Char */
197 /* FT_Get_Name_Index */
198 /* FT_Load_Char */
199 /* */
200 /* FT_OPEN_MEMORY */
201 /* FT_OPEN_STREAM */
202 /* FT_OPEN_PATHNAME */
203 /* FT_OPEN_DRIVER */
204 /* FT_OPEN_PARAMS */
205 /* */
206 /* FT_LOAD_DEFAULT */
207 /* FT_LOAD_RENDER */
208 /* FT_LOAD_MONOCHROME */
209 /* FT_LOAD_LINEAR_DESIGN */
210 /* FT_LOAD_NO_SCALE */
211 /* FT_LOAD_NO_HINTING */
212 /* FT_LOAD_NO_BITMAP */
213 /* FT_LOAD_NO_AUTOHINT */
214 /* FT_LOAD_COLOR */
215 /* */
216 /* FT_LOAD_VERTICAL_LAYOUT */
217 /* FT_LOAD_IGNORE_TRANSFORM */
218 /* FT_LOAD_FORCE_AUTOHINT */
219 /* FT_LOAD_NO_RECURSE */
220 /* FT_LOAD_PEDANTIC */
221 /* */
222 /* FT_LOAD_TARGET_NORMAL */
223 /* FT_LOAD_TARGET_LIGHT */
224 /* FT_LOAD_TARGET_MONO */
225 /* FT_LOAD_TARGET_LCD */
226 /* FT_LOAD_TARGET_LCD_V */
227 /* */
228 /* FT_LOAD_TARGET_MODE */
229 /* */
230 /* FT_Render_Glyph */
231 /* FT_Render_Mode */
232 /* FT_Get_Kerning */
233 /* FT_Kerning_Mode */
234 /* FT_Get_Track_Kerning */
235 /* FT_Get_Glyph_Name */
236 /* FT_Get_Postscript_Name */
237 /* */
238 /* FT_CharMapRec */
239 /* FT_Select_Charmap */
240 /* FT_Set_Charmap */
241 /* FT_Get_Charmap_Index */
242 /* */
243 /* FT_Get_FSType_Flags */
244 /* FT_Get_SubGlyph_Info */
245 /* */
246 /* FT_Face_Internal */
247 /* FT_Size_Internal */
248 /* FT_Slot_Internal */
249 /* */
250 /* FT_FACE_FLAG_XXX */
251 /* FT_STYLE_FLAG_XXX */
252 /* FT_OPEN_XXX */
253 /* FT_LOAD_XXX */
254 /* FT_LOAD_TARGET_XXX */
255 /* FT_SUBGLYPH_FLAG_XXX */
256 /* FT_FSTYPE_XXX */
257 /* */
258 /* FT_HAS_FAST_GLYPHS */
259 /* */
260 /*************************************************************************/
263 /*************************************************************************/
264 /* */
265 /* <Struct> */
266 /* FT_Glyph_Metrics */
267 /* */
268 /* <Description> */
269 /* A structure used to model the metrics of a single glyph. The */
270 /* values are expressed in 26.6 fractional pixel format; if the flag */
271 /* @FT_LOAD_NO_SCALE has been used while loading the glyph, values */
272 /* are expressed in font units instead. */
273 /* */
274 /* <Fields> */
275 /* width :: */
276 /* The glyph's width. */
277 /* */
278 /* height :: */
279 /* The glyph's height. */
280 /* */
281 /* horiBearingX :: */
282 /* Left side bearing for horizontal layout. */
283 /* */
284 /* horiBearingY :: */
285 /* Top side bearing for horizontal layout. */
286 /* */
287 /* horiAdvance :: */
288 /* Advance width for horizontal layout. */
289 /* */
290 /* vertBearingX :: */
291 /* Left side bearing for vertical layout. */
292 /* */
293 /* vertBearingY :: */
294 /* Top side bearing for vertical layout. Larger positive values */
295 /* mean further below the vertical glyph origin. */
296 /* */
297 /* vertAdvance :: */
298 /* Advance height for vertical layout. Positive values mean the */
299 /* glyph has a positive advance downward. */
300 /* */
301 /* <Note> */
302 /* If not disabled with @FT_LOAD_NO_HINTING, the values represent */
303 /* dimensions of the hinted glyph (in case hinting is applicable). */
304 /* */
305 /* Stroking a glyph with an outside border does not increase */
306 /* `horiAdvance' or `vertAdvance'; you have to manually adjust these */
307 /* values to account for the added width and height. */
308 /* */
309 typedef struct FT_Glyph_Metrics_
311 FT_Pos width;
312 FT_Pos height;
314 FT_Pos horiBearingX;
315 FT_Pos horiBearingY;
316 FT_Pos horiAdvance;
318 FT_Pos vertBearingX;
319 FT_Pos vertBearingY;
320 FT_Pos vertAdvance;
322 } FT_Glyph_Metrics;
325 /*************************************************************************/
326 /* */
327 /* <Struct> */
328 /* FT_Bitmap_Size */
329 /* */
330 /* <Description> */
331 /* This structure models the metrics of a bitmap strike (i.e., a set */
332 /* of glyphs for a given point size and resolution) in a bitmap font. */
333 /* It is used for the `available_sizes' field of @FT_Face. */
334 /* */
335 /* <Fields> */
336 /* height :: The vertical distance, in pixels, between two */
337 /* consecutive baselines. It is always positive. */
338 /* */
339 /* width :: The average width, in pixels, of all glyphs in the */
340 /* strike. */
341 /* */
342 /* size :: The nominal size of the strike in 26.6 fractional */
343 /* points. This field is not very useful. */
344 /* */
345 /* x_ppem :: The horizontal ppem (nominal width) in 26.6 fractional */
346 /* pixels. */
347 /* */
348 /* y_ppem :: The vertical ppem (nominal height) in 26.6 fractional */
349 /* pixels. */
350 /* */
351 /* <Note> */
352 /* Windows FNT: */
353 /* The nominal size given in a FNT font is not reliable. Thus when */
354 /* the driver finds it incorrect, it sets `size' to some calculated */
355 /* values and sets `x_ppem' and `y_ppem' to the pixel width and */
356 /* height given in the font, respectively. */
357 /* */
358 /* TrueType embedded bitmaps: */
359 /* `size', `width', and `height' values are not contained in the */
360 /* bitmap strike itself. They are computed from the global font */
361 /* parameters. */
362 /* */
363 typedef struct FT_Bitmap_Size_
365 FT_Short height;
366 FT_Short width;
368 FT_Pos size;
370 FT_Pos x_ppem;
371 FT_Pos y_ppem;
373 } FT_Bitmap_Size;
376 /*************************************************************************/
377 /*************************************************************************/
378 /* */
379 /* O B J E C T C L A S S E S */
380 /* */
381 /*************************************************************************/
382 /*************************************************************************/
384 /*************************************************************************/
385 /* */
386 /* <Type> */
387 /* FT_Library */
388 /* */
389 /* <Description> */
390 /* A handle to a FreeType library instance. Each `library' is */
391 /* completely independent from the others; it is the `root' of a set */
392 /* of objects like fonts, faces, sizes, etc. */
393 /* */
394 /* It also embeds a memory manager (see @FT_Memory), as well as a */
395 /* scan-line converter object (see @FT_Raster). */
396 /* */
397 /* In multi-threaded applications it is easiest to use one */
398 /* `FT_Library' object per thread. In case this is too cumbersome, */
399 /* a single `FT_Library' object across threads is possible also */
400 /* (since FreeType version 2.5.6), as long as a mutex lock is used */
401 /* around @FT_New_Face and @FT_Done_Face. */
402 /* */
403 /* <Note> */
404 /* Library objects are normally created by @FT_Init_FreeType, and */
405 /* destroyed with @FT_Done_FreeType. If you need reference-counting */
406 /* (cf. @FT_Reference_Library), use @FT_New_Library and */
407 /* @FT_Done_Library. */
408 /* */
409 typedef struct FT_LibraryRec_ *FT_Library;
412 /*************************************************************************/
413 /* */
414 /* <Section> */
415 /* module_management */
416 /* */
417 /*************************************************************************/
419 /*************************************************************************/
420 /* */
421 /* <Type> */
422 /* FT_Module */
423 /* */
424 /* <Description> */
425 /* A handle to a given FreeType module object. Each module can be a */
426 /* font driver, a renderer, or anything else that provides services */
427 /* to the formers. */
428 /* */
429 typedef struct FT_ModuleRec_* FT_Module;
432 /*************************************************************************/
433 /* */
434 /* <Type> */
435 /* FT_Driver */
436 /* */
437 /* <Description> */
438 /* A handle to a given FreeType font driver object. Each font driver */
439 /* is a special module capable of creating faces from font files. */
440 /* */
441 typedef struct FT_DriverRec_* FT_Driver;
444 /*************************************************************************/
445 /* */
446 /* <Type> */
447 /* FT_Renderer */
448 /* */
449 /* <Description> */
450 /* A handle to a given FreeType renderer. A renderer is a special */
451 /* module in charge of converting a glyph image to a bitmap, when */
452 /* necessary. Each renderer supports a given glyph image format, and */
453 /* one or more target surface depths. */
454 /* */
455 typedef struct FT_RendererRec_* FT_Renderer;
458 /*************************************************************************/
459 /* */
460 /* <Section> */
461 /* base_interface */
462 /* */
463 /*************************************************************************/
465 /*************************************************************************/
466 /* */
467 /* <Type> */
468 /* FT_Face */
469 /* */
470 /* <Description> */
471 /* A handle to a given typographic face object. A face object models */
472 /* a given typeface, in a given style. */
473 /* */
474 /* <Note> */
475 /* Each face object also owns a single @FT_GlyphSlot object, as well */
476 /* as one or more @FT_Size objects. */
477 /* */
478 /* Use @FT_New_Face or @FT_Open_Face to create a new face object from */
479 /* a given filepathname or a custom input stream. */
480 /* */
481 /* Use @FT_Done_Face to destroy it (along with its slot and sizes). */
482 /* */
483 /* An `FT_Face' object can only be safely used from one thread at a */
484 /* time. Similarly, creation and destruction of `FT_Face' with the */
485 /* same @FT_Library object can only be done from one thread at a */
486 /* time. On the other hand, functions like @FT_Load_Glyph and its */
487 /* siblings are thread-safe and do not need the lock to be held as */
488 /* long as the same `FT_Face' object is not used from multiple */
489 /* threads at the same time. */
490 /* */
491 /* <Also> */
492 /* See @FT_FaceRec for the publicly accessible fields of a given face */
493 /* object. */
494 /* */
495 typedef struct FT_FaceRec_* FT_Face;
498 /*************************************************************************/
499 /* */
500 /* <Type> */
501 /* FT_Size */
502 /* */
503 /* <Description> */
504 /* A handle to an object used to model a face scaled to a given */
505 /* character size. */
506 /* */
507 /* <Note> */
508 /* Each @FT_Face has an _active_ @FT_Size object that is used by */
509 /* functions like @FT_Load_Glyph to determine the scaling */
510 /* transformation that in turn is used to load and hint glyphs and */
511 /* metrics. */
512 /* */
513 /* You can use @FT_Set_Char_Size, @FT_Set_Pixel_Sizes, */
514 /* @FT_Request_Size or even @FT_Select_Size to change the content */
515 /* (i.e., the scaling values) of the active @FT_Size. */
516 /* */
517 /* You can use @FT_New_Size to create additional size objects for a */
518 /* given @FT_Face, but they won't be used by other functions until */
519 /* you activate it through @FT_Activate_Size. Only one size can be */
520 /* activated at any given time per face. */
521 /* */
522 /* <Also> */
523 /* See @FT_SizeRec for the publicly accessible fields of a given size */
524 /* object. */
525 /* */
526 typedef struct FT_SizeRec_* FT_Size;
529 /*************************************************************************/
530 /* */
531 /* <Type> */
532 /* FT_GlyphSlot */
533 /* */
534 /* <Description> */
535 /* A handle to a given `glyph slot'. A slot is a container where it */
536 /* is possible to load any of the glyphs contained in its parent */
537 /* face. */
538 /* */
539 /* In other words, each time you call @FT_Load_Glyph or */
540 /* @FT_Load_Char, the slot's content is erased by the new glyph data, */
541 /* i.e., the glyph's metrics, its image (bitmap or outline), and */
542 /* other control information. */
543 /* */
544 /* <Also> */
545 /* See @FT_GlyphSlotRec for the publicly accessible glyph fields. */
546 /* */
547 typedef struct FT_GlyphSlotRec_* FT_GlyphSlot;
550 /*************************************************************************/
551 /* */
552 /* <Type> */
553 /* FT_CharMap */
554 /* */
555 /* <Description> */
556 /* A handle to a given character map. A charmap is used to translate */
557 /* character codes in a given encoding into glyph indexes for its */
558 /* parent's face. Some font formats may provide several charmaps per */
559 /* font. */
560 /* */
561 /* Each face object owns zero or more charmaps, but only one of them */
562 /* can be `active' and used by @FT_Get_Char_Index or @FT_Load_Char. */
563 /* */
564 /* The list of available charmaps in a face is available through the */
565 /* `face->num_charmaps' and `face->charmaps' fields of @FT_FaceRec. */
566 /* */
567 /* The currently active charmap is available as `face->charmap'. */
568 /* You should call @FT_Set_Charmap to change it. */
569 /* */
570 /* <Note> */
571 /* When a new face is created (either through @FT_New_Face or */
572 /* @FT_Open_Face), the library looks for a Unicode charmap within */
573 /* the list and automatically activates it. */
574 /* */
575 /* <Also> */
576 /* See @FT_CharMapRec for the publicly accessible fields of a given */
577 /* character map. */
578 /* */
579 typedef struct FT_CharMapRec_* FT_CharMap;
582 /*************************************************************************/
583 /* */
584 /* <Macro> */
585 /* FT_ENC_TAG */
586 /* */
587 /* <Description> */
588 /* This macro converts four-letter tags into an unsigned long. It is */
589 /* used to define `encoding' identifiers (see @FT_Encoding). */
590 /* */
591 /* <Note> */
592 /* Since many 16-bit compilers don't like 32-bit enumerations, you */
593 /* should redefine this macro in case of problems to something like */
594 /* this: */
595 /* */
596 /* { */
597 /* #define FT_ENC_TAG( value, a, b, c, d ) value */
598 /* } */
599 /* */
600 /* to get a simple enumeration without assigning special numbers. */
601 /* */
603 #ifndef FT_ENC_TAG
604 #define FT_ENC_TAG( value, a, b, c, d ) \
605 value = ( ( (FT_UInt32)(a) << 24 ) | \
606 ( (FT_UInt32)(b) << 16 ) | \
607 ( (FT_UInt32)(c) << 8 ) | \
608 (FT_UInt32)(d) )
610 #endif /* FT_ENC_TAG */
613 /*************************************************************************/
614 /* */
615 /* <Enum> */
616 /* FT_Encoding */
617 /* */
618 /* <Description> */
619 /* An enumeration used to specify character sets supported by */
620 /* charmaps. Used in the @FT_Select_Charmap API function. */
621 /* */
622 /* <Note> */
623 /* Despite the name, this enumeration lists specific character */
624 /* repertories (i.e., charsets), and not text encoding methods (e.g., */
625 /* UTF-8, UTF-16, etc.). */
626 /* */
627 /* Other encodings might be defined in the future. */
628 /* */
629 /* <Values> */
630 /* FT_ENCODING_NONE :: */
631 /* The encoding value~0 is reserved. */
632 /* */
633 /* FT_ENCODING_UNICODE :: */
634 /* Corresponds to the Unicode character set. This value covers */
635 /* all versions of the Unicode repertoire, including ASCII and */
636 /* Latin-1. Most fonts include a Unicode charmap, but not all */
637 /* of them. */
638 /* */
639 /* For example, if you want to access Unicode value U+1F028 (and */
640 /* the font contains it), use value 0x1F028 as the input value for */
641 /* @FT_Get_Char_Index. */
642 /* */
643 /* FT_ENCODING_MS_SYMBOL :: */
644 /* Corresponds to the Microsoft Symbol encoding, used to encode */
645 /* mathematical symbols and wingdings. For more information, see */
646 /* `http://www.microsoft.com/typography/otspec/recom.htm', */
647 /* `http://www.kostis.net/charsets/symbol.htm', and */
648 /* `http://www.kostis.net/charsets/wingding.htm'. */
649 /* */
650 /* This encoding uses character codes from the PUA (Private Unicode */
651 /* Area) in the range U+F020-U+F0FF. */
652 /* */
653 /* FT_ENCODING_SJIS :: */
654 /* Corresponds to Japanese SJIS encoding. More info at */
655 /* at `http://en.wikipedia.org/wiki/Shift_JIS'. */
656 /* See note on multi-byte encodings below. */
657 /* */
658 /* FT_ENCODING_GB2312 :: */
659 /* Corresponds to an encoding system for Simplified Chinese as used */
660 /* used in mainland China. */
661 /* */
662 /* FT_ENCODING_BIG5 :: */
663 /* Corresponds to an encoding system for Traditional Chinese as */
664 /* used in Taiwan and Hong Kong. */
665 /* */
666 /* FT_ENCODING_WANSUNG :: */
667 /* Corresponds to the Korean encoding system known as Wansung. */
668 /* For more information see */
669 /* `https://msdn.microsoft.com/en-US/goglobal/cc305154'. */
670 /* */
671 /* FT_ENCODING_JOHAB :: */
672 /* The Korean standard character set (KS~C 5601-1992), which */
673 /* corresponds to MS Windows code page 1361. This character set */
674 /* includes all possible Hangeul character combinations. */
675 /* */
676 /* FT_ENCODING_ADOBE_LATIN_1 :: */
677 /* Corresponds to a Latin-1 encoding as defined in a Type~1 */
678 /* PostScript font. It is limited to 256 character codes. */
679 /* */
680 /* FT_ENCODING_ADOBE_STANDARD :: */
681 /* Corresponds to the Adobe Standard encoding, as found in Type~1, */
682 /* CFF, and OpenType/CFF fonts. It is limited to 256 character */
683 /* codes. */
684 /* */
685 /* FT_ENCODING_ADOBE_EXPERT :: */
686 /* Corresponds to the Adobe Expert encoding, as found in Type~1, */
687 /* CFF, and OpenType/CFF fonts. It is limited to 256 character */
688 /* codes. */
689 /* */
690 /* FT_ENCODING_ADOBE_CUSTOM :: */
691 /* Corresponds to a custom encoding, as found in Type~1, CFF, and */
692 /* OpenType/CFF fonts. It is limited to 256 character codes. */
693 /* */
694 /* FT_ENCODING_APPLE_ROMAN :: */
695 /* Corresponds to the 8-bit Apple roman encoding. Many TrueType */
696 /* and OpenType fonts contain a charmap for this encoding, since */
697 /* older versions of Mac OS are able to use it. */
698 /* */
699 /* FT_ENCODING_OLD_LATIN_2 :: */
700 /* This value is deprecated and was never used nor reported by */
701 /* FreeType. Don't use or test for it. */
702 /* */
703 /* FT_ENCODING_MS_SJIS :: */
704 /* Same as FT_ENCODING_SJIS. Deprecated. */
705 /* */
706 /* FT_ENCODING_MS_GB2312 :: */
707 /* Same as FT_ENCODING_GB2312. Deprecated. */
708 /* */
709 /* FT_ENCODING_MS_BIG5 :: */
710 /* Same as FT_ENCODING_BIG5. Deprecated. */
711 /* */
712 /* FT_ENCODING_MS_WANSUNG :: */
713 /* Same as FT_ENCODING_WANSUNG. Deprecated. */
714 /* */
715 /* FT_ENCODING_MS_JOHAB :: */
716 /* Same as FT_ENCODING_JOHAB. Deprecated. */
717 /* */
718 /* <Note> */
719 /* By default, FreeType automatically synthesizes a Unicode charmap */
720 /* for PostScript fonts, using their glyph names dictionaries. */
721 /* However, it also reports the encodings defined explicitly in the */
722 /* font file, for the cases when they are needed, with the Adobe */
723 /* values as well. */
724 /* */
725 /* FT_ENCODING_NONE is set by the BDF and PCF drivers if the charmap */
726 /* is neither Unicode nor ISO-8859-1 (otherwise it is set to */
727 /* FT_ENCODING_UNICODE). Use @FT_Get_BDF_Charset_ID to find out */
728 /* which encoding is really present. If, for example, the */
729 /* `cs_registry' field is `KOI8' and the `cs_encoding' field is `R', */
730 /* the font is encoded in KOI8-R. */
731 /* */
732 /* FT_ENCODING_NONE is always set (with a single exception) by the */
733 /* winfonts driver. Use @FT_Get_WinFNT_Header and examine the */
734 /* `charset' field of the @FT_WinFNT_HeaderRec structure to find out */
735 /* which encoding is really present. For example, */
736 /* @FT_WinFNT_ID_CP1251 (204) means Windows code page 1251 (for */
737 /* Russian). */
738 /* */
739 /* FT_ENCODING_NONE is set if `platform_id' is @TT_PLATFORM_MACINTOSH */
740 /* and `encoding_id' is not @TT_MAC_ID_ROMAN (otherwise it is set to */
741 /* FT_ENCODING_APPLE_ROMAN). */
742 /* */
743 /* If `platform_id' is @TT_PLATFORM_MACINTOSH, use the function */
744 /* @FT_Get_CMap_Language_ID to query the Mac language ID that may */
745 /* be needed to be able to distinguish Apple encoding variants. See */
746 /* */
747 /* http://www.unicode.org/Public/MAPPINGS/VENDORS/APPLE/Readme.txt */
748 /* */
749 /* to get an idea how to do that. Basically, if the language ID */
750 /* is~0, don't use it, otherwise subtract 1 from the language ID. */
751 /* Then examine `encoding_id'. If, for example, `encoding_id' is */
752 /* @TT_MAC_ID_ROMAN and the language ID (minus~1) is */
753 /* `TT_MAC_LANGID_GREEK', it is the Greek encoding, not Roman. */
754 /* @TT_MAC_ID_ARABIC with `TT_MAC_LANGID_FARSI' means the Farsi */
755 /* variant the Arabic encoding. */
756 /* */
757 typedef enum FT_Encoding_
759 FT_ENC_TAG( FT_ENCODING_NONE, 0, 0, 0, 0 ),
761 FT_ENC_TAG( FT_ENCODING_MS_SYMBOL, 's', 'y', 'm', 'b' ),
762 FT_ENC_TAG( FT_ENCODING_UNICODE, 'u', 'n', 'i', 'c' ),
764 FT_ENC_TAG( FT_ENCODING_SJIS, 's', 'j', 'i', 's' ),
765 FT_ENC_TAG( FT_ENCODING_GB2312, 'g', 'b', ' ', ' ' ),
766 FT_ENC_TAG( FT_ENCODING_BIG5, 'b', 'i', 'g', '5' ),
767 FT_ENC_TAG( FT_ENCODING_WANSUNG, 'w', 'a', 'n', 's' ),
768 FT_ENC_TAG( FT_ENCODING_JOHAB, 'j', 'o', 'h', 'a' ),
770 /* for backwards compatibility */
771 FT_ENCODING_MS_SJIS = FT_ENCODING_SJIS,
772 FT_ENCODING_MS_GB2312 = FT_ENCODING_GB2312,
773 FT_ENCODING_MS_BIG5 = FT_ENCODING_BIG5,
774 FT_ENCODING_MS_WANSUNG = FT_ENCODING_WANSUNG,
775 FT_ENCODING_MS_JOHAB = FT_ENCODING_JOHAB,
777 FT_ENC_TAG( FT_ENCODING_ADOBE_STANDARD, 'A', 'D', 'O', 'B' ),
778 FT_ENC_TAG( FT_ENCODING_ADOBE_EXPERT, 'A', 'D', 'B', 'E' ),
779 FT_ENC_TAG( FT_ENCODING_ADOBE_CUSTOM, 'A', 'D', 'B', 'C' ),
780 FT_ENC_TAG( FT_ENCODING_ADOBE_LATIN_1, 'l', 'a', 't', '1' ),
782 FT_ENC_TAG( FT_ENCODING_OLD_LATIN_2, 'l', 'a', 't', '2' ),
784 FT_ENC_TAG( FT_ENCODING_APPLE_ROMAN, 'a', 'r', 'm', 'n' )
786 } FT_Encoding;
789 /* these constants are deprecated; use the corresponding `FT_Encoding' */
790 /* values instead */
791 #define ft_encoding_none FT_ENCODING_NONE
792 #define ft_encoding_unicode FT_ENCODING_UNICODE
793 #define ft_encoding_symbol FT_ENCODING_MS_SYMBOL
794 #define ft_encoding_latin_1 FT_ENCODING_ADOBE_LATIN_1
795 #define ft_encoding_latin_2 FT_ENCODING_OLD_LATIN_2
796 #define ft_encoding_sjis FT_ENCODING_SJIS
797 #define ft_encoding_gb2312 FT_ENCODING_GB2312
798 #define ft_encoding_big5 FT_ENCODING_BIG5
799 #define ft_encoding_wansung FT_ENCODING_WANSUNG
800 #define ft_encoding_johab FT_ENCODING_JOHAB
802 #define ft_encoding_adobe_standard FT_ENCODING_ADOBE_STANDARD
803 #define ft_encoding_adobe_expert FT_ENCODING_ADOBE_EXPERT
804 #define ft_encoding_adobe_custom FT_ENCODING_ADOBE_CUSTOM
805 #define ft_encoding_apple_roman FT_ENCODING_APPLE_ROMAN
808 /*************************************************************************/
809 /* */
810 /* <Struct> */
811 /* FT_CharMapRec */
812 /* */
813 /* <Description> */
814 /* The base charmap structure. */
815 /* */
816 /* <Fields> */
817 /* face :: A handle to the parent face object. */
818 /* */
819 /* encoding :: An @FT_Encoding tag identifying the charmap. Use */
820 /* this with @FT_Select_Charmap. */
821 /* */
822 /* platform_id :: An ID number describing the platform for the */
823 /* following encoding ID. This comes directly from */
824 /* the TrueType specification and should be emulated */
825 /* for other formats. */
826 /* */
827 /* encoding_id :: A platform specific encoding number. This also */
828 /* comes from the TrueType specification and should be */
829 /* emulated similarly. */
830 /* */
831 typedef struct FT_CharMapRec_
833 FT_Face face;
834 FT_Encoding encoding;
835 FT_UShort platform_id;
836 FT_UShort encoding_id;
838 } FT_CharMapRec;
841 /*************************************************************************/
842 /*************************************************************************/
843 /* */
844 /* B A S E O B J E C T C L A S S E S */
845 /* */
846 /*************************************************************************/
847 /*************************************************************************/
850 /*************************************************************************/
851 /* */
852 /* <Type> */
853 /* FT_Face_Internal */
854 /* */
855 /* <Description> */
856 /* An opaque handle to an `FT_Face_InternalRec' structure, used to */
857 /* model private data of a given @FT_Face object. */
858 /* */
859 /* This structure might change between releases of FreeType~2 and is */
860 /* not generally available to client applications. */
861 /* */
862 typedef struct FT_Face_InternalRec_* FT_Face_Internal;
865 /*************************************************************************/
866 /* */
867 /* <Struct> */
868 /* FT_FaceRec */
869 /* */
870 /* <Description> */
871 /* FreeType root face class structure. A face object models a */
872 /* typeface in a font file. */
873 /* */
874 /* <Fields> */
875 /* num_faces :: The number of faces in the font file. Some */
876 /* font formats can have multiple faces in */
877 /* a font file. */
878 /* */
879 /* face_index :: The index of the face in the font file. It */
880 /* is set to~0 if there is only one face in */
881 /* the font file. */
882 /* */
883 /* face_flags :: A set of bit flags that give important */
884 /* information about the face; see */
885 /* @FT_FACE_FLAG_XXX for the details. */
886 /* */
887 /* style_flags :: A set of bit flags indicating the style of */
888 /* the face; see @FT_STYLE_FLAG_XXX for the */
889 /* details. */
890 /* */
891 /* num_glyphs :: The number of glyphs in the face. If the */
892 /* face is scalable and has sbits (see */
893 /* `num_fixed_sizes'), it is set to the number */
894 /* of outline glyphs. */
895 /* */
896 /* For CID-keyed fonts, this value gives the */
897 /* highest CID used in the font. */
898 /* */
899 /* family_name :: The face's family name. This is an ASCII */
900 /* string, usually in English, that describes */
901 /* the typeface's family (like `Times New */
902 /* Roman', `Bodoni', `Garamond', etc). This */
903 /* is a least common denominator used to list */
904 /* fonts. Some formats (TrueType & OpenType) */
905 /* provide localized and Unicode versions of */
906 /* this string. Applications should use the */
907 /* format specific interface to access them. */
908 /* Can be NULL (e.g., in fonts embedded in a */
909 /* PDF file). */
910 /* */
911 /* In case the font doesn't provide a specific */
912 /* family name entry, FreeType tries to */
913 /* synthesize one, deriving it from other name */
914 /* entries. */
915 /* */
916 /* style_name :: The face's style name. This is an ASCII */
917 /* string, usually in English, that describes */
918 /* the typeface's style (like `Italic', */
919 /* `Bold', `Condensed', etc). Not all font */
920 /* formats provide a style name, so this field */
921 /* is optional, and can be set to NULL. As */
922 /* for `family_name', some formats provide */
923 /* localized and Unicode versions of this */
924 /* string. Applications should use the format */
925 /* specific interface to access them. */
926 /* */
927 /* num_fixed_sizes :: The number of bitmap strikes in the face. */
928 /* Even if the face is scalable, there might */
929 /* still be bitmap strikes, which are called */
930 /* `sbits' in that case. */
931 /* */
932 /* available_sizes :: An array of @FT_Bitmap_Size for all bitmap */
933 /* strikes in the face. It is set to NULL if */
934 /* there is no bitmap strike. */
935 /* */
936 /* num_charmaps :: The number of charmaps in the face. */
937 /* */
938 /* charmaps :: An array of the charmaps of the face. */
939 /* */
940 /* generic :: A field reserved for client uses. See the */
941 /* @FT_Generic type description. */
942 /* */
943 /* bbox :: The font bounding box. Coordinates are */
944 /* expressed in font units (see */
945 /* `units_per_EM'). The box is large enough */
946 /* to contain any glyph from the font. Thus, */
947 /* `bbox.yMax' can be seen as the `maximum */
948 /* ascender', and `bbox.yMin' as the `minimum */
949 /* descender'. Only relevant for scalable */
950 /* formats. */
951 /* */
952 /* Note that the bounding box might be off by */
953 /* (at least) one pixel for hinted fonts. See */
954 /* @FT_Size_Metrics for further discussion. */
955 /* */
956 /* units_per_EM :: The number of font units per EM square for */
957 /* this face. This is typically 2048 for */
958 /* TrueType fonts, and 1000 for Type~1 fonts. */
959 /* Only relevant for scalable formats. */
960 /* */
961 /* ascender :: The typographic ascender of the face, */
962 /* expressed in font units. For font formats */
963 /* not having this information, it is set to */
964 /* `bbox.yMax'. Only relevant for scalable */
965 /* formats. */
966 /* */
967 /* descender :: The typographic descender of the face, */
968 /* expressed in font units. For font formats */
969 /* not having this information, it is set to */
970 /* `bbox.yMin'. Note that this field is */
971 /* usually negative. Only relevant for */
972 /* scalable formats. */
973 /* */
974 /* height :: This value is the vertical distance */
975 /* between two consecutive baselines, */
976 /* expressed in font units. It is always */
977 /* positive. Only relevant for scalable */
978 /* formats. */
979 /* */
980 /* If you want the global glyph height, use */
981 /* `ascender - descender'. */
982 /* */
983 /* max_advance_width :: The maximum advance width, in font units, */
984 /* for all glyphs in this face. This can be */
985 /* used to make word wrapping computations */
986 /* faster. Only relevant for scalable */
987 /* formats. */
988 /* */
989 /* max_advance_height :: The maximum advance height, in font units, */
990 /* for all glyphs in this face. This is only */
991 /* relevant for vertical layouts, and is set */
992 /* to `height' for fonts that do not provide */
993 /* vertical metrics. Only relevant for */
994 /* scalable formats. */
995 /* */
996 /* underline_position :: The position, in font units, of the */
997 /* underline line for this face. It is the */
998 /* center of the underlining stem. Only */
999 /* relevant for scalable formats. */
1000 /* */
1001 /* underline_thickness :: The thickness, in font units, of the */
1002 /* underline for this face. Only relevant for */
1003 /* scalable formats. */
1004 /* */
1005 /* glyph :: The face's associated glyph slot(s). */
1006 /* */
1007 /* size :: The current active size for this face. */
1008 /* */
1009 /* charmap :: The current active charmap for this face. */
1010 /* */
1011 /* <Note> */
1012 /* Fields may be changed after a call to @FT_Attach_File or */
1013 /* @FT_Attach_Stream. */
1014 /* */
1015 typedef struct FT_FaceRec_
1017 FT_Long num_faces;
1018 FT_Long face_index;
1020 FT_Long face_flags;
1021 FT_Long style_flags;
1023 FT_Long num_glyphs;
1025 FT_String* family_name;
1026 FT_String* style_name;
1028 FT_Int num_fixed_sizes;
1029 FT_Bitmap_Size* available_sizes;
1031 FT_Int num_charmaps;
1032 FT_CharMap* charmaps;
1034 FT_Generic generic;
1036 /*# The following member variables (down to `underline_thickness') */
1037 /*# are only relevant to scalable outlines; cf. @FT_Bitmap_Size */
1038 /*# for bitmap fonts. */
1039 FT_BBox bbox;
1041 FT_UShort units_per_EM;
1042 FT_Short ascender;
1043 FT_Short descender;
1044 FT_Short height;
1046 FT_Short max_advance_width;
1047 FT_Short max_advance_height;
1049 FT_Short underline_position;
1050 FT_Short underline_thickness;
1052 FT_GlyphSlot glyph;
1053 FT_Size size;
1054 FT_CharMap charmap;
1056 /*@private begin */
1058 FT_Driver driver;
1059 FT_Memory memory;
1060 FT_Stream stream;
1062 FT_ListRec sizes_list;
1064 FT_Generic autohint; /* face-specific auto-hinter data */
1065 void* extensions; /* unused */
1067 FT_Face_Internal internal;
1069 /*@private end */
1071 } FT_FaceRec;
1074 /*************************************************************************/
1075 /* */
1076 /* <Enum> */
1077 /* FT_FACE_FLAG_XXX */
1078 /* */
1079 /* <Description> */
1080 /* A list of bit flags used in the `face_flags' field of the */
1081 /* @FT_FaceRec structure. They inform client applications of */
1082 /* properties of the corresponding face. */
1083 /* */
1084 /* <Values> */
1085 /* FT_FACE_FLAG_SCALABLE :: */
1086 /* Indicates that the face contains outline glyphs. This doesn't */
1087 /* prevent bitmap strikes, i.e., a face can have both this and */
1088 /* and @FT_FACE_FLAG_FIXED_SIZES set. */
1089 /* */
1090 /* FT_FACE_FLAG_FIXED_SIZES :: */
1091 /* Indicates that the face contains bitmap strikes. See also the */
1092 /* `num_fixed_sizes' and `available_sizes' fields of @FT_FaceRec. */
1093 /* */
1094 /* FT_FACE_FLAG_FIXED_WIDTH :: */
1095 /* Indicates that the face contains fixed-width characters (like */
1096 /* Courier, Lucido, MonoType, etc.). */
1097 /* */
1098 /* FT_FACE_FLAG_SFNT :: */
1099 /* Indicates that the face uses the `sfnt' storage scheme. For */
1100 /* now, this means TrueType and OpenType. */
1101 /* */
1102 /* FT_FACE_FLAG_HORIZONTAL :: */
1103 /* Indicates that the face contains horizontal glyph metrics. This */
1104 /* should be set for all common formats. */
1105 /* */
1106 /* FT_FACE_FLAG_VERTICAL :: */
1107 /* Indicates that the face contains vertical glyph metrics. This */
1108 /* is only available in some formats, not all of them. */
1109 /* */
1110 /* FT_FACE_FLAG_KERNING :: */
1111 /* Indicates that the face contains kerning information. If set, */
1112 /* the kerning distance can be retrieved through the function */
1113 /* @FT_Get_Kerning. Otherwise the function always return the */
1114 /* vector (0,0). Note that FreeType doesn't handle kerning data */
1115 /* from the `GPOS' table (as present in some OpenType fonts). */
1116 /* */
1117 /* FT_FACE_FLAG_FAST_GLYPHS :: */
1118 /* THIS FLAG IS DEPRECATED. DO NOT USE OR TEST IT. */
1119 /* */
1120 /* FT_FACE_FLAG_MULTIPLE_MASTERS :: */
1121 /* Indicates that the font contains multiple masters and is capable */
1122 /* of interpolating between them. See the multiple-masters */
1123 /* specific API for details. */
1124 /* */
1125 /* FT_FACE_FLAG_GLYPH_NAMES :: */
1126 /* Indicates that the font contains glyph names that can be */
1127 /* retrieved through @FT_Get_Glyph_Name. Note that some TrueType */
1128 /* fonts contain broken glyph name tables. Use the function */
1129 /* @FT_Has_PS_Glyph_Names when needed. */
1130 /* */
1131 /* FT_FACE_FLAG_EXTERNAL_STREAM :: */
1132 /* Used internally by FreeType to indicate that a face's stream was */
1133 /* provided by the client application and should not be destroyed */
1134 /* when @FT_Done_Face is called. Don't read or test this flag. */
1135 /* */
1136 /* FT_FACE_FLAG_HINTER :: */
1137 /* Set if the font driver has a hinting machine of its own. For */
1138 /* example, with TrueType fonts, it makes sense to use data from */
1139 /* the SFNT `gasp' table only if the native TrueType hinting engine */
1140 /* (with the bytecode interpreter) is available and active. */
1141 /* */
1142 /* FT_FACE_FLAG_CID_KEYED :: */
1143 /* Set if the font is CID-keyed. In that case, the font is not */
1144 /* accessed by glyph indices but by CID values. For subsetted */
1145 /* CID-keyed fonts this has the consequence that not all index */
1146 /* values are a valid argument to FT_Load_Glyph. Only the CID */
1147 /* values for which corresponding glyphs in the subsetted font */
1148 /* exist make FT_Load_Glyph return successfully; in all other cases */
1149 /* you get an `FT_Err_Invalid_Argument' error. */
1150 /* */
1151 /* Note that CID-keyed fonts that are in an SFNT wrapper don't */
1152 /* have this flag set since the glyphs are accessed in the normal */
1153 /* way (using contiguous indices); the `CID-ness' isn't visible to */
1154 /* the application. */
1155 /* */
1156 /* FT_FACE_FLAG_TRICKY :: */
1157 /* Set if the font is `tricky', this is, it always needs the */
1158 /* font format's native hinting engine to get a reasonable result. */
1159 /* A typical example is the Chinese font `mingli.ttf' that uses */
1160 /* TrueType bytecode instructions to move and scale all of its */
1161 /* subglyphs. */
1162 /* */
1163 /* It is not possible to auto-hint such fonts using */
1164 /* @FT_LOAD_FORCE_AUTOHINT; it will also ignore */
1165 /* @FT_LOAD_NO_HINTING. You have to set both @FT_LOAD_NO_HINTING */
1166 /* and @FT_LOAD_NO_AUTOHINT to really disable hinting; however, you */
1167 /* probably never want this except for demonstration purposes. */
1168 /* */
1169 /* Currently, there are about a dozen TrueType fonts in the list of */
1170 /* tricky fonts; they are hard-coded in file `ttobjs.c'. */
1171 /* */
1172 /* FT_FACE_FLAG_COLOR :: */
1173 /* Set if the font has color glyph tables. To access color glyphs */
1174 /* use @FT_LOAD_COLOR. */
1175 /* */
1176 #define FT_FACE_FLAG_SCALABLE ( 1L << 0 )
1177 #define FT_FACE_FLAG_FIXED_SIZES ( 1L << 1 )
1178 #define FT_FACE_FLAG_FIXED_WIDTH ( 1L << 2 )
1179 #define FT_FACE_FLAG_SFNT ( 1L << 3 )
1180 #define FT_FACE_FLAG_HORIZONTAL ( 1L << 4 )
1181 #define FT_FACE_FLAG_VERTICAL ( 1L << 5 )
1182 #define FT_FACE_FLAG_KERNING ( 1L << 6 )
1183 #define FT_FACE_FLAG_FAST_GLYPHS ( 1L << 7 )
1184 #define FT_FACE_FLAG_MULTIPLE_MASTERS ( 1L << 8 )
1185 #define FT_FACE_FLAG_GLYPH_NAMES ( 1L << 9 )
1186 #define FT_FACE_FLAG_EXTERNAL_STREAM ( 1L << 10 )
1187 #define FT_FACE_FLAG_HINTER ( 1L << 11 )
1188 #define FT_FACE_FLAG_CID_KEYED ( 1L << 12 )
1189 #define FT_FACE_FLAG_TRICKY ( 1L << 13 )
1190 #define FT_FACE_FLAG_COLOR ( 1L << 14 )
1193 /*************************************************************************
1195 * @macro:
1196 * FT_HAS_HORIZONTAL( face )
1198 * @description:
1199 * A macro that returns true whenever a face object contains
1200 * horizontal metrics (this is true for all font formats though).
1202 * @also:
1203 * @FT_HAS_VERTICAL can be used to check for vertical metrics.
1206 #define FT_HAS_HORIZONTAL( face ) \
1207 ( face->face_flags & FT_FACE_FLAG_HORIZONTAL )
1210 /*************************************************************************
1212 * @macro:
1213 * FT_HAS_VERTICAL( face )
1215 * @description:
1216 * A macro that returns true whenever a face object contains real
1217 * vertical metrics (and not only synthesized ones).
1220 #define FT_HAS_VERTICAL( face ) \
1221 ( face->face_flags & FT_FACE_FLAG_VERTICAL )
1224 /*************************************************************************
1226 * @macro:
1227 * FT_HAS_KERNING( face )
1229 * @description:
1230 * A macro that returns true whenever a face object contains kerning
1231 * data that can be accessed with @FT_Get_Kerning.
1234 #define FT_HAS_KERNING( face ) \
1235 ( face->face_flags & FT_FACE_FLAG_KERNING )
1238 /*************************************************************************
1240 * @macro:
1241 * FT_IS_SCALABLE( face )
1243 * @description:
1244 * A macro that returns true whenever a face object contains a scalable
1245 * font face (true for TrueType, Type~1, Type~42, CID, OpenType/CFF,
1246 * and PFR font formats.
1249 #define FT_IS_SCALABLE( face ) \
1250 ( face->face_flags & FT_FACE_FLAG_SCALABLE )
1253 /*************************************************************************
1255 * @macro:
1256 * FT_IS_SFNT( face )
1258 * @description:
1259 * A macro that returns true whenever a face object contains a font
1260 * whose format is based on the SFNT storage scheme. This usually
1261 * means: TrueType fonts, OpenType fonts, as well as SFNT-based embedded
1262 * bitmap fonts.
1264 * If this macro is true, all functions defined in @FT_SFNT_NAMES_H and
1265 * @FT_TRUETYPE_TABLES_H are available.
1268 #define FT_IS_SFNT( face ) \
1269 ( face->face_flags & FT_FACE_FLAG_SFNT )
1272 /*************************************************************************
1274 * @macro:
1275 * FT_IS_FIXED_WIDTH( face )
1277 * @description:
1278 * A macro that returns true whenever a face object contains a font face
1279 * that contains fixed-width (or `monospace', `fixed-pitch', etc.)
1280 * glyphs.
1283 #define FT_IS_FIXED_WIDTH( face ) \
1284 ( face->face_flags & FT_FACE_FLAG_FIXED_WIDTH )
1287 /*************************************************************************
1289 * @macro:
1290 * FT_HAS_FIXED_SIZES( face )
1292 * @description:
1293 * A macro that returns true whenever a face object contains some
1294 * embedded bitmaps. See the `available_sizes' field of the
1295 * @FT_FaceRec structure.
1298 #define FT_HAS_FIXED_SIZES( face ) \
1299 ( face->face_flags & FT_FACE_FLAG_FIXED_SIZES )
1302 /*************************************************************************
1304 * @macro:
1305 * FT_HAS_FAST_GLYPHS( face )
1307 * @description:
1308 * Deprecated.
1311 #define FT_HAS_FAST_GLYPHS( face ) 0
1314 /*************************************************************************
1316 * @macro:
1317 * FT_HAS_GLYPH_NAMES( face )
1319 * @description:
1320 * A macro that returns true whenever a face object contains some glyph
1321 * names that can be accessed through @FT_Get_Glyph_Name.
1324 #define FT_HAS_GLYPH_NAMES( face ) \
1325 ( face->face_flags & FT_FACE_FLAG_GLYPH_NAMES )
1328 /*************************************************************************
1330 * @macro:
1331 * FT_HAS_MULTIPLE_MASTERS( face )
1333 * @description:
1334 * A macro that returns true whenever a face object contains some
1335 * multiple masters. The functions provided by @FT_MULTIPLE_MASTERS_H
1336 * are then available to choose the exact design you want.
1339 #define FT_HAS_MULTIPLE_MASTERS( face ) \
1340 ( face->face_flags & FT_FACE_FLAG_MULTIPLE_MASTERS )
1343 /*************************************************************************
1345 * @macro:
1346 * FT_IS_CID_KEYED( face )
1348 * @description:
1349 * A macro that returns true whenever a face object contains a CID-keyed
1350 * font. See the discussion of @FT_FACE_FLAG_CID_KEYED for more
1351 * details.
1353 * If this macro is true, all functions defined in @FT_CID_H are
1354 * available.
1357 #define FT_IS_CID_KEYED( face ) \
1358 ( face->face_flags & FT_FACE_FLAG_CID_KEYED )
1361 /*************************************************************************
1363 * @macro:
1364 * FT_IS_TRICKY( face )
1366 * @description:
1367 * A macro that returns true whenever a face represents a `tricky' font.
1368 * See the discussion of @FT_FACE_FLAG_TRICKY for more details.
1371 #define FT_IS_TRICKY( face ) \
1372 ( face->face_flags & FT_FACE_FLAG_TRICKY )
1375 /*************************************************************************
1377 * @macro:
1378 * FT_HAS_COLOR( face )
1380 * @description:
1381 * A macro that returns true whenever a face object contains
1382 * tables for color glyphs.
1385 #define FT_HAS_COLOR( face ) \
1386 ( face->face_flags & FT_FACE_FLAG_COLOR )
1389 /*************************************************************************/
1390 /* */
1391 /* <Const> */
1392 /* FT_STYLE_FLAG_XXX */
1393 /* */
1394 /* <Description> */
1395 /* A list of bit-flags used to indicate the style of a given face. */
1396 /* These are used in the `style_flags' field of @FT_FaceRec. */
1397 /* */
1398 /* <Values> */
1399 /* FT_STYLE_FLAG_ITALIC :: */
1400 /* Indicates that a given face style is italic or oblique. */
1401 /* */
1402 /* FT_STYLE_FLAG_BOLD :: */
1403 /* Indicates that a given face is bold. */
1404 /* */
1405 /* <Note> */
1406 /* The style information as provided by FreeType is very basic. More */
1407 /* details are beyond the scope and should be done on a higher level */
1408 /* (for example, by analyzing various fields of the `OS/2' table in */
1409 /* SFNT based fonts). */
1410 /* */
1411 #define FT_STYLE_FLAG_ITALIC ( 1 << 0 )
1412 #define FT_STYLE_FLAG_BOLD ( 1 << 1 )
1415 /*************************************************************************/
1416 /* */
1417 /* <Type> */
1418 /* FT_Size_Internal */
1419 /* */
1420 /* <Description> */
1421 /* An opaque handle to an `FT_Size_InternalRec' structure, used to */
1422 /* model private data of a given @FT_Size object. */
1423 /* */
1424 typedef struct FT_Size_InternalRec_* FT_Size_Internal;
1427 /*************************************************************************/
1428 /* */
1429 /* <Struct> */
1430 /* FT_Size_Metrics */
1431 /* */
1432 /* <Description> */
1433 /* The size metrics structure gives the metrics of a size object. */
1434 /* */
1435 /* <Fields> */
1436 /* x_ppem :: The width of the scaled EM square in pixels, hence */
1437 /* the term `ppem' (pixels per EM). It is also */
1438 /* referred to as `nominal width'. */
1439 /* */
1440 /* y_ppem :: The height of the scaled EM square in pixels, */
1441 /* hence the term `ppem' (pixels per EM). It is also */
1442 /* referred to as `nominal height'. */
1443 /* */
1444 /* x_scale :: A 16.16 fractional scaling value used to convert */
1445 /* horizontal metrics from font units to 26.6 */
1446 /* fractional pixels. Only relevant for scalable */
1447 /* font formats. */
1448 /* */
1449 /* y_scale :: A 16.16 fractional scaling value used to convert */
1450 /* vertical metrics from font units to 26.6 */
1451 /* fractional pixels. Only relevant for scalable */
1452 /* font formats. */
1453 /* */
1454 /* ascender :: The ascender in 26.6 fractional pixels. See */
1455 /* @FT_FaceRec for the details. */
1456 /* */
1457 /* descender :: The descender in 26.6 fractional pixels. See */
1458 /* @FT_FaceRec for the details. */
1459 /* */
1460 /* height :: The height in 26.6 fractional pixels. See */
1461 /* @FT_FaceRec for the details. */
1462 /* */
1463 /* max_advance :: The maximum advance width in 26.6 fractional */
1464 /* pixels. See @FT_FaceRec for the details. */
1465 /* */
1466 /* <Note> */
1467 /* The scaling values, if relevant, are determined first during a */
1468 /* size changing operation. The remaining fields are then set by the */
1469 /* driver. For scalable formats, they are usually set to scaled */
1470 /* values of the corresponding fields in @FT_FaceRec. */
1471 /* */
1472 /* Note that due to glyph hinting, these values might not be exact */
1473 /* for certain fonts. Thus they must be treated as unreliable */
1474 /* with an error margin of at least one pixel! */
1475 /* */
1476 /* Indeed, the only way to get the exact metrics is to render _all_ */
1477 /* glyphs. As this would be a definite performance hit, it is up to */
1478 /* client applications to perform such computations. */
1479 /* */
1480 /* The FT_Size_Metrics structure is valid for bitmap fonts also. */
1481 /* */
1482 typedef struct FT_Size_Metrics_
1484 FT_UShort x_ppem; /* horizontal pixels per EM */
1485 FT_UShort y_ppem; /* vertical pixels per EM */
1487 FT_Fixed x_scale; /* scaling values used to convert font */
1488 FT_Fixed y_scale; /* units to 26.6 fractional pixels */
1490 FT_Pos ascender; /* ascender in 26.6 frac. pixels */
1491 FT_Pos descender; /* descender in 26.6 frac. pixels */
1492 FT_Pos height; /* text height in 26.6 frac. pixels */
1493 FT_Pos max_advance; /* max horizontal advance, in 26.6 pixels */
1495 } FT_Size_Metrics;
1498 /*************************************************************************/
1499 /* */
1500 /* <Struct> */
1501 /* FT_SizeRec */
1502 /* */
1503 /* <Description> */
1504 /* FreeType root size class structure. A size object models a face */
1505 /* object at a given size. */
1506 /* */
1507 /* <Fields> */
1508 /* face :: Handle to the parent face object. */
1509 /* */
1510 /* generic :: A typeless pointer, unused by the FreeType library or */
1511 /* any of its drivers. It can be used by client */
1512 /* applications to link their own data to each size */
1513 /* object. */
1514 /* */
1515 /* metrics :: Metrics for this size object. This field is read-only. */
1516 /* */
1517 typedef struct FT_SizeRec_
1519 FT_Face face; /* parent face object */
1520 FT_Generic generic; /* generic pointer for client uses */
1521 FT_Size_Metrics metrics; /* size metrics */
1522 FT_Size_Internal internal;
1524 } FT_SizeRec;
1527 /*************************************************************************/
1528 /* */
1529 /* <Struct> */
1530 /* FT_SubGlyph */
1531 /* */
1532 /* <Description> */
1533 /* The subglyph structure is an internal object used to describe */
1534 /* subglyphs (for example, in the case of composites). */
1535 /* */
1536 /* <Note> */
1537 /* The subglyph implementation is not part of the high-level API, */
1538 /* hence the forward structure declaration. */
1539 /* */
1540 /* You can however retrieve subglyph information with */
1541 /* @FT_Get_SubGlyph_Info. */
1542 /* */
1543 typedef struct FT_SubGlyphRec_* FT_SubGlyph;
1546 /*************************************************************************/
1547 /* */
1548 /* <Type> */
1549 /* FT_Slot_Internal */
1550 /* */
1551 /* <Description> */
1552 /* An opaque handle to an `FT_Slot_InternalRec' structure, used to */
1553 /* model private data of a given @FT_GlyphSlot object. */
1554 /* */
1555 typedef struct FT_Slot_InternalRec_* FT_Slot_Internal;
1558 /*************************************************************************/
1559 /* */
1560 /* <Struct> */
1561 /* FT_GlyphSlotRec */
1562 /* */
1563 /* <Description> */
1564 /* FreeType root glyph slot class structure. A glyph slot is a */
1565 /* container where individual glyphs can be loaded, be they in */
1566 /* outline or bitmap format. */
1567 /* */
1568 /* <Fields> */
1569 /* library :: A handle to the FreeType library instance */
1570 /* this slot belongs to. */
1571 /* */
1572 /* face :: A handle to the parent face object. */
1573 /* */
1574 /* next :: In some cases (like some font tools), several */
1575 /* glyph slots per face object can be a good */
1576 /* thing. As this is rare, the glyph slots are */
1577 /* listed through a direct, single-linked list */
1578 /* using its `next' field. */
1579 /* */
1580 /* generic :: A typeless pointer unused by the FreeType */
1581 /* library or any of its drivers. It can be */
1582 /* used by client applications to link their own */
1583 /* data to each glyph slot object. */
1584 /* */
1585 /* metrics :: The metrics of the last loaded glyph in the */
1586 /* slot. The returned values depend on the last */
1587 /* load flags (see the @FT_Load_Glyph API */
1588 /* function) and can be expressed either in 26.6 */
1589 /* fractional pixels or font units. */
1590 /* */
1591 /* Note that even when the glyph image is */
1592 /* transformed, the metrics are not. */
1593 /* */
1594 /* linearHoriAdvance :: The advance width of the unhinted glyph. */
1595 /* Its value is expressed in 16.16 fractional */
1596 /* pixels, unless @FT_LOAD_LINEAR_DESIGN is set */
1597 /* when loading the glyph. This field can be */
1598 /* important to perform correct WYSIWYG layout. */
1599 /* Only relevant for outline glyphs. */
1600 /* */
1601 /* linearVertAdvance :: The advance height of the unhinted glyph. */
1602 /* Its value is expressed in 16.16 fractional */
1603 /* pixels, unless @FT_LOAD_LINEAR_DESIGN is set */
1604 /* when loading the glyph. This field can be */
1605 /* important to perform correct WYSIWYG layout. */
1606 /* Only relevant for outline glyphs. */
1607 /* */
1608 /* advance :: This shorthand is, depending on */
1609 /* @FT_LOAD_IGNORE_TRANSFORM, the transformed */
1610 /* (hinted) advance width for the glyph, in 26.6 */
1611 /* fractional pixel format. As specified with */
1612 /* @FT_LOAD_VERTICAL_LAYOUT, it uses either the */
1613 /* `horiAdvance' or the `vertAdvance' value of */
1614 /* `metrics' field. */
1615 /* */
1616 /* format :: This field indicates the format of the image */
1617 /* contained in the glyph slot. Typically */
1618 /* @FT_GLYPH_FORMAT_BITMAP, */
1619 /* @FT_GLYPH_FORMAT_OUTLINE, or */
1620 /* @FT_GLYPH_FORMAT_COMPOSITE, but others are */
1621 /* possible. */
1622 /* */
1623 /* bitmap :: This field is used as a bitmap descriptor */
1624 /* when the slot format is */
1625 /* @FT_GLYPH_FORMAT_BITMAP. Note that the */
1626 /* address and content of the bitmap buffer can */
1627 /* change between calls of @FT_Load_Glyph and a */
1628 /* few other functions. */
1629 /* */
1630 /* bitmap_left :: The bitmap's left bearing expressed in */
1631 /* integer pixels. Only valid if the format is */
1632 /* @FT_GLYPH_FORMAT_BITMAP, this is, if the */
1633 /* glyph slot contains a bitmap. */
1634 /* */
1635 /* bitmap_top :: The bitmap's top bearing expressed in integer */
1636 /* pixels. Remember that this is the distance */
1637 /* from the baseline to the top-most glyph */
1638 /* scanline, upwards y~coordinates being */
1639 /* *positive*. */
1640 /* */
1641 /* outline :: The outline descriptor for the current glyph */
1642 /* image if its format is */
1643 /* @FT_GLYPH_FORMAT_OUTLINE. Once a glyph is */
1644 /* loaded, `outline' can be transformed, */
1645 /* distorted, embolded, etc. However, it must */
1646 /* not be freed. */
1647 /* */
1648 /* num_subglyphs :: The number of subglyphs in a composite glyph. */
1649 /* This field is only valid for the composite */
1650 /* glyph format that should normally only be */
1651 /* loaded with the @FT_LOAD_NO_RECURSE flag. */
1652 /* */
1653 /* subglyphs :: An array of subglyph descriptors for */
1654 /* composite glyphs. There are `num_subglyphs' */
1655 /* elements in there. Currently internal to */
1656 /* FreeType. */
1657 /* */
1658 /* control_data :: Certain font drivers can also return the */
1659 /* control data for a given glyph image (e.g. */
1660 /* TrueType bytecode, Type~1 charstrings, etc.). */
1661 /* This field is a pointer to such data. */
1662 /* */
1663 /* control_len :: This is the length in bytes of the control */
1664 /* data. */
1665 /* */
1666 /* other :: Really wicked formats can use this pointer to */
1667 /* present their own glyph image to client */
1668 /* applications. Note that the application */
1669 /* needs to know about the image format. */
1670 /* */
1671 /* lsb_delta :: The difference between hinted and unhinted */
1672 /* left side bearing while auto-hinting is */
1673 /* active. Zero otherwise. */
1674 /* */
1675 /* rsb_delta :: The difference between hinted and unhinted */
1676 /* right side bearing while auto-hinting is */
1677 /* active. Zero otherwise. */
1678 /* */
1679 /* <Note> */
1680 /* If @FT_Load_Glyph is called with default flags (see */
1681 /* @FT_LOAD_DEFAULT) the glyph image is loaded in the glyph slot in */
1682 /* its native format (e.g., an outline glyph for TrueType and Type~1 */
1683 /* formats). */
1684 /* */
1685 /* This image can later be converted into a bitmap by calling */
1686 /* @FT_Render_Glyph. This function finds the current renderer for */
1687 /* the native image's format, then invokes it. */
1688 /* */
1689 /* The renderer is in charge of transforming the native image through */
1690 /* the slot's face transformation fields, then converting it into a */
1691 /* bitmap that is returned in `slot->bitmap'. */
1692 /* */
1693 /* Note that `slot->bitmap_left' and `slot->bitmap_top' are also used */
1694 /* to specify the position of the bitmap relative to the current pen */
1695 /* position (e.g., coordinates (0,0) on the baseline). Of course, */
1696 /* `slot->format' is also changed to @FT_GLYPH_FORMAT_BITMAP. */
1697 /* */
1698 /* <Note> */
1699 /* Here is a small pseudo code fragment that shows how to use */
1700 /* `lsb_delta' and `rsb_delta': */
1701 /* */
1702 /* { */
1703 /* FT_Pos origin_x = 0; */
1704 /* FT_Pos prev_rsb_delta = 0; */
1705 /* */
1706 /* */
1707 /* for all glyphs do */
1708 /* <compute kern between current and previous glyph and add it to */
1709 /* `origin_x'> */
1710 /* */
1711 /* <load glyph with `FT_Load_Glyph'> */
1712 /* */
1713 /* if ( prev_rsb_delta - face->glyph->lsb_delta >= 32 ) */
1714 /* origin_x -= 64; */
1715 /* else if ( prev_rsb_delta - face->glyph->lsb_delta < -32 ) */
1716 /* origin_x += 64; */
1717 /* */
1718 /* prev_rsb_delta = face->glyph->rsb_delta; */
1719 /* */
1720 /* <save glyph image, or render glyph, or ...> */
1721 /* */
1722 /* origin_x += face->glyph->advance.x; */
1723 /* endfor */
1724 /* } */
1725 /* */
1726 typedef struct FT_GlyphSlotRec_
1728 FT_Library library;
1729 FT_Face face;
1730 FT_GlyphSlot next;
1731 FT_UInt reserved; /* retained for binary compatibility */
1732 FT_Generic generic;
1734 FT_Glyph_Metrics metrics;
1735 FT_Fixed linearHoriAdvance;
1736 FT_Fixed linearVertAdvance;
1737 FT_Vector advance;
1739 FT_Glyph_Format format;
1741 FT_Bitmap bitmap;
1742 FT_Int bitmap_left;
1743 FT_Int bitmap_top;
1745 FT_Outline outline;
1747 FT_UInt num_subglyphs;
1748 FT_SubGlyph subglyphs;
1750 void* control_data;
1751 long control_len;
1753 FT_Pos lsb_delta;
1754 FT_Pos rsb_delta;
1756 void* other;
1758 FT_Slot_Internal internal;
1760 } FT_GlyphSlotRec;
1763 /*************************************************************************/
1764 /*************************************************************************/
1765 /* */
1766 /* F U N C T I O N S */
1767 /* */
1768 /*************************************************************************/
1769 /*************************************************************************/
1772 /*************************************************************************/
1773 /* */
1774 /* <Function> */
1775 /* FT_Init_FreeType */
1776 /* */
1777 /* <Description> */
1778 /* Initialize a new FreeType library object. The set of modules */
1779 /* that are registered by this function is determined at build time. */
1780 /* */
1781 /* <Output> */
1782 /* alibrary :: A handle to a new library object. */
1783 /* */
1784 /* <Return> */
1785 /* FreeType error code. 0~means success. */
1786 /* */
1787 /* <Note> */
1788 /* In case you want to provide your own memory allocating routines, */
1789 /* use @FT_New_Library instead, followed by a call to */
1790 /* @FT_Add_Default_Modules (or a series of calls to @FT_Add_Module). */
1791 /* */
1792 /* See the documentation of @FT_Library and @FT_Face for */
1793 /* multi-threading issues. */
1794 /* */
1795 /* If you need reference-counting (cf. @FT_Reference_Library), use */
1796 /* @FT_New_Library and @FT_Done_Library. */
1797 /* */
1798 FT_EXPORT( FT_Error )
1799 FT_Init_FreeType( FT_Library *alibrary );
1802 /*************************************************************************/
1803 /* */
1804 /* <Function> */
1805 /* FT_Done_FreeType */
1806 /* */
1807 /* <Description> */
1808 /* Destroy a given FreeType library object and all of its children, */
1809 /* including resources, drivers, faces, sizes, etc. */
1810 /* */
1811 /* <Input> */
1812 /* library :: A handle to the target library object. */
1813 /* */
1814 /* <Return> */
1815 /* FreeType error code. 0~means success. */
1816 /* */
1817 FT_EXPORT( FT_Error )
1818 FT_Done_FreeType( FT_Library library );
1821 /*************************************************************************/
1822 /* */
1823 /* <Enum> */
1824 /* FT_OPEN_XXX */
1825 /* */
1826 /* <Description> */
1827 /* A list of bit-field constants used within the `flags' field of the */
1828 /* @FT_Open_Args structure. */
1829 /* */
1830 /* <Values> */
1831 /* FT_OPEN_MEMORY :: This is a memory-based stream. */
1832 /* */
1833 /* FT_OPEN_STREAM :: Copy the stream from the `stream' field. */
1834 /* */
1835 /* FT_OPEN_PATHNAME :: Create a new input stream from a C~path */
1836 /* name. */
1837 /* */
1838 /* FT_OPEN_DRIVER :: Use the `driver' field. */
1839 /* */
1840 /* FT_OPEN_PARAMS :: Use the `num_params' and `params' fields. */
1841 /* */
1842 /* <Note> */
1843 /* The `FT_OPEN_MEMORY', `FT_OPEN_STREAM', and `FT_OPEN_PATHNAME' */
1844 /* flags are mutually exclusive. */
1845 /* */
1846 #define FT_OPEN_MEMORY 0x1
1847 #define FT_OPEN_STREAM 0x2
1848 #define FT_OPEN_PATHNAME 0x4
1849 #define FT_OPEN_DRIVER 0x8
1850 #define FT_OPEN_PARAMS 0x10
1853 /* these constants are deprecated; use the corresponding `FT_OPEN_XXX' */
1854 /* values instead */
1855 #define ft_open_memory FT_OPEN_MEMORY
1856 #define ft_open_stream FT_OPEN_STREAM
1857 #define ft_open_pathname FT_OPEN_PATHNAME
1858 #define ft_open_driver FT_OPEN_DRIVER
1859 #define ft_open_params FT_OPEN_PARAMS
1862 /*************************************************************************/
1863 /* */
1864 /* <Struct> */
1865 /* FT_Parameter */
1866 /* */
1867 /* <Description> */
1868 /* A simple structure used to pass more or less generic parameters to */
1869 /* @FT_Open_Face. */
1870 /* */
1871 /* <Fields> */
1872 /* tag :: A four-byte identification tag. */
1873 /* */
1874 /* data :: A pointer to the parameter data. */
1875 /* */
1876 /* <Note> */
1877 /* The ID and function of parameters are driver-specific. See the */
1878 /* various FT_PARAM_TAG_XXX flags for more information. */
1879 /* */
1880 typedef struct FT_Parameter_
1882 FT_ULong tag;
1883 FT_Pointer data;
1885 } FT_Parameter;
1888 /*************************************************************************/
1889 /* */
1890 /* <Struct> */
1891 /* FT_Open_Args */
1892 /* */
1893 /* <Description> */
1894 /* A structure used to indicate how to open a new font file or */
1895 /* stream. A pointer to such a structure can be used as a parameter */
1896 /* for the functions @FT_Open_Face and @FT_Attach_Stream. */
1897 /* */
1898 /* <Fields> */
1899 /* flags :: A set of bit flags indicating how to use the */
1900 /* structure. */
1901 /* */
1902 /* memory_base :: The first byte of the file in memory. */
1903 /* */
1904 /* memory_size :: The size in bytes of the file in memory. */
1905 /* */
1906 /* pathname :: A pointer to an 8-bit file pathname. */
1907 /* */
1908 /* stream :: A handle to a source stream object. */
1909 /* */
1910 /* driver :: This field is exclusively used by @FT_Open_Face; */
1911 /* it simply specifies the font driver to use to open */
1912 /* the face. If set to~0, FreeType tries to load the */
1913 /* face with each one of the drivers in its list. */
1914 /* */
1915 /* num_params :: The number of extra parameters. */
1916 /* */
1917 /* params :: Extra parameters passed to the font driver when */
1918 /* opening a new face. */
1919 /* */
1920 /* <Note> */
1921 /* The stream type is determined by the contents of `flags' that */
1922 /* are tested in the following order by @FT_Open_Face: */
1923 /* */
1924 /* If the @FT_OPEN_MEMORY bit is set, assume that this is a */
1925 /* memory file of `memory_size' bytes, located at `memory_address'. */
1926 /* The data are are not copied, and the client is responsible for */
1927 /* releasing and destroying them _after_ the corresponding call to */
1928 /* @FT_Done_Face. */
1929 /* */
1930 /* Otherwise, if the @FT_OPEN_STREAM bit is set, assume that a */
1931 /* custom input stream `stream' is used. */
1932 /* */
1933 /* Otherwise, if the @FT_OPEN_PATHNAME bit is set, assume that this */
1934 /* is a normal file and use `pathname' to open it. */
1935 /* */
1936 /* If the @FT_OPEN_DRIVER bit is set, @FT_Open_Face only tries to */
1937 /* open the file with the driver whose handler is in `driver'. */
1938 /* */
1939 /* If the @FT_OPEN_PARAMS bit is set, the parameters given by */
1940 /* `num_params' and `params' is used. They are ignored otherwise. */
1941 /* */
1942 /* Ideally, both the `pathname' and `params' fields should be tagged */
1943 /* as `const'; this is missing for API backwards compatibility. In */
1944 /* other words, applications should treat them as read-only. */
1945 /* */
1946 typedef struct FT_Open_Args_
1948 FT_UInt flags;
1949 const FT_Byte* memory_base;
1950 FT_Long memory_size;
1951 FT_String* pathname;
1952 FT_Stream stream;
1953 FT_Module driver;
1954 FT_Int num_params;
1955 FT_Parameter* params;
1957 } FT_Open_Args;
1960 /*************************************************************************/
1961 /* */
1962 /* <Function> */
1963 /* FT_New_Face */
1964 /* */
1965 /* <Description> */
1966 /* This function calls @FT_Open_Face to open a font by its pathname. */
1967 /* */
1968 /* <InOut> */
1969 /* library :: A handle to the library resource. */
1970 /* */
1971 /* <Input> */
1972 /* pathname :: A path to the font file. */
1973 /* */
1974 /* face_index :: The index of the face within the font. The first */
1975 /* face has index~0. */
1976 /* */
1977 /* <Output> */
1978 /* aface :: A handle to a new face object. If `face_index' is */
1979 /* greater than or equal to zero, it must be non-NULL. */
1980 /* See @FT_Open_Face for more details. */
1981 /* */
1982 /* <Return> */
1983 /* FreeType error code. 0~means success. */
1984 /* */
1985 /* <Note> */
1986 /* Use @FT_Done_Face to destroy the created @FT_Face object (along */
1987 /* with its slot and sizes). */
1988 /* */
1989 FT_EXPORT( FT_Error )
1990 FT_New_Face( FT_Library library,
1991 const char* filepathname,
1992 FT_Long face_index,
1993 FT_Face *aface );
1996 /*************************************************************************/
1997 /* */
1998 /* <Function> */
1999 /* FT_New_Memory_Face */
2000 /* */
2001 /* <Description> */
2002 /* This function calls @FT_Open_Face to open a font that has been */
2003 /* loaded into memory. */
2004 /* */
2005 /* <InOut> */
2006 /* library :: A handle to the library resource. */
2007 /* */
2008 /* <Input> */
2009 /* file_base :: A pointer to the beginning of the font data. */
2010 /* */
2011 /* file_size :: The size of the memory chunk used by the font data. */
2012 /* */
2013 /* face_index :: The index of the face within the font. The first */
2014 /* face has index~0. */
2015 /* */
2016 /* <Output> */
2017 /* aface :: A handle to a new face object. If `face_index' is */
2018 /* greater than or equal to zero, it must be non-NULL. */
2019 /* See @FT_Open_Face for more details. */
2020 /* */
2021 /* <Return> */
2022 /* FreeType error code. 0~means success. */
2023 /* */
2024 /* <Note> */
2025 /* You must not deallocate the memory before calling @FT_Done_Face. */
2026 /* */
2027 FT_EXPORT( FT_Error )
2028 FT_New_Memory_Face( FT_Library library,
2029 const FT_Byte* file_base,
2030 FT_Long file_size,
2031 FT_Long face_index,
2032 FT_Face *aface );
2035 /*************************************************************************/
2036 /* */
2037 /* <Function> */
2038 /* FT_Open_Face */
2039 /* */
2040 /* <Description> */
2041 /* Create a face object from a given resource described by */
2042 /* @FT_Open_Args. */
2043 /* */
2044 /* <InOut> */
2045 /* library :: A handle to the library resource. */
2046 /* */
2047 /* <Input> */
2048 /* args :: A pointer to an `FT_Open_Args' structure that must */
2049 /* be filled by the caller. */
2050 /* */
2051 /* face_index :: The index of the face within the font. The first */
2052 /* face has index~0. */
2053 /* */
2054 /* <Output> */
2055 /* aface :: A handle to a new face object. If `face_index' is */
2056 /* greater than or equal to zero, it must be non-NULL. */
2057 /* See note below. */
2058 /* */
2059 /* <Return> */
2060 /* FreeType error code. 0~means success. */
2061 /* */
2062 /* <Note> */
2063 /* Unlike FreeType 1.x, this function automatically creates a glyph */
2064 /* slot for the face object that can be accessed directly through */
2065 /* `face->glyph'. */
2066 /* */
2067 /* FT_Open_Face can be used to quickly check whether the font */
2068 /* format of a given font resource is supported by FreeType. If the */
2069 /* `face_index' field is negative, the function's return value is~0 */
2070 /* if the font format is recognized, or non-zero otherwise; */
2071 /* the function returns a more or less empty face handle in `*aface' */
2072 /* (if `aface' isn't NULL). The only useful field in this special */
2073 /* case is `face->num_faces' that gives the number of faces within */
2074 /* the font file. After examination, the returned @FT_Face structure */
2075 /* should be deallocated with a call to @FT_Done_Face. */
2076 /* */
2077 /* Each new face object created with this function also owns a */
2078 /* default @FT_Size object, accessible as `face->size'. */
2079 /* */
2080 /* One @FT_Library instance can have multiple face objects, this is, */
2081 /* @FT_Open_Face and its siblings can be called multiple times using */
2082 /* the same `library' argument. */
2083 /* */
2084 /* See the discussion of reference counters in the description of */
2085 /* @FT_Reference_Face. */
2086 /* */
2087 FT_EXPORT( FT_Error )
2088 FT_Open_Face( FT_Library library,
2089 const FT_Open_Args* args,
2090 FT_Long face_index,
2091 FT_Face *aface );
2094 /*************************************************************************/
2095 /* */
2096 /* <Function> */
2097 /* FT_Attach_File */
2098 /* */
2099 /* <Description> */
2100 /* This function calls @FT_Attach_Stream to attach a file. */
2101 /* */
2102 /* <InOut> */
2103 /* face :: The target face object. */
2104 /* */
2105 /* <Input> */
2106 /* filepathname :: The pathname. */
2107 /* */
2108 /* <Return> */
2109 /* FreeType error code. 0~means success. */
2110 /* */
2111 FT_EXPORT( FT_Error )
2112 FT_Attach_File( FT_Face face,
2113 const char* filepathname );
2116 /*************************************************************************/
2117 /* */
2118 /* <Function> */
2119 /* FT_Attach_Stream */
2120 /* */
2121 /* <Description> */
2122 /* `Attach' data to a face object. Normally, this is used to read */
2123 /* additional information for the face object. For example, you can */
2124 /* attach an AFM file that comes with a Type~1 font to get the */
2125 /* kerning values and other metrics. */
2126 /* */
2127 /* <InOut> */
2128 /* face :: The target face object. */
2129 /* */
2130 /* <Input> */
2131 /* parameters :: A pointer to @FT_Open_Args that must be filled by */
2132 /* the caller. */
2133 /* */
2134 /* <Return> */
2135 /* FreeType error code. 0~means success. */
2136 /* */
2137 /* <Note> */
2138 /* The meaning of the `attach' (i.e., what really happens when the */
2139 /* new file is read) is not fixed by FreeType itself. It really */
2140 /* depends on the font format (and thus the font driver). */
2141 /* */
2142 /* Client applications are expected to know what they are doing */
2143 /* when invoking this function. Most drivers simply do not implement */
2144 /* file attachments. */
2145 /* */
2146 FT_EXPORT( FT_Error )
2147 FT_Attach_Stream( FT_Face face,
2148 FT_Open_Args* parameters );
2151 /*************************************************************************/
2152 /* */
2153 /* <Function> */
2154 /* FT_Reference_Face */
2155 /* */
2156 /* <Description> */
2157 /* A counter gets initialized to~1 at the time an @FT_Face structure */
2158 /* is created. This function increments the counter. @FT_Done_Face */
2159 /* then only destroys a face if the counter is~1, otherwise it simply */
2160 /* decrements the counter. */
2161 /* */
2162 /* This function helps in managing life-cycles of structures that */
2163 /* reference @FT_Face objects. */
2164 /* */
2165 /* <Input> */
2166 /* face :: A handle to a target face object. */
2167 /* */
2168 /* <Return> */
2169 /* FreeType error code. 0~means success. */
2170 /* */
2171 /* <Since> */
2172 /* 2.4.2 */
2173 /* */
2174 FT_EXPORT( FT_Error )
2175 FT_Reference_Face( FT_Face face );
2178 /*************************************************************************/
2179 /* */
2180 /* <Function> */
2181 /* FT_Done_Face */
2182 /* */
2183 /* <Description> */
2184 /* Discard a given face object, as well as all of its child slots and */
2185 /* sizes. */
2186 /* */
2187 /* <Input> */
2188 /* face :: A handle to a target face object. */
2189 /* */
2190 /* <Return> */
2191 /* FreeType error code. 0~means success. */
2192 /* */
2193 /* <Note> */
2194 /* See the discussion of reference counters in the description of */
2195 /* @FT_Reference_Face. */
2196 /* */
2197 FT_EXPORT( FT_Error )
2198 FT_Done_Face( FT_Face face );
2201 /*************************************************************************/
2202 /* */
2203 /* <Function> */
2204 /* FT_Select_Size */
2205 /* */
2206 /* <Description> */
2207 /* Select a bitmap strike. */
2208 /* */
2209 /* <InOut> */
2210 /* face :: A handle to a target face object. */
2211 /* */
2212 /* <Input> */
2213 /* strike_index :: The index of the bitmap strike in the */
2214 /* `available_sizes' field of @FT_FaceRec structure. */
2215 /* */
2216 /* <Return> */
2217 /* FreeType error code. 0~means success. */
2218 /* */
2219 FT_EXPORT( FT_Error )
2220 FT_Select_Size( FT_Face face,
2221 FT_Int strike_index );
2224 /*************************************************************************/
2225 /* */
2226 /* <Enum> */
2227 /* FT_Size_Request_Type */
2228 /* */
2229 /* <Description> */
2230 /* An enumeration type that lists the supported size request types. */
2231 /* */
2232 /* <Values> */
2233 /* FT_SIZE_REQUEST_TYPE_NOMINAL :: */
2234 /* The nominal size. The `units_per_EM' field of @FT_FaceRec is */
2235 /* used to determine both scaling values. */
2236 /* */
2237 /* FT_SIZE_REQUEST_TYPE_REAL_DIM :: */
2238 /* The real dimension. The sum of the the `ascender' and (minus */
2239 /* of) the `descender' fields of @FT_FaceRec are used to determine */
2240 /* both scaling values. */
2241 /* */
2242 /* FT_SIZE_REQUEST_TYPE_BBOX :: */
2243 /* The font bounding box. The width and height of the `bbox' field */
2244 /* of @FT_FaceRec are used to determine the horizontal and vertical */
2245 /* scaling value, respectively. */
2246 /* */
2247 /* FT_SIZE_REQUEST_TYPE_CELL :: */
2248 /* The `max_advance_width' field of @FT_FaceRec is used to */
2249 /* determine the horizontal scaling value; the vertical scaling */
2250 /* value is determined the same way as */
2251 /* @FT_SIZE_REQUEST_TYPE_REAL_DIM does. Finally, both scaling */
2252 /* values are set to the smaller one. This type is useful if you */
2253 /* want to specify the font size for, say, a window of a given */
2254 /* dimension and 80x24 cells. */
2255 /* */
2256 /* FT_SIZE_REQUEST_TYPE_SCALES :: */
2257 /* Specify the scaling values directly. */
2258 /* */
2259 /* <Note> */
2260 /* The above descriptions only apply to scalable formats. For bitmap */
2261 /* formats, the behaviour is up to the driver. */
2262 /* */
2263 /* See the note section of @FT_Size_Metrics if you wonder how size */
2264 /* requesting relates to scaling values. */
2265 /* */
2266 typedef enum FT_Size_Request_Type_
2268 FT_SIZE_REQUEST_TYPE_NOMINAL,
2269 FT_SIZE_REQUEST_TYPE_REAL_DIM,
2270 FT_SIZE_REQUEST_TYPE_BBOX,
2271 FT_SIZE_REQUEST_TYPE_CELL,
2272 FT_SIZE_REQUEST_TYPE_SCALES,
2274 FT_SIZE_REQUEST_TYPE_MAX
2276 } FT_Size_Request_Type;
2279 /*************************************************************************/
2280 /* */
2281 /* <Struct> */
2282 /* FT_Size_RequestRec */
2283 /* */
2284 /* <Description> */
2285 /* A structure used to model a size request. */
2286 /* */
2287 /* <Fields> */
2288 /* type :: See @FT_Size_Request_Type. */
2289 /* */
2290 /* width :: The desired width. */
2291 /* */
2292 /* height :: The desired height. */
2293 /* */
2294 /* horiResolution :: The horizontal resolution. If set to zero, */
2295 /* `width' is treated as a 26.6 fractional pixel */
2296 /* value. */
2297 /* */
2298 /* vertResolution :: The vertical resolution. If set to zero, */
2299 /* `height' is treated as a 26.6 fractional pixel */
2300 /* value. */
2301 /* */
2302 /* <Note> */
2303 /* If `width' is zero, then the horizontal scaling value is set equal */
2304 /* to the vertical scaling value, and vice versa. */
2305 /* */
2306 typedef struct FT_Size_RequestRec_
2308 FT_Size_Request_Type type;
2309 FT_Long width;
2310 FT_Long height;
2311 FT_UInt horiResolution;
2312 FT_UInt vertResolution;
2314 } FT_Size_RequestRec;
2317 /*************************************************************************/
2318 /* */
2319 /* <Struct> */
2320 /* FT_Size_Request */
2321 /* */
2322 /* <Description> */
2323 /* A handle to a size request structure. */
2324 /* */
2325 typedef struct FT_Size_RequestRec_ *FT_Size_Request;
2328 /*************************************************************************/
2329 /* */
2330 /* <Function> */
2331 /* FT_Request_Size */
2332 /* */
2333 /* <Description> */
2334 /* Resize the scale of the active @FT_Size object in a face. */
2335 /* */
2336 /* <InOut> */
2337 /* face :: A handle to a target face object. */
2338 /* */
2339 /* <Input> */
2340 /* req :: A pointer to a @FT_Size_RequestRec. */
2341 /* */
2342 /* <Return> */
2343 /* FreeType error code. 0~means success. */
2344 /* */
2345 /* <Note> */
2346 /* Although drivers may select the bitmap strike matching the */
2347 /* request, you should not rely on this if you intend to select a */
2348 /* particular bitmap strike. Use @FT_Select_Size instead in that */
2349 /* case. */
2350 /* */
2351 /* The relation between the requested size and the resulting glyph */
2352 /* size is dependent entirely on how the size is defined in the */
2353 /* source face. The font designer chooses the final size of each */
2354 /* glyph relative to this size. For more information refer to */
2355 /* `http://www.freetype.org/freetype2/docs/glyphs/glyphs-2.html' */
2356 /* */
2357 /* Don't use this function if you are using the FreeType cache API. */
2358 /* */
2359 FT_EXPORT( FT_Error )
2360 FT_Request_Size( FT_Face face,
2361 FT_Size_Request req );
2364 /*************************************************************************/
2365 /* */
2366 /* <Function> */
2367 /* FT_Set_Char_Size */
2368 /* */
2369 /* <Description> */
2370 /* This function calls @FT_Request_Size to request the nominal size */
2371 /* (in points). */
2372 /* */
2373 /* <InOut> */
2374 /* face :: A handle to a target face object. */
2375 /* */
2376 /* <Input> */
2377 /* char_width :: The nominal width, in 26.6 fractional points. */
2378 /* */
2379 /* char_height :: The nominal height, in 26.6 fractional points. */
2380 /* */
2381 /* horz_resolution :: The horizontal resolution in dpi. */
2382 /* */
2383 /* vert_resolution :: The vertical resolution in dpi. */
2384 /* */
2385 /* <Return> */
2386 /* FreeType error code. 0~means success. */
2387 /* */
2388 /* <Note> */
2389 /* If either the character width or height is zero, it is set equal */
2390 /* to the other value. */
2391 /* */
2392 /* If either the horizontal or vertical resolution is zero, it is set */
2393 /* equal to the other value. */
2394 /* */
2395 /* A character width or height smaller than 1pt is set to 1pt; if */
2396 /* both resolution values are zero, they are set to 72dpi. */
2397 /* */
2398 /* Don't use this function if you are using the FreeType cache API. */
2399 /* */
2400 FT_EXPORT( FT_Error )
2401 FT_Set_Char_Size( FT_Face face,
2402 FT_F26Dot6 char_width,
2403 FT_F26Dot6 char_height,
2404 FT_UInt horz_resolution,
2405 FT_UInt vert_resolution );
2408 /*************************************************************************/
2409 /* */
2410 /* <Function> */
2411 /* FT_Set_Pixel_Sizes */
2412 /* */
2413 /* <Description> */
2414 /* This function calls @FT_Request_Size to request the nominal size */
2415 /* (in pixels). */
2416 /* */
2417 /* <InOut> */
2418 /* face :: A handle to the target face object. */
2419 /* */
2420 /* <Input> */
2421 /* pixel_width :: The nominal width, in pixels. */
2422 /* */
2423 /* pixel_height :: The nominal height, in pixels. */
2424 /* */
2425 /* <Return> */
2426 /* FreeType error code. 0~means success. */
2427 /* */
2428 /* <Note> */
2429 /* You should not rely on the resulting glyphs matching, or being */
2430 /* constrained, to this pixel size. Refer to @FT_Request_Size to */
2431 /* understand how requested sizes relate to actual sizes. */
2432 /* */
2433 /* Don't use this function if you are using the FreeType cache API. */
2434 /* */
2435 FT_EXPORT( FT_Error )
2436 FT_Set_Pixel_Sizes( FT_Face face,
2437 FT_UInt pixel_width,
2438 FT_UInt pixel_height );
2441 /*************************************************************************/
2442 /* */
2443 /* <Function> */
2444 /* FT_Load_Glyph */
2445 /* */
2446 /* <Description> */
2447 /* A function used to load a single glyph into the glyph slot of a */
2448 /* face object. */
2449 /* */
2450 /* <InOut> */
2451 /* face :: A handle to the target face object where the glyph */
2452 /* is loaded. */
2453 /* */
2454 /* <Input> */
2455 /* glyph_index :: The index of the glyph in the font file. For */
2456 /* CID-keyed fonts (either in PS or in CFF format) */
2457 /* this argument specifies the CID value. */
2458 /* */
2459 /* load_flags :: A flag indicating what to load for this glyph. The */
2460 /* @FT_LOAD_XXX constants can be used to control the */
2461 /* glyph loading process (e.g., whether the outline */
2462 /* should be scaled, whether to load bitmaps or not, */
2463 /* whether to hint the outline, etc). */
2464 /* */
2465 /* <Return> */
2466 /* FreeType error code. 0~means success. */
2467 /* */
2468 /* <Note> */
2469 /* The loaded glyph may be transformed. See @FT_Set_Transform for */
2470 /* the details. */
2471 /* */
2472 /* For subsetted CID-keyed fonts, `FT_Err_Invalid_Argument' is */
2473 /* returned for invalid CID values (this is, for CID values that */
2474 /* don't have a corresponding glyph in the font). See the discussion */
2475 /* of the @FT_FACE_FLAG_CID_KEYED flag for more details. */
2476 /* */
2477 FT_EXPORT( FT_Error )
2478 FT_Load_Glyph( FT_Face face,
2479 FT_UInt glyph_index,
2480 FT_Int32 load_flags );
2483 /*************************************************************************/
2484 /* */
2485 /* <Function> */
2486 /* FT_Load_Char */
2487 /* */
2488 /* <Description> */
2489 /* A function used to load a single glyph into the glyph slot of a */
2490 /* face object, according to its character code. */
2491 /* */
2492 /* <InOut> */
2493 /* face :: A handle to a target face object where the glyph */
2494 /* is loaded. */
2495 /* */
2496 /* <Input> */
2497 /* char_code :: The glyph's character code, according to the */
2498 /* current charmap used in the face. */
2499 /* */
2500 /* load_flags :: A flag indicating what to load for this glyph. The */
2501 /* @FT_LOAD_XXX constants can be used to control the */
2502 /* glyph loading process (e.g., whether the outline */
2503 /* should be scaled, whether to load bitmaps or not, */
2504 /* whether to hint the outline, etc). */
2505 /* */
2506 /* <Return> */
2507 /* FreeType error code. 0~means success. */
2508 /* */
2509 /* <Note> */
2510 /* This function simply calls @FT_Get_Char_Index and @FT_Load_Glyph. */
2511 /* */
2512 FT_EXPORT( FT_Error )
2513 FT_Load_Char( FT_Face face,
2514 FT_ULong char_code,
2515 FT_Int32 load_flags );
2518 /*************************************************************************
2520 * @enum:
2521 * FT_LOAD_XXX
2523 * @description:
2524 * A list of bit-field constants used with @FT_Load_Glyph to indicate
2525 * what kind of operations to perform during glyph loading.
2527 * @values:
2528 * FT_LOAD_DEFAULT ::
2529 * Corresponding to~0, this value is used as the default glyph load
2530 * operation. In this case, the following happens:
2532 * 1. FreeType looks for a bitmap for the glyph corresponding to the
2533 * face's current size. If one is found, the function returns.
2534 * The bitmap data can be accessed from the glyph slot (see note
2535 * below).
2537 * 2. If no embedded bitmap is searched or found, FreeType looks for a
2538 * scalable outline. If one is found, it is loaded from the font
2539 * file, scaled to device pixels, then `hinted' to the pixel grid
2540 * in order to optimize it. The outline data can be accessed from
2541 * the glyph slot (see note below).
2543 * Note that by default, the glyph loader doesn't render outlines into
2544 * bitmaps. The following flags are used to modify this default
2545 * behaviour to more specific and useful cases.
2547 * FT_LOAD_NO_SCALE ::
2548 * Don't scale the loaded outline glyph but keep it in font units.
2550 * This flag implies @FT_LOAD_NO_HINTING and @FT_LOAD_NO_BITMAP, and
2551 * unsets @FT_LOAD_RENDER.
2553 * If the font is `tricky' (see @FT_FACE_FLAG_TRICKY for more), using
2554 * FT_LOAD_NO_SCALE usually yields meaningless outlines because the
2555 * subglyphs must be scaled and positioned with hinting instructions.
2556 * This can be solved by loading the font without FT_LOAD_NO_SCALE and
2557 * setting the character size to `font->units_per_EM'.
2559 * FT_LOAD_NO_HINTING ::
2560 * Disable hinting. This generally generates `blurrier' bitmap glyphs
2561 * when the glyph are rendered in any of the anti-aliased modes. See
2562 * also the note below.
2564 * This flag is implied by @FT_LOAD_NO_SCALE.
2566 * FT_LOAD_RENDER ::
2567 * Call @FT_Render_Glyph after the glyph is loaded. By default, the
2568 * glyph is rendered in @FT_RENDER_MODE_NORMAL mode. This can be
2569 * overridden by @FT_LOAD_TARGET_XXX or @FT_LOAD_MONOCHROME.
2571 * This flag is unset by @FT_LOAD_NO_SCALE.
2573 * FT_LOAD_NO_BITMAP ::
2574 * Ignore bitmap strikes when loading. Bitmap-only fonts ignore this
2575 * flag.
2577 * @FT_LOAD_NO_SCALE always sets this flag.
2579 * FT_LOAD_VERTICAL_LAYOUT ::
2580 * Load the glyph for vertical text layout. In particular, the
2581 * `advance' value in the @FT_GlyphSlotRec structure is set to the
2582 * `vertAdvance' value of the `metrics' field.
2584 * In case @FT_HAS_VERTICAL doesn't return true, you shouldn't use
2585 * this flag currently. Reason is that in this case vertical metrics
2586 * get synthesized, and those values are not always consistent across
2587 * various font formats.
2589 * FT_LOAD_FORCE_AUTOHINT ::
2590 * Indicates that the auto-hinter is preferred over the font's native
2591 * hinter. See also the note below.
2593 * FT_LOAD_PEDANTIC ::
2594 * Indicates that the font driver should perform pedantic verifications
2595 * during glyph loading. This is mostly used to detect broken glyphs
2596 * in fonts. By default, FreeType tries to handle broken fonts also.
2598 * In particular, errors from the TrueType bytecode engine are not
2599 * passed to the application if this flag is not set; this might
2600 * result in partially hinted or distorted glyphs in case a glyph's
2601 * bytecode is buggy.
2603 * FT_LOAD_NO_RECURSE ::
2604 * Indicate that the font driver should not load composite glyphs
2605 * recursively. Instead, it should set the `num_subglyph' and
2606 * `subglyphs' values of the glyph slot accordingly, and set
2607 * `glyph->format' to @FT_GLYPH_FORMAT_COMPOSITE. The description of
2608 * subglyphs can then be accessed with @FT_Get_SubGlyph_Info.
2610 * This flag implies @FT_LOAD_NO_SCALE and @FT_LOAD_IGNORE_TRANSFORM.
2612 * FT_LOAD_IGNORE_TRANSFORM ::
2613 * Indicates that the transform matrix set by @FT_Set_Transform should
2614 * be ignored.
2616 * FT_LOAD_MONOCHROME ::
2617 * This flag is used with @FT_LOAD_RENDER to indicate that you want to
2618 * render an outline glyph to a 1-bit monochrome bitmap glyph, with
2619 * 8~pixels packed into each byte of the bitmap data.
2621 * Note that this has no effect on the hinting algorithm used. You
2622 * should rather use @FT_LOAD_TARGET_MONO so that the
2623 * monochrome-optimized hinting algorithm is used.
2625 * FT_LOAD_LINEAR_DESIGN ::
2626 * Indicates that the `linearHoriAdvance' and `linearVertAdvance'
2627 * fields of @FT_GlyphSlotRec should be kept in font units. See
2628 * @FT_GlyphSlotRec for details.
2630 * FT_LOAD_NO_AUTOHINT ::
2631 * Disable auto-hinter. See also the note below.
2633 * FT_LOAD_COLOR ::
2634 * This flag is used to request loading of color embedded-bitmap
2635 * images. The resulting color bitmaps, if available, will have the
2636 * @FT_PIXEL_MODE_BGRA format. When the flag is not used and color
2637 * bitmaps are found, they will be converted to 256-level gray
2638 * bitmaps transparently. Those bitmaps will be in the
2639 * @FT_PIXEL_MODE_GRAY format.
2641 * FT_LOAD_CROP_BITMAP ::
2642 * Ignored. Deprecated.
2644 * FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH ::
2645 * Ignored. Deprecated.
2647 * @note:
2648 * By default, hinting is enabled and the font's native hinter (see
2649 * @FT_FACE_FLAG_HINTER) is preferred over the auto-hinter. You can
2650 * disable hinting by setting @FT_LOAD_NO_HINTING or change the
2651 * precedence by setting @FT_LOAD_FORCE_AUTOHINT. You can also set
2652 * @FT_LOAD_NO_AUTOHINT in case you don't want the auto-hinter to be
2653 * used at all.
2655 * See the description of @FT_FACE_FLAG_TRICKY for a special exception
2656 * (affecting only a handful of Asian fonts).
2658 * Besides deciding which hinter to use, you can also decide which
2659 * hinting algorithm to use. See @FT_LOAD_TARGET_XXX for details.
2661 * Note that the auto-hinter needs a valid Unicode cmap (either a native
2662 * one or synthesized by FreeType) for producing correct results. If a
2663 * font provides an incorrect mapping (for example, assigning the
2664 * character code U+005A, LATIN CAPITAL LETTER Z, to a glyph depicting a
2665 * mathematical integral sign), the auto-hinter might produce useless
2666 * results.
2669 #define FT_LOAD_DEFAULT 0x0
2670 #define FT_LOAD_NO_SCALE ( 1L << 0 )
2671 #define FT_LOAD_NO_HINTING ( 1L << 1 )
2672 #define FT_LOAD_RENDER ( 1L << 2 )
2673 #define FT_LOAD_NO_BITMAP ( 1L << 3 )
2674 #define FT_LOAD_VERTICAL_LAYOUT ( 1L << 4 )
2675 #define FT_LOAD_FORCE_AUTOHINT ( 1L << 5 )
2676 #define FT_LOAD_CROP_BITMAP ( 1L << 6 )
2677 #define FT_LOAD_PEDANTIC ( 1L << 7 )
2678 #define FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH ( 1L << 9 )
2679 #define FT_LOAD_NO_RECURSE ( 1L << 10 )
2680 #define FT_LOAD_IGNORE_TRANSFORM ( 1L << 11 )
2681 #define FT_LOAD_MONOCHROME ( 1L << 12 )
2682 #define FT_LOAD_LINEAR_DESIGN ( 1L << 13 )
2683 #define FT_LOAD_NO_AUTOHINT ( 1L << 15 )
2684 /* Bits 16..19 are used by `FT_LOAD_TARGET_' */
2685 #define FT_LOAD_COLOR ( 1L << 20 )
2687 /* */
2689 /* used internally only by certain font drivers! */
2690 #define FT_LOAD_ADVANCE_ONLY ( 1L << 8 )
2691 #define FT_LOAD_SBITS_ONLY ( 1L << 14 )
2694 /**************************************************************************
2696 * @enum:
2697 * FT_LOAD_TARGET_XXX
2699 * @description:
2700 * A list of values that are used to select a specific hinting algorithm
2701 * to use by the hinter. You should OR one of these values to your
2702 * `load_flags' when calling @FT_Load_Glyph.
2704 * Note that font's native hinters may ignore the hinting algorithm you
2705 * have specified (e.g., the TrueType bytecode interpreter). You can set
2706 * @FT_LOAD_FORCE_AUTOHINT to ensure that the auto-hinter is used.
2708 * Also note that @FT_LOAD_TARGET_LIGHT is an exception, in that it
2709 * always implies @FT_LOAD_FORCE_AUTOHINT.
2711 * @values:
2712 * FT_LOAD_TARGET_NORMAL ::
2713 * This corresponds to the default hinting algorithm, optimized for
2714 * standard gray-level rendering. For monochrome output, use
2715 * @FT_LOAD_TARGET_MONO instead.
2717 * FT_LOAD_TARGET_LIGHT ::
2718 * A lighter hinting algorithm for non-monochrome modes. Many
2719 * generated glyphs are more fuzzy but better resemble its original
2720 * shape. A bit like rendering on Mac OS~X.
2722 * As a special exception, this target implies @FT_LOAD_FORCE_AUTOHINT.
2724 * FT_LOAD_TARGET_MONO ::
2725 * Strong hinting algorithm that should only be used for monochrome
2726 * output. The result is probably unpleasant if the glyph is rendered
2727 * in non-monochrome modes.
2729 * FT_LOAD_TARGET_LCD ::
2730 * A variant of @FT_LOAD_TARGET_NORMAL optimized for horizontally
2731 * decimated LCD displays.
2733 * FT_LOAD_TARGET_LCD_V ::
2734 * A variant of @FT_LOAD_TARGET_NORMAL optimized for vertically
2735 * decimated LCD displays.
2737 * @note:
2738 * You should use only _one_ of the FT_LOAD_TARGET_XXX values in your
2739 * `load_flags'. They can't be ORed.
2741 * If @FT_LOAD_RENDER is also set, the glyph is rendered in the
2742 * corresponding mode (i.e., the mode that matches the used algorithm
2743 * best). An exeption is FT_LOAD_TARGET_MONO since it implies
2744 * @FT_LOAD_MONOCHROME.
2746 * You can use a hinting algorithm that doesn't correspond to the same
2747 * rendering mode. As an example, it is possible to use the `light'
2748 * hinting algorithm and have the results rendered in horizontal LCD
2749 * pixel mode, with code like
2752 * FT_Load_Glyph( face, glyph_index,
2753 * load_flags | FT_LOAD_TARGET_LIGHT );
2755 * FT_Render_Glyph( face->glyph, FT_RENDER_MODE_LCD );
2759 #define FT_LOAD_TARGET_( x ) ( (FT_Int32)( (x) & 15 ) << 16 )
2761 #define FT_LOAD_TARGET_NORMAL FT_LOAD_TARGET_( FT_RENDER_MODE_NORMAL )
2762 #define FT_LOAD_TARGET_LIGHT FT_LOAD_TARGET_( FT_RENDER_MODE_LIGHT )
2763 #define FT_LOAD_TARGET_MONO FT_LOAD_TARGET_( FT_RENDER_MODE_MONO )
2764 #define FT_LOAD_TARGET_LCD FT_LOAD_TARGET_( FT_RENDER_MODE_LCD )
2765 #define FT_LOAD_TARGET_LCD_V FT_LOAD_TARGET_( FT_RENDER_MODE_LCD_V )
2768 /**************************************************************************
2770 * @macro:
2771 * FT_LOAD_TARGET_MODE
2773 * @description:
2774 * Return the @FT_Render_Mode corresponding to a given
2775 * @FT_LOAD_TARGET_XXX value.
2778 #define FT_LOAD_TARGET_MODE( x ) ( (FT_Render_Mode)( ( (x) >> 16 ) & 15 ) )
2781 /*************************************************************************/
2782 /* */
2783 /* <Function> */
2784 /* FT_Set_Transform */
2785 /* */
2786 /* <Description> */
2787 /* A function used to set the transformation that is applied to glyph */
2788 /* images when they are loaded into a glyph slot through */
2789 /* @FT_Load_Glyph. */
2790 /* */
2791 /* <InOut> */
2792 /* face :: A handle to the source face object. */
2793 /* */
2794 /* <Input> */
2795 /* matrix :: A pointer to the transformation's 2x2 matrix. Use~0 for */
2796 /* the identity matrix. */
2797 /* delta :: A pointer to the translation vector. Use~0 for the null */
2798 /* vector. */
2799 /* */
2800 /* <Note> */
2801 /* The transformation is only applied to scalable image formats after */
2802 /* the glyph has been loaded. It means that hinting is unaltered by */
2803 /* the transformation and is performed on the character size given in */
2804 /* the last call to @FT_Set_Char_Size or @FT_Set_Pixel_Sizes. */
2805 /* */
2806 /* Note that this also transforms the `face.glyph.advance' field, but */
2807 /* *not* the values in `face.glyph.metrics'. */
2808 /* */
2809 FT_EXPORT( void )
2810 FT_Set_Transform( FT_Face face,
2811 FT_Matrix* matrix,
2812 FT_Vector* delta );
2815 /*************************************************************************/
2816 /* */
2817 /* <Enum> */
2818 /* FT_Render_Mode */
2819 /* */
2820 /* <Description> */
2821 /* An enumeration type that lists the render modes supported by */
2822 /* FreeType~2. Each mode corresponds to a specific type of scanline */
2823 /* conversion performed on the outline. */
2824 /* */
2825 /* For bitmap fonts and embedded bitmaps the `bitmap->pixel_mode' */
2826 /* field in the @FT_GlyphSlotRec structure gives the format of the */
2827 /* returned bitmap. */
2828 /* */
2829 /* All modes except @FT_RENDER_MODE_MONO use 256 levels of opacity. */
2830 /* */
2831 /* <Values> */
2832 /* FT_RENDER_MODE_NORMAL :: */
2833 /* This is the default render mode; it corresponds to 8-bit */
2834 /* anti-aliased bitmaps. */
2835 /* */
2836 /* FT_RENDER_MODE_LIGHT :: */
2837 /* This is equivalent to @FT_RENDER_MODE_NORMAL. It is only */
2838 /* defined as a separate value because render modes are also used */
2839 /* indirectly to define hinting algorithm selectors. See */
2840 /* @FT_LOAD_TARGET_XXX for details. */
2841 /* */
2842 /* FT_RENDER_MODE_MONO :: */
2843 /* This mode corresponds to 1-bit bitmaps (with 2~levels of */
2844 /* opacity). */
2845 /* */
2846 /* FT_RENDER_MODE_LCD :: */
2847 /* This mode corresponds to horizontal RGB and BGR sub-pixel */
2848 /* displays like LCD screens. It produces 8-bit bitmaps that are */
2849 /* 3~times the width of the original glyph outline in pixels, and */
2850 /* which use the @FT_PIXEL_MODE_LCD mode. */
2851 /* */
2852 /* FT_RENDER_MODE_LCD_V :: */
2853 /* This mode corresponds to vertical RGB and BGR sub-pixel displays */
2854 /* (like PDA screens, rotated LCD displays, etc.). It produces */
2855 /* 8-bit bitmaps that are 3~times the height of the original */
2856 /* glyph outline in pixels and use the @FT_PIXEL_MODE_LCD_V mode. */
2857 /* */
2858 /* <Note> */
2859 /* The LCD-optimized glyph bitmaps produced by FT_Render_Glyph can be */
2860 /* filtered to reduce color-fringes by using @FT_Library_SetLcdFilter */
2861 /* (not active in the default builds). It is up to the caller to */
2862 /* either call @FT_Library_SetLcdFilter (if available) or do the */
2863 /* filtering itself. */
2864 /* */
2865 /* The selected render mode only affects vector glyphs of a font. */
2866 /* Embedded bitmaps often have a different pixel mode like */
2867 /* @FT_PIXEL_MODE_MONO. You can use @FT_Bitmap_Convert to transform */
2868 /* them into 8-bit pixmaps. */
2869 /* */
2870 typedef enum FT_Render_Mode_
2872 FT_RENDER_MODE_NORMAL = 0,
2873 FT_RENDER_MODE_LIGHT,
2874 FT_RENDER_MODE_MONO,
2875 FT_RENDER_MODE_LCD,
2876 FT_RENDER_MODE_LCD_V,
2878 FT_RENDER_MODE_MAX
2880 } FT_Render_Mode;
2883 /* these constants are deprecated; use the corresponding */
2884 /* `FT_Render_Mode' values instead */
2885 #define ft_render_mode_normal FT_RENDER_MODE_NORMAL
2886 #define ft_render_mode_mono FT_RENDER_MODE_MONO
2889 /*************************************************************************/
2890 /* */
2891 /* <Function> */
2892 /* FT_Render_Glyph */
2893 /* */
2894 /* <Description> */
2895 /* Convert a given glyph image to a bitmap. It does so by inspecting */
2896 /* the glyph image format, finding the relevant renderer, and */
2897 /* invoking it. */
2898 /* */
2899 /* <InOut> */
2900 /* slot :: A handle to the glyph slot containing the image to */
2901 /* convert. */
2902 /* */
2903 /* <Input> */
2904 /* render_mode :: This is the render mode used to render the glyph */
2905 /* image into a bitmap. See @FT_Render_Mode for a */
2906 /* list of possible values. */
2907 /* */
2908 /* <Return> */
2909 /* FreeType error code. 0~means success. */
2910 /* */
2911 /* <Note> */
2912 /* To get meaningful results, font scaling values must be set with */
2913 /* functions like @FT_Set_Char_Size before calling FT_Render_Glyph. */
2914 /* */
2915 FT_EXPORT( FT_Error )
2916 FT_Render_Glyph( FT_GlyphSlot slot,
2917 FT_Render_Mode render_mode );
2920 /*************************************************************************/
2921 /* */
2922 /* <Enum> */
2923 /* FT_Kerning_Mode */
2924 /* */
2925 /* <Description> */
2926 /* An enumeration used to specify which kerning values to return in */
2927 /* @FT_Get_Kerning. */
2928 /* */
2929 /* <Values> */
2930 /* FT_KERNING_DEFAULT :: Return scaled and grid-fitted kerning */
2931 /* distances (value is~0). */
2932 /* */
2933 /* FT_KERNING_UNFITTED :: Return scaled but un-grid-fitted kerning */
2934 /* distances. */
2935 /* */
2936 /* FT_KERNING_UNSCALED :: Return the kerning vector in original font */
2937 /* units. */
2938 /* */
2939 typedef enum FT_Kerning_Mode_
2941 FT_KERNING_DEFAULT = 0,
2942 FT_KERNING_UNFITTED,
2943 FT_KERNING_UNSCALED
2945 } FT_Kerning_Mode;
2948 /* these constants are deprecated; use the corresponding */
2949 /* `FT_Kerning_Mode' values instead */
2950 #define ft_kerning_default FT_KERNING_DEFAULT
2951 #define ft_kerning_unfitted FT_KERNING_UNFITTED
2952 #define ft_kerning_unscaled FT_KERNING_UNSCALED
2955 /*************************************************************************/
2956 /* */
2957 /* <Function> */
2958 /* FT_Get_Kerning */
2959 /* */
2960 /* <Description> */
2961 /* Return the kerning vector between two glyphs of a same face. */
2962 /* */
2963 /* <Input> */
2964 /* face :: A handle to a source face object. */
2965 /* */
2966 /* left_glyph :: The index of the left glyph in the kern pair. */
2967 /* */
2968 /* right_glyph :: The index of the right glyph in the kern pair. */
2969 /* */
2970 /* kern_mode :: See @FT_Kerning_Mode for more information. */
2971 /* Determines the scale and dimension of the returned */
2972 /* kerning vector. */
2973 /* */
2974 /* <Output> */
2975 /* akerning :: The kerning vector. This is either in font units */
2976 /* or in pixels (26.6 format) for scalable formats, */
2977 /* and in pixels for fixed-sizes formats. */
2978 /* */
2979 /* <Return> */
2980 /* FreeType error code. 0~means success. */
2981 /* */
2982 /* <Note> */
2983 /* Only horizontal layouts (left-to-right & right-to-left) are */
2984 /* supported by this method. Other layouts, or more sophisticated */
2985 /* kernings, are out of the scope of this API function -- they can be */
2986 /* implemented through format-specific interfaces. */
2987 /* */
2988 FT_EXPORT( FT_Error )
2989 FT_Get_Kerning( FT_Face face,
2990 FT_UInt left_glyph,
2991 FT_UInt right_glyph,
2992 FT_UInt kern_mode,
2993 FT_Vector *akerning );
2996 /*************************************************************************/
2997 /* */
2998 /* <Function> */
2999 /* FT_Get_Track_Kerning */
3000 /* */
3001 /* <Description> */
3002 /* Return the track kerning for a given face object at a given size. */
3003 /* */
3004 /* <Input> */
3005 /* face :: A handle to a source face object. */
3006 /* */
3007 /* point_size :: The point size in 16.16 fractional points. */
3008 /* */
3009 /* degree :: The degree of tightness. Increasingly negative */
3010 /* values represent tighter track kerning, while */
3011 /* increasingly positive values represent looser track */
3012 /* kerning. Value zero means no track kerning. */
3013 /* */
3014 /* <Output> */
3015 /* akerning :: The kerning in 16.16 fractional points, to be */
3016 /* uniformly applied between all glyphs. */
3017 /* */
3018 /* <Return> */
3019 /* FreeType error code. 0~means success. */
3020 /* */
3021 /* <Note> */
3022 /* Currently, only the Type~1 font driver supports track kerning, */
3023 /* using data from AFM files (if attached with @FT_Attach_File or */
3024 /* @FT_Attach_Stream). */
3025 /* */
3026 /* Only very few AFM files come with track kerning data; please refer */
3027 /* to the Adobe's AFM specification for more details. */
3028 /* */
3029 FT_EXPORT( FT_Error )
3030 FT_Get_Track_Kerning( FT_Face face,
3031 FT_Fixed point_size,
3032 FT_Int degree,
3033 FT_Fixed* akerning );
3036 /*************************************************************************/
3037 /* */
3038 /* <Function> */
3039 /* FT_Get_Glyph_Name */
3040 /* */
3041 /* <Description> */
3042 /* Retrieve the ASCII name of a given glyph in a face. This only */
3043 /* works for those faces where @FT_HAS_GLYPH_NAMES(face) returns~1. */
3044 /* */
3045 /* <Input> */
3046 /* face :: A handle to a source face object. */
3047 /* */
3048 /* glyph_index :: The glyph index. */
3049 /* */
3050 /* buffer_max :: The maximum number of bytes available in the */
3051 /* buffer. */
3052 /* */
3053 /* <Output> */
3054 /* buffer :: A pointer to a target buffer where the name is */
3055 /* copied to. */
3056 /* */
3057 /* <Return> */
3058 /* FreeType error code. 0~means success. */
3059 /* */
3060 /* <Note> */
3061 /* An error is returned if the face doesn't provide glyph names or if */
3062 /* the glyph index is invalid. In all cases of failure, the first */
3063 /* byte of `buffer' is set to~0 to indicate an empty name. */
3064 /* */
3065 /* The glyph name is truncated to fit within the buffer if it is too */
3066 /* long. The returned string is always zero-terminated. */
3067 /* */
3068 /* Be aware that FreeType reorders glyph indices internally so that */
3069 /* glyph index~0 always corresponds to the `missing glyph' (called */
3070 /* `.notdef'). */
3071 /* */
3072 /* This function always returns an error if the config macro */
3073 /* `FT_CONFIG_OPTION_NO_GLYPH_NAMES' is not defined in `ftoptions.h'. */
3074 /* */
3075 FT_EXPORT( FT_Error )
3076 FT_Get_Glyph_Name( FT_Face face,
3077 FT_UInt glyph_index,
3078 FT_Pointer buffer,
3079 FT_UInt buffer_max );
3082 /*************************************************************************/
3083 /* */
3084 /* <Function> */
3085 /* FT_Get_Postscript_Name */
3086 /* */
3087 /* <Description> */
3088 /* Retrieve the ASCII PostScript name of a given face, if available. */
3089 /* This only works with PostScript and TrueType fonts. */
3090 /* */
3091 /* <Input> */
3092 /* face :: A handle to the source face object. */
3093 /* */
3094 /* <Return> */
3095 /* A pointer to the face's PostScript name. NULL if unavailable. */
3096 /* */
3097 /* <Note> */
3098 /* The returned pointer is owned by the face and is destroyed with */
3099 /* it. */
3100 /* */
3101 FT_EXPORT( const char* )
3102 FT_Get_Postscript_Name( FT_Face face );
3105 /*************************************************************************/
3106 /* */
3107 /* <Function> */
3108 /* FT_Select_Charmap */
3109 /* */
3110 /* <Description> */
3111 /* Select a given charmap by its encoding tag (as listed in */
3112 /* `freetype.h'). */
3113 /* */
3114 /* <InOut> */
3115 /* face :: A handle to the source face object. */
3116 /* */
3117 /* <Input> */
3118 /* encoding :: A handle to the selected encoding. */
3119 /* */
3120 /* <Return> */
3121 /* FreeType error code. 0~means success. */
3122 /* */
3123 /* <Note> */
3124 /* This function returns an error if no charmap in the face */
3125 /* corresponds to the encoding queried here. */
3126 /* */
3127 /* Because many fonts contain more than a single cmap for Unicode */
3128 /* encoding, this function has some special code to select the one */
3129 /* that covers Unicode best (`best' in the sense that a UCS-4 cmap is */
3130 /* preferred to a UCS-2 cmap). It is thus preferable to */
3131 /* @FT_Set_Charmap in this case. */
3132 /* */
3133 FT_EXPORT( FT_Error )
3134 FT_Select_Charmap( FT_Face face,
3135 FT_Encoding encoding );
3138 /*************************************************************************/
3139 /* */
3140 /* <Function> */
3141 /* FT_Set_Charmap */
3142 /* */
3143 /* <Description> */
3144 /* Select a given charmap for character code to glyph index mapping. */
3145 /* */
3146 /* <InOut> */
3147 /* face :: A handle to the source face object. */
3148 /* */
3149 /* <Input> */
3150 /* charmap :: A handle to the selected charmap. */
3151 /* */
3152 /* <Return> */
3153 /* FreeType error code. 0~means success. */
3154 /* */
3155 /* <Note> */
3156 /* This function returns an error if the charmap is not part of */
3157 /* the face (i.e., if it is not listed in the `face->charmaps' */
3158 /* table). */
3159 /* */
3160 /* It also fails if a type~14 charmap is selected. */
3161 /* */
3162 FT_EXPORT( FT_Error )
3163 FT_Set_Charmap( FT_Face face,
3164 FT_CharMap charmap );
3167 /*************************************************************************
3169 * @function:
3170 * FT_Get_Charmap_Index
3172 * @description:
3173 * Retrieve index of a given charmap.
3175 * @input:
3176 * charmap ::
3177 * A handle to a charmap.
3179 * @return:
3180 * The index into the array of character maps within the face to which
3181 * `charmap' belongs. If an error occurs, -1 is returned.
3184 FT_EXPORT( FT_Int )
3185 FT_Get_Charmap_Index( FT_CharMap charmap );
3188 /*************************************************************************/
3189 /* */
3190 /* <Function> */
3191 /* FT_Get_Char_Index */
3192 /* */
3193 /* <Description> */
3194 /* Return the glyph index of a given character code. This function */
3195 /* uses a charmap object to do the mapping. */
3196 /* */
3197 /* <Input> */
3198 /* face :: A handle to the source face object. */
3199 /* */
3200 /* charcode :: The character code. */
3201 /* */
3202 /* <Return> */
3203 /* The glyph index. 0~means `undefined character code'. */
3204 /* */
3205 /* <Note> */
3206 /* If you use FreeType to manipulate the contents of font files */
3207 /* directly, be aware that the glyph index returned by this function */
3208 /* doesn't always correspond to the internal indices used within the */
3209 /* file. This is done to ensure that value~0 always corresponds to */
3210 /* the `missing glyph'. If the first glyph is not named `.notdef', */
3211 /* then for Type~1 and Type~42 fonts, `.notdef' will be moved into */
3212 /* the glyph ID~0 position, and whatever was there will be moved to */
3213 /* the position `.notdef' had. For Type~1 fonts, if there is no */
3214 /* `.notdef' glyph at all, then one will be created at index~0 and */
3215 /* whatever was there will be moved to the last index -- Type~42 */
3216 /* fonts are considered invalid under this condition. */
3217 /* */
3218 FT_EXPORT( FT_UInt )
3219 FT_Get_Char_Index( FT_Face face,
3220 FT_ULong charcode );
3223 /*************************************************************************/
3224 /* */
3225 /* <Function> */
3226 /* FT_Get_First_Char */
3227 /* */
3228 /* <Description> */
3229 /* This function is used to return the first character code in the */
3230 /* current charmap of a given face. It also returns the */
3231 /* corresponding glyph index. */
3232 /* */
3233 /* <Input> */
3234 /* face :: A handle to the source face object. */
3235 /* */
3236 /* <Output> */
3237 /* agindex :: Glyph index of first character code. 0~if charmap is */
3238 /* empty. */
3239 /* */
3240 /* <Return> */
3241 /* The charmap's first character code. */
3242 /* */
3243 /* <Note> */
3244 /* You should use this function with @FT_Get_Next_Char to be able to */
3245 /* parse all character codes available in a given charmap. The code */
3246 /* should look like this: */
3247 /* */
3248 /* { */
3249 /* FT_ULong charcode; */
3250 /* FT_UInt gindex; */
3251 /* */
3252 /* */
3253 /* charcode = FT_Get_First_Char( face, &gindex ); */
3254 /* while ( gindex != 0 ) */
3255 /* { */
3256 /* ... do something with (charcode,gindex) pair ... */
3257 /* */
3258 /* charcode = FT_Get_Next_Char( face, charcode, &gindex ); */
3259 /* } */
3260 /* } */
3261 /* */
3262 /* Note that `*agindex' is set to~0 if the charmap is empty. The */
3263 /* result itself can be~0 in two cases: if the charmap is empty or */
3264 /* if the value~0 is the first valid character code. */
3265 /* */
3266 FT_EXPORT( FT_ULong )
3267 FT_Get_First_Char( FT_Face face,
3268 FT_UInt *agindex );
3271 /*************************************************************************/
3272 /* */
3273 /* <Function> */
3274 /* FT_Get_Next_Char */
3275 /* */
3276 /* <Description> */
3277 /* This function is used to return the next character code in the */
3278 /* current charmap of a given face following the value `char_code', */
3279 /* as well as the corresponding glyph index. */
3280 /* */
3281 /* <Input> */
3282 /* face :: A handle to the source face object. */
3283 /* char_code :: The starting character code. */
3284 /* */
3285 /* <Output> */
3286 /* agindex :: Glyph index of next character code. 0~if charmap */
3287 /* is empty. */
3288 /* */
3289 /* <Return> */
3290 /* The charmap's next character code. */
3291 /* */
3292 /* <Note> */
3293 /* You should use this function with @FT_Get_First_Char to walk */
3294 /* over all character codes available in a given charmap. See the */
3295 /* note for this function for a simple code example. */
3296 /* */
3297 /* Note that `*agindex' is set to~0 when there are no more codes in */
3298 /* the charmap. */
3299 /* */
3300 FT_EXPORT( FT_ULong )
3301 FT_Get_Next_Char( FT_Face face,
3302 FT_ULong char_code,
3303 FT_UInt *agindex );
3306 /*************************************************************************/
3307 /* */
3308 /* <Function> */
3309 /* FT_Get_Name_Index */
3310 /* */
3311 /* <Description> */
3312 /* Return the glyph index of a given glyph name. This function uses */
3313 /* driver specific objects to do the translation. */
3314 /* */
3315 /* <Input> */
3316 /* face :: A handle to the source face object. */
3317 /* */
3318 /* glyph_name :: The glyph name. */
3319 /* */
3320 /* <Return> */
3321 /* The glyph index. 0~means `undefined character code'. */
3322 /* */
3323 FT_EXPORT( FT_UInt )
3324 FT_Get_Name_Index( FT_Face face,
3325 FT_String* glyph_name );
3328 /*************************************************************************
3330 * @macro:
3331 * FT_SUBGLYPH_FLAG_XXX
3333 * @description:
3334 * A list of constants used to describe subglyphs. Please refer to the
3335 * TrueType specification for the meaning of the various flags.
3337 * @values:
3338 * FT_SUBGLYPH_FLAG_ARGS_ARE_WORDS ::
3339 * FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES ::
3340 * FT_SUBGLYPH_FLAG_ROUND_XY_TO_GRID ::
3341 * FT_SUBGLYPH_FLAG_SCALE ::
3342 * FT_SUBGLYPH_FLAG_XY_SCALE ::
3343 * FT_SUBGLYPH_FLAG_2X2 ::
3344 * FT_SUBGLYPH_FLAG_USE_MY_METRICS ::
3347 #define FT_SUBGLYPH_FLAG_ARGS_ARE_WORDS 1
3348 #define FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES 2
3349 #define FT_SUBGLYPH_FLAG_ROUND_XY_TO_GRID 4
3350 #define FT_SUBGLYPH_FLAG_SCALE 8
3351 #define FT_SUBGLYPH_FLAG_XY_SCALE 0x40
3352 #define FT_SUBGLYPH_FLAG_2X2 0x80
3353 #define FT_SUBGLYPH_FLAG_USE_MY_METRICS 0x200
3356 /*************************************************************************
3358 * @func:
3359 * FT_Get_SubGlyph_Info
3361 * @description:
3362 * Retrieve a description of a given subglyph. Only use it if
3363 * `glyph->format' is @FT_GLYPH_FORMAT_COMPOSITE; an error is
3364 * returned otherwise.
3366 * @input:
3367 * glyph ::
3368 * The source glyph slot.
3370 * sub_index ::
3371 * The index of the subglyph. Must be less than
3372 * `glyph->num_subglyphs'.
3374 * @output:
3375 * p_index ::
3376 * The glyph index of the subglyph.
3378 * p_flags ::
3379 * The subglyph flags, see @FT_SUBGLYPH_FLAG_XXX.
3381 * p_arg1 ::
3382 * The subglyph's first argument (if any).
3384 * p_arg2 ::
3385 * The subglyph's second argument (if any).
3387 * p_transform ::
3388 * The subglyph transformation (if any).
3390 * @return:
3391 * FreeType error code. 0~means success.
3393 * @note:
3394 * The values of `*p_arg1', `*p_arg2', and `*p_transform' must be
3395 * interpreted depending on the flags returned in `*p_flags'. See the
3396 * TrueType specification for details.
3399 FT_EXPORT( FT_Error )
3400 FT_Get_SubGlyph_Info( FT_GlyphSlot glyph,
3401 FT_UInt sub_index,
3402 FT_Int *p_index,
3403 FT_UInt *p_flags,
3404 FT_Int *p_arg1,
3405 FT_Int *p_arg2,
3406 FT_Matrix *p_transform );
3409 /*************************************************************************/
3410 /* */
3411 /* <Enum> */
3412 /* FT_FSTYPE_XXX */
3413 /* */
3414 /* <Description> */
3415 /* A list of bit flags used in the `fsType' field of the OS/2 table */
3416 /* in a TrueType or OpenType font and the `FSType' entry in a */
3417 /* PostScript font. These bit flags are returned by */
3418 /* @FT_Get_FSType_Flags; they inform client applications of embedding */
3419 /* and subsetting restrictions associated with a font. */
3420 /* */
3421 /* See */
3422 /* http://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/FontPolicies.pdf */
3423 /* for more details. */
3424 /* */
3425 /* <Values> */
3426 /* FT_FSTYPE_INSTALLABLE_EMBEDDING :: */
3427 /* Fonts with no fsType bit set may be embedded and permanently */
3428 /* installed on the remote system by an application. */
3429 /* */
3430 /* FT_FSTYPE_RESTRICTED_LICENSE_EMBEDDING :: */
3431 /* Fonts that have only this bit set must not be modified, embedded */
3432 /* or exchanged in any manner without first obtaining permission of */
3433 /* the font software copyright owner. */
3434 /* */
3435 /* FT_FSTYPE_PREVIEW_AND_PRINT_EMBEDDING :: */
3436 /* If this bit is set, the font may be embedded and temporarily */
3437 /* loaded on the remote system. Documents containing Preview & */
3438 /* Print fonts must be opened `read-only'; no edits can be applied */
3439 /* to the document. */
3440 /* */
3441 /* FT_FSTYPE_EDITABLE_EMBEDDING :: */
3442 /* If this bit is set, the font may be embedded but must only be */
3443 /* installed temporarily on other systems. In contrast to Preview */
3444 /* & Print fonts, documents containing editable fonts may be opened */
3445 /* for reading, editing is permitted, and changes may be saved. */
3446 /* */
3447 /* FT_FSTYPE_NO_SUBSETTING :: */
3448 /* If this bit is set, the font may not be subsetted prior to */
3449 /* embedding. */
3450 /* */
3451 /* FT_FSTYPE_BITMAP_EMBEDDING_ONLY :: */
3452 /* If this bit is set, only bitmaps contained in the font may be */
3453 /* embedded; no outline data may be embedded. If there are no */
3454 /* bitmaps available in the font, then the font is unembeddable. */
3455 /* */
3456 /* <Note> */
3457 /* While the fsType flags can indicate that a font may be embedded, a */
3458 /* license with the font vendor may be separately required to use the */
3459 /* font in this way. */
3460 /* */
3461 #define FT_FSTYPE_INSTALLABLE_EMBEDDING 0x0000
3462 #define FT_FSTYPE_RESTRICTED_LICENSE_EMBEDDING 0x0002
3463 #define FT_FSTYPE_PREVIEW_AND_PRINT_EMBEDDING 0x0004
3464 #define FT_FSTYPE_EDITABLE_EMBEDDING 0x0008
3465 #define FT_FSTYPE_NO_SUBSETTING 0x0100
3466 #define FT_FSTYPE_BITMAP_EMBEDDING_ONLY 0x0200
3469 /*************************************************************************/
3470 /* */
3471 /* <Function> */
3472 /* FT_Get_FSType_Flags */
3473 /* */
3474 /* <Description> */
3475 /* Return the fsType flags for a font. */
3476 /* */
3477 /* <Input> */
3478 /* face :: A handle to the source face object. */
3479 /* */
3480 /* <Return> */
3481 /* The fsType flags, @FT_FSTYPE_XXX. */
3482 /* */
3483 /* <Note> */
3484 /* Use this function rather than directly reading the `fs_type' field */
3485 /* in the @PS_FontInfoRec structure, which is only guaranteed to */
3486 /* return the correct results for Type~1 fonts. */
3487 /* */
3488 /* <Since> */
3489 /* 2.3.8 */
3490 /* */
3491 FT_EXPORT( FT_UShort )
3492 FT_Get_FSType_Flags( FT_Face face );
3495 /*************************************************************************/
3496 /* */
3497 /* <Section> */
3498 /* glyph_variants */
3499 /* */
3500 /* <Title> */
3501 /* Glyph Variants */
3502 /* */
3503 /* <Abstract> */
3504 /* The FreeType~2 interface to Unicode Ideographic Variation */
3505 /* Sequences (IVS), using the SFNT cmap format~14. */
3506 /* */
3507 /* <Description> */
3508 /* Many CJK characters have variant forms. They are a sort of grey */
3509 /* area somewhere between being totally irrelevant and semantically */
3510 /* distinct; for this reason, the Unicode consortium decided to */
3511 /* introduce Ideographic Variation Sequences (IVS), consisting of a */
3512 /* Unicode base character and one of 240 variant selectors */
3513 /* (U+E0100-U+E01EF), instead of further extending the already huge */
3514 /* code range for CJK characters. */
3515 /* */
3516 /* An IVS is registered and unique; for further details please refer */
3517 /* to Unicode Technical Standard #37, the Ideographic Variation */
3518 /* Database: */
3519 /* */
3520 /* http://www.unicode.org/reports/tr37/ */
3521 /* */
3522 /* To date (November 2014), the character with the most variants is */
3523 /* U+9089, having 32 such IVS. */
3524 /* */
3525 /* Adobe and MS decided to support IVS with a new cmap subtable */
3526 /* (format~14). It is an odd subtable because it is not a mapping of */
3527 /* input code points to glyphs, but contains lists of all variants */
3528 /* supported by the font. */
3529 /* */
3530 /* A variant may be either `default' or `non-default'. A default */
3531 /* variant is the one you will get for that code point if you look it */
3532 /* up in the standard Unicode cmap. A non-default variant is a */
3533 /* different glyph. */
3534 /* */
3535 /*************************************************************************/
3538 /*************************************************************************/
3539 /* */
3540 /* <Function> */
3541 /* FT_Face_GetCharVariantIndex */
3542 /* */
3543 /* <Description> */
3544 /* Return the glyph index of a given character code as modified by */
3545 /* the variation selector. */
3546 /* */
3547 /* <Input> */
3548 /* face :: */
3549 /* A handle to the source face object. */
3550 /* */
3551 /* charcode :: */
3552 /* The character code point in Unicode. */
3553 /* */
3554 /* variantSelector :: */
3555 /* The Unicode code point of the variation selector. */
3556 /* */
3557 /* <Return> */
3558 /* The glyph index. 0~means either `undefined character code', or */
3559 /* `undefined selector code', or `no variation selector cmap */
3560 /* subtable', or `current CharMap is not Unicode'. */
3561 /* */
3562 /* <Note> */
3563 /* If you use FreeType to manipulate the contents of font files */
3564 /* directly, be aware that the glyph index returned by this function */
3565 /* doesn't always correspond to the internal indices used within */
3566 /* the file. This is done to ensure that value~0 always corresponds */
3567 /* to the `missing glyph'. */
3568 /* */
3569 /* This function is only meaningful if */
3570 /* a) the font has a variation selector cmap sub table, */
3571 /* and */
3572 /* b) the current charmap has a Unicode encoding. */
3573 /* */
3574 /* <Since> */
3575 /* 2.3.6 */
3576 /* */
3577 FT_EXPORT( FT_UInt )
3578 FT_Face_GetCharVariantIndex( FT_Face face,
3579 FT_ULong charcode,
3580 FT_ULong variantSelector );
3583 /*************************************************************************/
3584 /* */
3585 /* <Function> */
3586 /* FT_Face_GetCharVariantIsDefault */
3587 /* */
3588 /* <Description> */
3589 /* Check whether this variant of this Unicode character is the one to */
3590 /* be found in the `cmap'. */
3591 /* */
3592 /* <Input> */
3593 /* face :: */
3594 /* A handle to the source face object. */
3595 /* */
3596 /* charcode :: */
3597 /* The character codepoint in Unicode. */
3598 /* */
3599 /* variantSelector :: */
3600 /* The Unicode codepoint of the variation selector. */
3601 /* */
3602 /* <Return> */
3603 /* 1~if found in the standard (Unicode) cmap, 0~if found in the */
3604 /* variation selector cmap, or -1 if it is not a variant. */
3605 /* */
3606 /* <Note> */
3607 /* This function is only meaningful if the font has a variation */
3608 /* selector cmap subtable. */
3609 /* */
3610 /* <Since> */
3611 /* 2.3.6 */
3612 /* */
3613 FT_EXPORT( FT_Int )
3614 FT_Face_GetCharVariantIsDefault( FT_Face face,
3615 FT_ULong charcode,
3616 FT_ULong variantSelector );
3619 /*************************************************************************/
3620 /* */
3621 /* <Function> */
3622 /* FT_Face_GetVariantSelectors */
3623 /* */
3624 /* <Description> */
3625 /* Return a zero-terminated list of Unicode variant selectors found */
3626 /* in the font. */
3627 /* */
3628 /* <Input> */
3629 /* face :: */
3630 /* A handle to the source face object. */
3631 /* */
3632 /* <Return> */
3633 /* A pointer to an array of selector code points, or NULL if there is */
3634 /* no valid variant selector cmap subtable. */
3635 /* */
3636 /* <Note> */
3637 /* The last item in the array is~0; the array is owned by the */
3638 /* @FT_Face object but can be overwritten or released on the next */
3639 /* call to a FreeType function. */
3640 /* */
3641 /* <Since> */
3642 /* 2.3.6 */
3643 /* */
3644 FT_EXPORT( FT_UInt32* )
3645 FT_Face_GetVariantSelectors( FT_Face face );
3648 /*************************************************************************/
3649 /* */
3650 /* <Function> */
3651 /* FT_Face_GetVariantsOfChar */
3652 /* */
3653 /* <Description> */
3654 /* Return a zero-terminated list of Unicode variant selectors found */
3655 /* for the specified character code. */
3656 /* */
3657 /* <Input> */
3658 /* face :: */
3659 /* A handle to the source face object. */
3660 /* */
3661 /* charcode :: */
3662 /* The character codepoint in Unicode. */
3663 /* */
3664 /* <Return> */
3665 /* A pointer to an array of variant selector code points that are */
3666 /* active for the given character, or NULL if the corresponding list */
3667 /* is empty. */
3668 /* */
3669 /* <Note> */
3670 /* The last item in the array is~0; the array is owned by the */
3671 /* @FT_Face object but can be overwritten or released on the next */
3672 /* call to a FreeType function. */
3673 /* */
3674 /* <Since> */
3675 /* 2.3.6 */
3676 /* */
3677 FT_EXPORT( FT_UInt32* )
3678 FT_Face_GetVariantsOfChar( FT_Face face,
3679 FT_ULong charcode );
3682 /*************************************************************************/
3683 /* */
3684 /* <Function> */
3685 /* FT_Face_GetCharsOfVariant */
3686 /* */
3687 /* <Description> */
3688 /* Return a zero-terminated list of Unicode character codes found for */
3689 /* the specified variant selector. */
3690 /* */
3691 /* <Input> */
3692 /* face :: */
3693 /* A handle to the source face object. */
3694 /* */
3695 /* variantSelector :: */
3696 /* The variant selector code point in Unicode. */
3697 /* */
3698 /* <Return> */
3699 /* A list of all the code points that are specified by this selector */
3700 /* (both default and non-default codes are returned) or NULL if there */
3701 /* is no valid cmap or the variant selector is invalid. */
3702 /* */
3703 /* <Note> */
3704 /* The last item in the array is~0; the array is owned by the */
3705 /* @FT_Face object but can be overwritten or released on the next */
3706 /* call to a FreeType function. */
3707 /* */
3708 /* <Since> */
3709 /* 2.3.6 */
3710 /* */
3711 FT_EXPORT( FT_UInt32* )
3712 FT_Face_GetCharsOfVariant( FT_Face face,
3713 FT_ULong variantSelector );
3716 /*************************************************************************/
3717 /* */
3718 /* <Section> */
3719 /* computations */
3720 /* */
3721 /* <Title> */
3722 /* Computations */
3723 /* */
3724 /* <Abstract> */
3725 /* Crunching fixed numbers and vectors. */
3726 /* */
3727 /* <Description> */
3728 /* This section contains various functions used to perform */
3729 /* computations on 16.16 fixed-float numbers or 2d vectors. */
3730 /* */
3731 /* <Order> */
3732 /* FT_MulDiv */
3733 /* FT_MulFix */
3734 /* FT_DivFix */
3735 /* FT_RoundFix */
3736 /* FT_CeilFix */
3737 /* FT_FloorFix */
3738 /* FT_Vector_Transform */
3739 /* FT_Matrix_Multiply */
3740 /* FT_Matrix_Invert */
3741 /* */
3742 /*************************************************************************/
3745 /*************************************************************************/
3746 /* */
3747 /* <Function> */
3748 /* FT_MulDiv */
3749 /* */
3750 /* <Description> */
3751 /* A very simple function used to perform the computation `(a*b)/c' */
3752 /* with maximum accuracy (it uses a 64-bit intermediate integer */
3753 /* whenever necessary). */
3754 /* */
3755 /* This function isn't necessarily as fast as some processor specific */
3756 /* operations, but is at least completely portable. */
3757 /* */
3758 /* <Input> */
3759 /* a :: The first multiplier. */
3760 /* b :: The second multiplier. */
3761 /* c :: The divisor. */
3762 /* */
3763 /* <Return> */
3764 /* The result of `(a*b)/c'. This function never traps when trying to */
3765 /* divide by zero; it simply returns `MaxInt' or `MinInt' depending */
3766 /* on the signs of `a' and `b'. */
3767 /* */
3768 FT_EXPORT( FT_Long )
3769 FT_MulDiv( FT_Long a,
3770 FT_Long b,
3771 FT_Long c );
3774 /*************************************************************************/
3775 /* */
3776 /* <Function> */
3777 /* FT_MulFix */
3778 /* */
3779 /* <Description> */
3780 /* A very simple function used to perform the computation */
3781 /* `(a*b)/0x10000' with maximum accuracy. Most of the time this is */
3782 /* used to multiply a given value by a 16.16 fixed-point factor. */
3783 /* */
3784 /* <Input> */
3785 /* a :: The first multiplier. */
3786 /* b :: The second multiplier. Use a 16.16 factor here whenever */
3787 /* possible (see note below). */
3788 /* */
3789 /* <Return> */
3790 /* The result of `(a*b)/0x10000'. */
3791 /* */
3792 /* <Note> */
3793 /* This function has been optimized for the case where the absolute */
3794 /* value of `a' is less than 2048, and `b' is a 16.16 scaling factor. */
3795 /* As this happens mainly when scaling from notional units to */
3796 /* fractional pixels in FreeType, it resulted in noticeable speed */
3797 /* improvements between versions 2.x and 1.x. */
3798 /* */
3799 /* As a conclusion, always try to place a 16.16 factor as the */
3800 /* _second_ argument of this function; this can make a great */
3801 /* difference. */
3802 /* */
3803 FT_EXPORT( FT_Long )
3804 FT_MulFix( FT_Long a,
3805 FT_Long b );
3808 /*************************************************************************/
3809 /* */
3810 /* <Function> */
3811 /* FT_DivFix */
3812 /* */
3813 /* <Description> */
3814 /* A very simple function used to perform the computation */
3815 /* `(a*0x10000)/b' with maximum accuracy. Most of the time, this is */
3816 /* used to divide a given value by a 16.16 fixed-point factor. */
3817 /* */
3818 /* <Input> */
3819 /* a :: The numerator. */
3820 /* b :: The denominator. Use a 16.16 factor here. */
3821 /* */
3822 /* <Return> */
3823 /* The result of `(a*0x10000)/b'. */
3824 /* */
3825 FT_EXPORT( FT_Long )
3826 FT_DivFix( FT_Long a,
3827 FT_Long b );
3830 /*************************************************************************/
3831 /* */
3832 /* <Function> */
3833 /* FT_RoundFix */
3834 /* */
3835 /* <Description> */
3836 /* A very simple function used to round a 16.16 fixed number. */
3837 /* */
3838 /* <Input> */
3839 /* a :: The number to be rounded. */
3840 /* */
3841 /* <Return> */
3842 /* The result of `(a + 0x8000) & -0x10000'. */
3843 /* */
3844 FT_EXPORT( FT_Fixed )
3845 FT_RoundFix( FT_Fixed a );
3848 /*************************************************************************/
3849 /* */
3850 /* <Function> */
3851 /* FT_CeilFix */
3852 /* */
3853 /* <Description> */
3854 /* A very simple function used to compute the ceiling function of a */
3855 /* 16.16 fixed number. */
3856 /* */
3857 /* <Input> */
3858 /* a :: The number for which the ceiling function is to be computed. */
3859 /* */
3860 /* <Return> */
3861 /* The result of `(a + 0x10000 - 1) & -0x10000'. */
3862 /* */
3863 FT_EXPORT( FT_Fixed )
3864 FT_CeilFix( FT_Fixed a );
3867 /*************************************************************************/
3868 /* */
3869 /* <Function> */
3870 /* FT_FloorFix */
3871 /* */
3872 /* <Description> */
3873 /* A very simple function used to compute the floor function of a */
3874 /* 16.16 fixed number. */
3875 /* */
3876 /* <Input> */
3877 /* a :: The number for which the floor function is to be computed. */
3878 /* */
3879 /* <Return> */
3880 /* The result of `a & -0x10000'. */
3881 /* */
3882 FT_EXPORT( FT_Fixed )
3883 FT_FloorFix( FT_Fixed a );
3886 /*************************************************************************/
3887 /* */
3888 /* <Function> */
3889 /* FT_Vector_Transform */
3890 /* */
3891 /* <Description> */
3892 /* Transform a single vector through a 2x2 matrix. */
3893 /* */
3894 /* <InOut> */
3895 /* vector :: The target vector to transform. */
3896 /* */
3897 /* <Input> */
3898 /* matrix :: A pointer to the source 2x2 matrix. */
3899 /* */
3900 /* <Note> */
3901 /* The result is undefined if either `vector' or `matrix' is invalid. */
3902 /* */
3903 FT_EXPORT( void )
3904 FT_Vector_Transform( FT_Vector* vec,
3905 const FT_Matrix* matrix );
3908 /*************************************************************************/
3909 /* */
3910 /* <Section> */
3911 /* version */
3912 /* */
3913 /* <Title> */
3914 /* FreeType Version */
3915 /* */
3916 /* <Abstract> */
3917 /* Functions and macros related to FreeType versions. */
3918 /* */
3919 /* <Description> */
3920 /* Note that those functions and macros are of limited use because */
3921 /* even a new release of FreeType with only documentation changes */
3922 /* increases the version number. */
3923 /* */
3924 /* <Order> */
3925 /* FT_Library_Version */
3926 /* */
3927 /* FREETYPE_MAJOR */
3928 /* FREETYPE_MINOR */
3929 /* FREETYPE_PATCH */
3930 /* */
3931 /* FT_Face_CheckTrueTypePatents */
3932 /* FT_Face_SetUnpatentedHinting */
3933 /* */
3934 /* FREETYPE_XXX */
3935 /* */
3936 /*************************************************************************/
3939 /*************************************************************************
3941 * @enum:
3942 * FREETYPE_XXX
3944 * @description:
3945 * These three macros identify the FreeType source code version.
3946 * Use @FT_Library_Version to access them at runtime.
3948 * @values:
3949 * FREETYPE_MAJOR :: The major version number.
3950 * FREETYPE_MINOR :: The minor version number.
3951 * FREETYPE_PATCH :: The patch level.
3953 * @note:
3954 * The version number of FreeType if built as a dynamic link library
3955 * with the `libtool' package is _not_ controlled by these three
3956 * macros.
3959 #define FREETYPE_MAJOR 2
3960 #define FREETYPE_MINOR 6
3961 #define FREETYPE_PATCH 0
3964 /*************************************************************************/
3965 /* */
3966 /* <Function> */
3967 /* FT_Library_Version */
3968 /* */
3969 /* <Description> */
3970 /* Return the version of the FreeType library being used. This is */
3971 /* useful when dynamically linking to the library, since one cannot */
3972 /* use the macros @FREETYPE_MAJOR, @FREETYPE_MINOR, and */
3973 /* @FREETYPE_PATCH. */
3974 /* */
3975 /* <Input> */
3976 /* library :: A source library handle. */
3977 /* */
3978 /* <Output> */
3979 /* amajor :: The major version number. */
3980 /* */
3981 /* aminor :: The minor version number. */
3982 /* */
3983 /* apatch :: The patch version number. */
3984 /* */
3985 /* <Note> */
3986 /* The reason why this function takes a `library' argument is because */
3987 /* certain programs implement library initialization in a custom way */
3988 /* that doesn't use @FT_Init_FreeType. */
3989 /* */
3990 /* In such cases, the library version might not be available before */
3991 /* the library object has been created. */
3992 /* */
3993 FT_EXPORT( void )
3994 FT_Library_Version( FT_Library library,
3995 FT_Int *amajor,
3996 FT_Int *aminor,
3997 FT_Int *apatch );
4000 /*************************************************************************/
4001 /* */
4002 /* <Function> */
4003 /* FT_Face_CheckTrueTypePatents */
4004 /* */
4005 /* <Description> */
4006 /* Parse all bytecode instructions of a TrueType font file to check */
4007 /* whether any of the patented opcodes are used. This is only useful */
4008 /* if you want to be able to use the unpatented hinter with */
4009 /* fonts that do *not* use these opcodes. */
4010 /* */
4011 /* Note that this function parses *all* glyph instructions in the */
4012 /* font file, which may be slow. */
4013 /* */
4014 /* <Input> */
4015 /* face :: A face handle. */
4016 /* */
4017 /* <Return> */
4018 /* 1~if this is a TrueType font that uses one of the patented */
4019 /* opcodes, 0~otherwise. */
4020 /* */
4021 /* <Note> */
4022 /* Since May 2010, TrueType hinting is no longer patented. */
4023 /* */
4024 /* <Since> */
4025 /* 2.3.5 */
4026 /* */
4027 FT_EXPORT( FT_Bool )
4028 FT_Face_CheckTrueTypePatents( FT_Face face );
4031 /*************************************************************************/
4032 /* */
4033 /* <Function> */
4034 /* FT_Face_SetUnpatentedHinting */
4035 /* */
4036 /* <Description> */
4037 /* Enable or disable the unpatented hinter for a given face. */
4038 /* Only enable it if you have determined that the face doesn't */
4039 /* use any patented opcodes (see @FT_Face_CheckTrueTypePatents). */
4040 /* */
4041 /* <Input> */
4042 /* face :: A face handle. */
4043 /* */
4044 /* value :: New boolean setting. */
4045 /* */
4046 /* <Return> */
4047 /* The old setting value. This will always be false if this is not */
4048 /* an SFNT font, or if the unpatented hinter is not compiled in this */
4049 /* instance of the library. */
4050 /* */
4051 /* <Note> */
4052 /* Since May 2010, TrueType hinting is no longer patented. */
4053 /* */
4054 /* <Since> */
4055 /* 2.3.5 */
4056 /* */
4057 FT_EXPORT( FT_Bool )
4058 FT_Face_SetUnpatentedHinting( FT_Face face,
4059 FT_Bool value );
4061 /* */
4064 FT_END_HEADER
4066 #endif /* __FREETYPE_H__ */
4069 /* END */