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