OLD | NEW |
1 /***************************************************************************/ | 1 /***************************************************************************/ |
2 /* */ | 2 /* */ |
3 /* tttables.h */ | 3 /* tttables.h */ |
4 /* */ | 4 /* */ |
5 /* Basic SFNT/TrueType tables definitions and interface */ | 5 /* Basic SFNT/TrueType tables definitions and interface */ |
6 /* (specification only). */ | 6 /* (specification only). */ |
7 /* */ | 7 /* */ |
8 /* Copyright 1996-2005, 2008-2012 by */ | 8 /* Copyright 1996-2005, 2008-2014 by */ |
9 /* David Turner, Robert Wilhelm, and Werner Lemberg. */ | 9 /* David Turner, Robert Wilhelm, and Werner Lemberg. */ |
10 /* */ | 10 /* */ |
11 /* This file is part of the FreeType project, and may only be used, */ | 11 /* This file is part of the FreeType project, and may only be used, */ |
12 /* modified, and distributed under the terms of the FreeType project */ | 12 /* modified, and distributed under the terms of the FreeType project */ |
13 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ | 13 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ |
14 /* this file you indicate that you have read the license and */ | 14 /* this file you indicate that you have read the license and */ |
15 /* understand and accept it fully. */ | 15 /* understand and accept it fully. */ |
16 /* */ | 16 /* */ |
17 /***************************************************************************/ | 17 /***************************************************************************/ |
18 | 18 |
19 | 19 |
20 #ifndef __TTTABLES_H__ | 20 #ifndef __TTTABLES_H__ |
21 #define __TTTABLES_H__ | 21 #define __TTTABLES_H__ |
22 | 22 |
23 | 23 |
24 #include "../ft2build.h" | 24 #include <ft2build.h> |
25 #include "freetype.h" | 25 #include FT_FREETYPE_H |
26 | 26 |
27 #ifdef FREETYPE_H | 27 #ifdef FREETYPE_H |
28 #error "freetype.h of FreeType 1 has been loaded!" | 28 #error "freetype.h of FreeType 1 has been loaded!" |
29 #error "Please fix the directory search order for header files" | 29 #error "Please fix the directory search order for header files" |
30 #error "so that freetype.h of FreeType 2 is found first." | 30 #error "so that freetype.h of FreeType 2 is found first." |
31 #endif | 31 #endif |
32 | 32 |
33 | 33 |
34 FT_BEGIN_HEADER | 34 FT_BEGIN_HEADER |
35 | 35 |
36 /*************************************************************************/ | 36 /*************************************************************************/ |
37 /* */ | 37 /* */ |
38 /* <Section> */ | 38 /* <Section> */ |
39 /* truetype_tables */ | 39 /* truetype_tables */ |
40 /* */ | 40 /* */ |
41 /* <Title> */ | 41 /* <Title> */ |
42 /* TrueType Tables */ | 42 /* TrueType Tables */ |
43 /* */ | 43 /* */ |
44 /* <Abstract> */ | 44 /* <Abstract> */ |
45 /* TrueType specific table types and functions. */ | 45 /* TrueType specific table types and functions. */ |
46 /* */ | 46 /* */ |
47 /* <Description> */ | 47 /* <Description> */ |
48 /* This section contains the definition of TrueType-specific tables */ | 48 /* This section contains the definition of TrueType-specific tables */ |
49 /* as well as some routines used to access and process them. */ | 49 /* as well as some routines used to access and process them. */ |
50 /* */ | 50 /* */ |
| 51 /* <Order> */ |
| 52 /* TT_Header */ |
| 53 /* TT_HoriHeader */ |
| 54 /* TT_VertHeader */ |
| 55 /* TT_OS2 */ |
| 56 /* TT_Postscript */ |
| 57 /* TT_PCLT */ |
| 58 /* TT_MaxProfile */ |
| 59 /* */ |
| 60 /* FT_Sfnt_Tag */ |
| 61 /* FT_Get_Sfnt_Table */ |
| 62 /* FT_Load_Sfnt_Table */ |
| 63 /* FT_Sfnt_Table_Info */ |
| 64 /* */ |
| 65 /* FT_Get_CMap_Language_ID */ |
| 66 /* FT_Get_CMap_Format */ |
| 67 /* */ |
| 68 /* FT_PARAM_TAG_UNPATENTED_HINTING */ |
| 69 /* */ |
51 /*************************************************************************/ | 70 /*************************************************************************/ |
52 | 71 |
53 | 72 |
54 /*************************************************************************/ | 73 /*************************************************************************/ |
55 /* */ | 74 /* */ |
56 /* <Struct> */ | 75 /* <Struct> */ |
57 /* TT_Header */ | 76 /* TT_Header */ |
58 /* */ | 77 /* */ |
59 /* <Description> */ | 78 /* <Description> */ |
60 /* A structure used to model a TrueType font header table. All */ | 79 /* A structure used to model a TrueType font header table. All */ |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 /* number_Of_HMetrics :: Number of HMetrics entries in the `hmtx' */ | 182 /* number_Of_HMetrics :: Number of HMetrics entries in the `hmtx' */ |
164 /* table -- this value can be smaller than */ | 183 /* table -- this value can be smaller than */ |
165 /* the total number of glyphs in the font. */ | 184 /* the total number of glyphs in the font. */ |
166 /* */ | 185 /* */ |
167 /* long_metrics :: A pointer into the `hmtx' table. */ | 186 /* long_metrics :: A pointer into the `hmtx' table. */ |
168 /* */ | 187 /* */ |
169 /* short_metrics :: A pointer into the `hmtx' table. */ | 188 /* short_metrics :: A pointer into the `hmtx' table. */ |
170 /* */ | 189 /* */ |
171 /* <Note> */ | 190 /* <Note> */ |
172 /* IMPORTANT: The TT_HoriHeader and TT_VertHeader structures should */ | 191 /* IMPORTANT: The TT_HoriHeader and TT_VertHeader structures should */ |
173 /* be identical except for the names of their fields which */ | 192 /* be identical except for the names of their fields, */ |
174 /* are different. */ | 193 /* which are different. */ |
175 /* */ | 194 /* */ |
176 /* This ensures that a single function in the `ttload' */ | 195 /* This ensures that a single function in the `ttload' */ |
177 /* module is able to read both the horizontal and vertical */ | 196 /* module is able to read both the horizontal and vertical */ |
178 /* headers. */ | 197 /* headers. */ |
179 /* */ | 198 /* */ |
180 typedef struct TT_HoriHeader_ | 199 typedef struct TT_HoriHeader_ |
181 { | 200 { |
182 FT_Fixed Version; | 201 FT_Fixed Version; |
183 FT_Short Ascender; | 202 FT_Short Ascender; |
184 FT_Short Descender; | 203 FT_Short Descender; |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 /* `vmtx' table -- this value can be */ | 308 /* `vmtx' table -- this value can be */ |
290 /* smaller than the total number of glyphs */ | 309 /* smaller than the total number of glyphs */ |
291 /* in the font. */ | 310 /* in the font. */ |
292 /* */ | 311 /* */ |
293 /* long_metrics :: A pointer into the `vmtx' table. */ | 312 /* long_metrics :: A pointer into the `vmtx' table. */ |
294 /* */ | 313 /* */ |
295 /* short_metrics :: A pointer into the `vmtx' table. */ | 314 /* short_metrics :: A pointer into the `vmtx' table. */ |
296 /* */ | 315 /* */ |
297 /* <Note> */ | 316 /* <Note> */ |
298 /* IMPORTANT: The TT_HoriHeader and TT_VertHeader structures should */ | 317 /* IMPORTANT: The TT_HoriHeader and TT_VertHeader structures should */ |
299 /* be identical except for the names of their fields which */ | 318 /* be identical except for the names of their fields, */ |
300 /* are different. */ | 319 /* which are different. */ |
301 /* */ | 320 /* */ |
302 /* This ensures that a single function in the `ttload' */ | 321 /* This ensures that a single function in the `ttload' */ |
303 /* module is able to read both the horizontal and vertical */ | 322 /* module is able to read both the horizontal and vertical */ |
304 /* headers. */ | 323 /* headers. */ |
305 /* */ | 324 /* */ |
306 typedef struct TT_VertHeader_ | 325 typedef struct TT_VertHeader_ |
307 { | 326 { |
308 FT_Fixed Version; | 327 FT_Fixed Version; |
309 FT_Short Ascender; | 328 FT_Short Ascender; |
310 FT_Short Descender; | 329 FT_Short Descender; |
(...skipping 22 matching lines...) Expand all Loading... |
333 | 352 |
334 } TT_VertHeader; | 353 } TT_VertHeader; |
335 | 354 |
336 | 355 |
337 /*************************************************************************/ | 356 /*************************************************************************/ |
338 /* */ | 357 /* */ |
339 /* <Struct> */ | 358 /* <Struct> */ |
340 /* TT_OS2 */ | 359 /* TT_OS2 */ |
341 /* */ | 360 /* */ |
342 /* <Description> */ | 361 /* <Description> */ |
343 /* A structure used to model a TrueType OS/2 table. This is the long */ | 362 /* A structure used to model a TrueType OS/2 table. All fields */ |
344 /* table version. All fields comply to the TrueType specification. */ | 363 /* comply to the OpenType specification. */ |
345 /* */ | 364 /* */ |
346 /* Note that we now support old Mac fonts which do not include an */ | 365 /* Note that we now support old Mac fonts that do not include an OS/2 */ |
347 /* OS/2 table. In this case, the `version' field is always set to */ | 366 /* table. In this case, the `version' field is always set to 0xFFFF. */ |
348 /* 0xFFFF. */ | |
349 /* */ | 367 /* */ |
350 typedef struct TT_OS2_ | 368 typedef struct TT_OS2_ |
351 { | 369 { |
352 FT_UShort version; /* 0x0001 - more or 0xFFFF */ | 370 FT_UShort version; /* 0x0001 - more or 0xFFFF */ |
353 FT_Short xAvgCharWidth; | 371 FT_Short xAvgCharWidth; |
354 FT_UShort usWeightClass; | 372 FT_UShort usWeightClass; |
355 FT_UShort usWidthClass; | 373 FT_UShort usWidthClass; |
356 FT_Short fsType; | 374 FT_Short fsType; |
357 FT_Short ySubscriptXSize; | 375 FT_Short ySubscriptXSize; |
358 FT_Short ySubscriptYSize; | 376 FT_Short ySubscriptYSize; |
(...skipping 18 matching lines...) Expand all Loading... |
377 | 395 |
378 FT_UShort fsSelection; | 396 FT_UShort fsSelection; |
379 FT_UShort usFirstCharIndex; | 397 FT_UShort usFirstCharIndex; |
380 FT_UShort usLastCharIndex; | 398 FT_UShort usLastCharIndex; |
381 FT_Short sTypoAscender; | 399 FT_Short sTypoAscender; |
382 FT_Short sTypoDescender; | 400 FT_Short sTypoDescender; |
383 FT_Short sTypoLineGap; | 401 FT_Short sTypoLineGap; |
384 FT_UShort usWinAscent; | 402 FT_UShort usWinAscent; |
385 FT_UShort usWinDescent; | 403 FT_UShort usWinDescent; |
386 | 404 |
387 /* only version 1 tables: */ | 405 /* only version 1 and higher: */ |
388 | 406 |
389 FT_ULong ulCodePageRange1; /* Bits 0-31 */ | 407 FT_ULong ulCodePageRange1; /* Bits 0-31 */ |
390 FT_ULong ulCodePageRange2; /* Bits 32-63 */ | 408 FT_ULong ulCodePageRange2; /* Bits 32-63 */ |
391 | 409 |
392 /* only version 2 tables: */ | 410 /* only version 2 and higher: */ |
393 | 411 |
394 FT_Short sxHeight; | 412 FT_Short sxHeight; |
395 FT_Short sCapHeight; | 413 FT_Short sCapHeight; |
396 FT_UShort usDefaultChar; | 414 FT_UShort usDefaultChar; |
397 FT_UShort usBreakChar; | 415 FT_UShort usBreakChar; |
398 FT_UShort usMaxContext; | 416 FT_UShort usMaxContext; |
399 | 417 |
| 418 /* only version 5 and higher: */ |
| 419 |
| 420 FT_UShort usLowerOpticalPointSize; /* in twips (1/20th points) */ |
| 421 FT_UShort usUpperOpticalPointSize; /* in twips (1/20th points) */ |
| 422 |
400 } TT_OS2; | 423 } TT_OS2; |
401 | 424 |
402 | 425 |
403 /*************************************************************************/ | 426 /*************************************************************************/ |
404 /* */ | 427 /* */ |
405 /* <Struct> */ | 428 /* <Struct> */ |
406 /* TT_Postscript */ | 429 /* TT_Postscript */ |
407 /* */ | 430 /* */ |
408 /* <Description> */ | 431 /* <Description> */ |
409 /* A structure used to model a TrueType PostScript table. All fields */ | 432 /* A structure used to model a TrueType PostScript table. All fields */ |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
458 | 481 |
459 } TT_PCLT; | 482 } TT_PCLT; |
460 | 483 |
461 | 484 |
462 /*************************************************************************/ | 485 /*************************************************************************/ |
463 /* */ | 486 /* */ |
464 /* <Struct> */ | 487 /* <Struct> */ |
465 /* TT_MaxProfile */ | 488 /* TT_MaxProfile */ |
466 /* */ | 489 /* */ |
467 /* <Description> */ | 490 /* <Description> */ |
468 /* The maximum profile is a table containing many max values which */ | 491 /* The maximum profile is a table containing many max values, which */ |
469 /* can be used to pre-allocate arrays. This ensures that no memory */ | 492 /* can be used to pre-allocate arrays. This ensures that no memory */ |
470 /* allocation occurs during a glyph load. */ | 493 /* allocation occurs during a glyph load. */ |
471 /* */ | 494 /* */ |
472 /* <Fields> */ | 495 /* <Fields> */ |
473 /* version :: The version number. */ | 496 /* version :: The version number. */ |
474 /* */ | 497 /* */ |
475 /* numGlyphs :: The number of glyphs in this TrueType */ | 498 /* numGlyphs :: The number of glyphs in this TrueType */ |
476 /* font. */ | 499 /* font. */ |
477 /* */ | 500 /* */ |
478 /* maxPoints :: The maximum number of points in a */ | 501 /* maxPoints :: The maximum number of points in a */ |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
548 | 571 |
549 /*************************************************************************/ | 572 /*************************************************************************/ |
550 /* */ | 573 /* */ |
551 /* <Enum> */ | 574 /* <Enum> */ |
552 /* FT_Sfnt_Tag */ | 575 /* FT_Sfnt_Tag */ |
553 /* */ | 576 /* */ |
554 /* <Description> */ | 577 /* <Description> */ |
555 /* An enumeration used to specify the index of an SFNT table. */ | 578 /* An enumeration used to specify the index of an SFNT table. */ |
556 /* Used in the @FT_Get_Sfnt_Table API function. */ | 579 /* Used in the @FT_Get_Sfnt_Table API function. */ |
557 /* */ | 580 /* */ |
| 581 /* <Values> */ |
| 582 /* FT_SFNT_HEAD :: To access the font's @TT_Header structure. */ |
| 583 /* */ |
| 584 /* FT_SFNT_MAXP :: To access the font's @TT_MaxProfile structure. */ |
| 585 /* */ |
| 586 /* FT_SFNT_OS2 :: To access the font's @TT_OS2 structure. */ |
| 587 /* */ |
| 588 /* FT_SFNT_HHEA :: To access the font's @TT_HoriHeader structure. */ |
| 589 /* */ |
| 590 /* FT_SFNT_VHEA :: To access the font's @TT_VertHeader struture. */ |
| 591 /* */ |
| 592 /* FT_SFNT_POST :: To access the font's @TT_Postscript structure. */ |
| 593 /* */ |
| 594 /* FT_SFNT_PCLT :: To access the font's @TT_PCLT structure. */ |
| 595 /* */ |
558 typedef enum FT_Sfnt_Tag_ | 596 typedef enum FT_Sfnt_Tag_ |
559 { | 597 { |
560 ft_sfnt_head = 0, /* TT_Header */ | 598 FT_SFNT_HEAD, |
561 ft_sfnt_maxp = 1, /* TT_MaxProfile */ | 599 FT_SFNT_MAXP, |
562 ft_sfnt_os2 = 2, /* TT_OS2 */ | 600 FT_SFNT_OS2, |
563 ft_sfnt_hhea = 3, /* TT_HoriHeader */ | 601 FT_SFNT_HHEA, |
564 ft_sfnt_vhea = 4, /* TT_VertHeader */ | 602 FT_SFNT_VHEA, |
565 ft_sfnt_post = 5, /* TT_Postscript */ | 603 FT_SFNT_POST, |
566 ft_sfnt_pclt = 6, /* TT_PCLT */ | 604 FT_SFNT_PCLT, |
567 | 605 |
568 sfnt_max /* internal end mark */ | 606 FT_SFNT_MAX |
569 | 607 |
570 } FT_Sfnt_Tag; | 608 } FT_Sfnt_Tag; |
571 | 609 |
572 /* */ | 610 /* these constants are deprecated; use the corresponding `FT_Sfnt_Tag' */ |
| 611 /* values instead */ |
| 612 #define ft_sfnt_head FT_SFNT_HEAD |
| 613 #define ft_sfnt_maxp FT_SFNT_MAXP |
| 614 #define ft_sfnt_os2 FT_SFNT_OS2 |
| 615 #define ft_sfnt_hhea FT_SFNT_HHEA |
| 616 #define ft_sfnt_vhea FT_SFNT_VHEA |
| 617 #define ft_sfnt_post FT_SFNT_POST |
| 618 #define ft_sfnt_pclt FT_SFNT_PCLT |
573 | 619 |
574 | 620 |
575 /*************************************************************************/ | 621 /*************************************************************************/ |
576 /* */ | 622 /* */ |
577 /* <Function> */ | 623 /* <Function> */ |
578 /* FT_Get_Sfnt_Table */ | 624 /* FT_Get_Sfnt_Table */ |
579 /* */ | 625 /* */ |
580 /* <Description> */ | 626 /* <Description> */ |
581 /* Return a pointer to a given SFNT table within a face. */ | 627 /* Return a pointer to a given SFNT table within a face. */ |
582 /* */ | 628 /* */ |
(...skipping 17 matching lines...) Expand all Loading... |
600 /* by the sfnt, truetype, and opentype drivers. See @FT_Sfnt_Tag for */ | 646 /* by the sfnt, truetype, and opentype drivers. See @FT_Sfnt_Tag for */ |
601 /* a list. */ | 647 /* a list. */ |
602 /* */ | 648 /* */ |
603 /* Here an example how to access the `vhea' table: */ | 649 /* Here an example how to access the `vhea' table: */ |
604 /* */ | 650 /* */ |
605 /* { */ | 651 /* { */ |
606 /* TT_VertHeader* vert_header; */ | 652 /* TT_VertHeader* vert_header; */ |
607 /* */ | 653 /* */ |
608 /* */ | 654 /* */ |
609 /* vert_header = */ | 655 /* vert_header = */ |
610 /* (TT_VertHeader*)FT_Get_Sfnt_Table( face, ft_sfnt_vhea ); */ | 656 /* (TT_VertHeader*)FT_Get_Sfnt_Table( face, FT_SFNT_VHEA ); */ |
611 /* } */ | 657 /* } */ |
612 /* */ | 658 /* */ |
613 FT_EXPORT( void* ) | 659 FT_EXPORT( void* ) |
614 FT_Get_Sfnt_Table( FT_Face face, | 660 FT_Get_Sfnt_Table( FT_Face face, |
615 FT_Sfnt_Tag tag ); | 661 FT_Sfnt_Tag tag ); |
616 | 662 |
617 | 663 |
618 /************************************************************************** | 664 /************************************************************************** |
619 * | 665 * |
620 * @function: | 666 * @function: |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
665 * | 711 * |
666 * error = FT_Load_Sfnt_Table( face, tag, 0, NULL, &length ); | 712 * error = FT_Load_Sfnt_Table( face, tag, 0, NULL, &length ); |
667 * if ( error ) { ... table does not exist ... } | 713 * if ( error ) { ... table does not exist ... } |
668 * | 714 * |
669 * buffer = malloc( length ); | 715 * buffer = malloc( length ); |
670 * if ( buffer == NULL ) { ... not enough memory ... } | 716 * if ( buffer == NULL ) { ... not enough memory ... } |
671 * | 717 * |
672 * error = FT_Load_Sfnt_Table( face, tag, 0, buffer, &length ); | 718 * error = FT_Load_Sfnt_Table( face, tag, 0, buffer, &length ); |
673 * if ( error ) { ... could not load table ... } | 719 * if ( error ) { ... could not load table ... } |
674 * } | 720 * } |
| 721 * |
| 722 * Note that structures like @TT_Header or @TT_OS2 can't be used with |
| 723 * this function; they are limited to @FT_Get_Sfnt_Table. Reason is that |
| 724 * those structures depend on the processor architecture, with varying |
| 725 * size (e.g. 32bit vs. 64bit) or order (big endian vs. little endian). |
| 726 * |
675 */ | 727 */ |
676 FT_EXPORT( FT_Error ) | 728 FT_EXPORT( FT_Error ) |
677 FT_Load_Sfnt_Table( FT_Face face, | 729 FT_Load_Sfnt_Table( FT_Face face, |
678 FT_ULong tag, | 730 FT_ULong tag, |
679 FT_Long offset, | 731 FT_Long offset, |
680 FT_Byte* buffer, | 732 FT_Byte* buffer, |
681 FT_ULong* length ); | 733 FT_ULong* length ); |
682 | 734 |
683 | 735 |
684 /************************************************************************** | 736 /************************************************************************** |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
723 FT_ULong *length ); | 775 FT_ULong *length ); |
724 | 776 |
725 | 777 |
726 /*************************************************************************/ | 778 /*************************************************************************/ |
727 /* */ | 779 /* */ |
728 /* <Function> */ | 780 /* <Function> */ |
729 /* FT_Get_CMap_Language_ID */ | 781 /* FT_Get_CMap_Language_ID */ |
730 /* */ | 782 /* */ |
731 /* <Description> */ | 783 /* <Description> */ |
732 /* Return TrueType/sfnt specific cmap language ID. Definitions of */ | 784 /* Return TrueType/sfnt specific cmap language ID. Definitions of */ |
733 /* language ID values are in `freetype/ttnameid.h'. */ | 785 /* language ID values are in `ttnameid.h'. */ |
734 /* */ | 786 /* */ |
735 /* <Input> */ | 787 /* <Input> */ |
736 /* charmap :: */ | 788 /* charmap :: */ |
737 /* The target charmap. */ | 789 /* The target charmap. */ |
738 /* */ | 790 /* */ |
739 /* <Return> */ | 791 /* <Return> */ |
740 /* The language ID of `charmap'. If `charmap' doesn't belong to a */ | 792 /* The language ID of `charmap'. If `charmap' doesn't belong to a */ |
741 /* TrueType/sfnt face, just return~0 as the default value. */ | 793 /* TrueType/sfnt face, just return~0 as the default value. */ |
742 /* */ | 794 /* */ |
743 /* For a format~14 cmap (to access Unicode IVS), the return value is */ | 795 /* For a format~14 cmap (to access Unicode IVS), the return value is */ |
(...skipping 24 matching lines...) Expand all Loading... |
768 | 820 |
769 /* */ | 821 /* */ |
770 | 822 |
771 | 823 |
772 FT_END_HEADER | 824 FT_END_HEADER |
773 | 825 |
774 #endif /* __TTTABLES_H__ */ | 826 #endif /* __TTTABLES_H__ */ |
775 | 827 |
776 | 828 |
777 /* END */ | 829 /* END */ |
OLD | NEW |