make cleanup and some bash-ism removal
[charfbuzz.git] / hb-open-file-private.h
blob7172c280ad7dbb708d6818d386bdbb6e852d80c8
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
8 #define IDX_NOT_FOUND 0xffff
10 struct tbl_rec
12 uint32_t tag; //4-byte identifier
13 uint32_t chk_sum;//Check sum for this table
14 uint32_t of; //Offset from beginning of TrueType font file
15 uint32_t len; //Length of this table
17 #define ot_tbl tbl_rec
19 struct ot_fnt_face
21 uint32_t sfnt_ver; //'\0\001\0\00' if TrueType / 'OTTO' if CFF
22 uint16_t tbls_n; //Number of tables
23 uint16_t search_range; //(Maximum power of 2 <= tbls_n) * 16
24 uint16_t entry_selector;//Log2(maximum power of 2 <= tbls_n)
25 uint16_t range_shift; //tbls_n * 16 - search_range
26 struct tbl_rec tbls[1]; //tbl_rec entries. tbls_n items.
28 #define of_tbl ot_fnt_face
30 struct fixed_ver
32 uint16_t major;
33 uint16_t minor;
36 struct ttc_hdr_ver1
38 uint32_t ttc_tag; //TrueType Collection ID string: 'ttcf'
39 struct fixed_ver ver; //Version of the TTC Header (1.0), 0x00010000
40 uint32_t of_tbls_ofs[1];//Array of offsets to the OffsetTable for each
41 //font from the beginning of the file
44 struct ttc_hdr
46 union {
47 struct {
48 uint32_t ttc_tag; //TrueType Collection ID string: 'ttcf'
49 struct fixed_ver ver;//Version of the TTC Header (1.0 or 2.0),
50 //* 0x00010000 or 0x00020000 */
51 } hdr;
52 struct ttc_hdr_ver1 ver1;
53 } u;
56 //OpenType with Postscript outlines
57 #define CFF_TAG HB_TAG('O','T','T','O')
58 //OpenType with TrueType outlines
59 #define TRUETYPE_TAG HB_TAG( 0 , 1 , 0 , 0 )
60 //TrueType Collection
61 #define TTC_TAG HB_TAG('t','t','c','f')
62 //Obsolete Apple TrueType
63 #define TRUE_TAG HB_TAG('t','r','u','e')
64 //Obsolete Apple Type1 font in SFNT container
65 #define TYP1_TAG HB_TAG('t','y','p','1')
67 struct ot_fnt_file
69 union {
70 uint32_t tag;
71 struct ot_fnt_face fnt_face;
72 struct ttc_hdr ttc_hdr;
73 } u;
76 struct ot_fnt_face *
77 ot_fnt_file_get_face(struct ot_fnt_file *ot_fnt_file, unsigned i);
79 struct tbl_rec *
80 ot_fnt_face_get_tbl_by_tag(struct ot_fnt_face *ot_fnt_face, hb_tag_t tag);
81 #endif