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