Imported Upstream version 2.3.1
[platform/upstream/harfbuzz.git] / src / hb-ot-face.hh
1 /*
2  * Copyright © 2007,2008,2009  Red Hat, Inc.
3  * Copyright © 2012,2013  Google, Inc.
4  *
5  *  This is part of HarfBuzz, a text shaping library.
6  *
7  * Permission is hereby granted, without written agreement and without
8  * license or royalty fees, to use, copy, modify, and distribute this
9  * software and its documentation for any purpose, provided that the
10  * above copyright notice and the following two paragraphs appear in
11  * all copies of this software.
12  *
13  * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
14  * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
15  * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
16  * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
17  * DAMAGE.
18  *
19  * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
20  * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
21  * FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
22  * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
23  * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
24  *
25  * Red Hat Author(s): Behdad Esfahbod
26  * Google Author(s): Behdad Esfahbod
27  */
28
29 #ifndef HB_OT_FACE_HH
30 #define HB_OT_FACE_HH
31
32 #include "hb.hh"
33
34 #include "hb-machinery.hh"
35
36
37 /*
38  * hb_ot_face_t
39  */
40
41 #define HB_OT_TABLES \
42     /* OpenType fundamentals. */ \
43     HB_OT_TABLE(OT, head) \
44     HB_OT_ACCELERATOR(OT, cmap) \
45     HB_OT_ACCELERATOR(OT, hmtx) \
46     HB_OT_ACCELERATOR(OT, vmtx) \
47     HB_OT_ACCELERATOR(OT, post) \
48     HB_OT_TABLE(OT, kern) \
49     HB_OT_ACCELERATOR(OT, glyf) \
50     HB_OT_ACCELERATOR(OT, cff1) \
51     HB_OT_ACCELERATOR(OT, cff2) \
52     HB_OT_TABLE(OT, VORG) \
53     HB_OT_ACCELERATOR(OT, name) \
54     HB_OT_TABLE(OT, OS2) \
55     HB_OT_TABLE(OT, STAT) \
56     /* OpenType shaping. */ \
57     HB_OT_ACCELERATOR(OT, GDEF) \
58     HB_OT_ACCELERATOR(OT, GSUB) \
59     HB_OT_ACCELERATOR(OT, GPOS) \
60     HB_OT_TABLE(OT, BASE) \
61     HB_OT_TABLE(OT, JSTF) \
62     /* AAT shaping. */ \
63     HB_OT_TABLE(AAT, mort) \
64     HB_OT_TABLE(AAT, morx) \
65     HB_OT_TABLE(AAT, kerx) \
66     HB_OT_TABLE(AAT, ankr) \
67     HB_OT_TABLE(AAT, trak) \
68     HB_OT_TABLE(AAT, lcar) \
69     HB_OT_TABLE(AAT, ltag) \
70     HB_OT_TABLE(AAT, feat) \
71     /* OpenType variations. */ \
72     HB_OT_TABLE(OT, fvar) \
73     HB_OT_TABLE(OT, avar) \
74     HB_OT_TABLE(OT, MVAR) \
75     /* OpenType math. */ \
76     HB_OT_TABLE(OT, MATH) \
77     /* OpenType color fonts. */ \
78     HB_OT_TABLE(OT, COLR) \
79     HB_OT_TABLE(OT, CPAL) \
80     HB_OT_ACCELERATOR(OT, CBDT) \
81     HB_OT_ACCELERATOR(OT, sbix) \
82     HB_OT_ACCELERATOR(OT, SVG) \
83     /* */
84
85 /* Declare tables. */
86 #define HB_OT_TABLE(Namespace, Type) namespace Namespace { struct Type; }
87 #define HB_OT_ACCELERATOR(Namespace, Type) HB_OT_TABLE (Namespace, Type##_accelerator_t)
88 HB_OT_TABLES
89 #undef HB_OT_ACCELERATOR
90 #undef HB_OT_TABLE
91
92 struct hb_ot_face_t
93 {
94   HB_INTERNAL void init0 (hb_face_t *face);
95   HB_INTERNAL void fini ();
96
97 #define HB_OT_TABLE_ORDER(Namespace, Type) \
98     HB_PASTE (ORDER_, HB_PASTE (Namespace, HB_PASTE (_, Type)))
99   enum order_t
100   {
101     ORDER_ZERO,
102 #define HB_OT_TABLE(Namespace, Type) HB_OT_TABLE_ORDER (Namespace, Type),
103 #define HB_OT_ACCELERATOR(Namespace, Type) HB_OT_TABLE (Namespace, Type)
104     HB_OT_TABLES
105 #undef HB_OT_ACCELERATOR
106 #undef HB_OT_TABLE
107   };
108
109   hb_face_t *face; /* MUST be JUST before the lazy loaders. */
110 #define HB_OT_TABLE(Namespace, Type) \
111   hb_table_lazy_loader_t<Namespace::Type, HB_OT_TABLE_ORDER (Namespace, Type)> Type;
112 #define HB_OT_ACCELERATOR(Namespace, Type) \
113   hb_face_lazy_loader_t<Namespace::Type##_accelerator_t, HB_OT_TABLE_ORDER (Namespace, Type)> Type;
114   HB_OT_TABLES
115 #undef HB_OT_ACCELERATOR
116 #undef HB_OT_TABLE
117 };
118
119
120 #endif /* HB_OT_FACE_HH */