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