add explicit freetype2 linking
[charfbuzz.git] / hb-open-file-private.h
blob3e4514517efb14434d2ac3a08b82a06eedf8ffaa
1 #ifndef HB_OPEN_FILE_PRIVATE_H
2 #define HB_OPEN_FILE_PRIVATE_H
4 /*Organization of an OpenType Font
5 note: structs are supposely properly aligned to avoid the use of packing*/
7 #define IDX_NOT_FOUND 0xffff
9 struct tbl_rec {
10 uint32_t tag; /*4-byte identifier */
11 uint32_t chk_sum; /*Check sum for this table */
12 uint32_t of; /*Offset from beginning of TrueType font file */
13 uint32_t len; /*Length of this table */
15 #define ot_tbl tbl_rec
17 struct ot_fnt_face {
18 uint32_t sfnt_ver; /*'\0\001\0\00' if TrueType / 'OTTO' if CFF& */
19 uint16_t tbls_n; /*Number of tables */
20 uint16_t search_range; /*(Maximum power of 2 <= tbls_n) * 16 */
21 uint16_t entry_selector; /*Log2(maximum power of 2 <= tbls_n) */
22 uint16_t range_shift; /*tbls_n * 16 - search_range */
23 struct tbl_rec tbls[1]; /*tbl_rec entries. tbls_n items. */
25 #define of_tbl ot_fnt_face
27 struct fixed_ver {
28 uint16_t major;
29 uint16_t minor;
32 struct ttc_hdr_ver1 {
33 uint32_t ttc_tag; /*TrueType Collection ID string: 'ttcf' */
34 struct fixed_ver ver; /*Version of the TTC Header (1.0), 0x00010000 */
35 uint32_t of_tbls_ofs[1]; /*Array of offsets to the OffsetTable for each */
36 /*font from the beginning of the file */
39 struct ttc_hdr {
40 union {
41 struct {
42 uint32_t ttc_tag; /*TrueType Collection ID string: 'ttcf' */
43 struct fixed_ver ver; /*Version of the TTC Header (1.0 or 2.0), */
44 /* 0x00010000 or 0x00020000 */
45 } hdr;
46 struct ttc_hdr_ver1 ver1;
47 } u;
50 /*OpenType with Postscript outlines*/
51 #define CFF_TAG HB_TAG('O','T','T','O')
52 /*OpenType with TrueType outlines*/
53 #define TRUETYPE_TAG HB_TAG( 0 , 1 , 0 , 0 )
54 /*TrueType Collection*/
55 #define TTC_TAG HB_TAG('t','t','c','f')
56 /*Obsolete Apple TrueType*/
57 #define TRUE_TAG HB_TAG('t','r','u','e')
58 /*Obsolete Apple Type1 font in SFNT container*/
59 #define TYP1_TAG HB_TAG('t','y','p','1')
61 struct ot_fnt_file {
62 union {
63 uint32_t tag;
64 struct ot_fnt_face fnt_face;
65 struct ttc_hdr ttc_hdr;
66 } u;
69 struct ot_fnt_face *ot_fnt_file_get_face(struct ot_fnt_file *ot_fnt_file,
70 unsigned i);
72 struct tbl_rec *ot_fnt_face_get_tbl_by_tag(struct ot_fnt_face *ot_fnt_face,
73 hb_tag_t tag);
74 #endif