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 | #define hb_ot_face_data(face) ((hb_ot_face_data_t *) face->shaper_data.ot.get_relaxed ()) |
38 | |
39 | |
40 | /* |
41 | * hb_ot_face_data_t |
42 | */ |
43 | |
44 | /* Most of these tables are NOT needed for shaping. But we need to hook them *somewhere*. |
45 | * This is as good as any place. */ |
46 | #define HB_OT_LAYOUT_TABLES \ |
47 | /* OpenType shaping. */ \ |
48 | HB_OT_LAYOUT_TABLE(OT, JSTF) \ |
49 | HB_OT_LAYOUT_TABLE(OT, BASE) \ |
50 | /* AAT shaping. */ \ |
51 | HB_OT_LAYOUT_TABLE(AAT, morx) \ |
52 | HB_OT_LAYOUT_TABLE(AAT, kerx) \ |
53 | HB_OT_LAYOUT_TABLE(AAT, ankr) \ |
54 | HB_OT_LAYOUT_TABLE(AAT, trak) \ |
55 | /* OpenType variations. */ \ |
56 | HB_OT_LAYOUT_TABLE(OT, fvar) \ |
57 | HB_OT_LAYOUT_TABLE(OT, avar) \ |
58 | HB_OT_LAYOUT_TABLE(OT, MVAR) \ |
59 | /* OpenType math. */ \ |
60 | HB_OT_LAYOUT_TABLE(OT, MATH) \ |
61 | /* OpenType fundamentals. */ \ |
62 | HB_OT_LAYOUT_ACCELERATOR(OT, GDEF) \ |
63 | HB_OT_LAYOUT_ACCELERATOR(OT, GSUB) \ |
64 | HB_OT_LAYOUT_ACCELERATOR(OT, GPOS) \ |
65 | HB_OT_LAYOUT_ACCELERATOR(OT, cmap) \ |
66 | HB_OT_LAYOUT_ACCELERATOR(OT, hmtx) \ |
67 | HB_OT_LAYOUT_ACCELERATOR(OT, vmtx) \ |
68 | HB_OT_LAYOUT_ACCELERATOR(OT, post) \ |
69 | HB_OT_LAYOUT_ACCELERATOR(OT, kern) \ |
70 | HB_OT_LAYOUT_ACCELERATOR(OT, glyf) \ |
71 | HB_OT_LAYOUT_ACCELERATOR(OT, CBDT) \ |
72 | /* */ |
73 | |
74 | /* Declare tables. */ |
75 | #define HB_OT_LAYOUT_TABLE(Namespace, Type) namespace Namespace { struct Type; } |
76 | #define HB_OT_LAYOUT_ACCELERATOR(Namespace, Type) HB_OT_LAYOUT_TABLE (Namespace, Type##_accelerator_t) |
77 | HB_OT_LAYOUT_TABLES |
78 | #undef HB_OT_LAYOUT_ACCELERATOR |
79 | #undef HB_OT_LAYOUT_TABLE |
80 | |
81 | struct hb_ot_face_data_t |
82 | { |
83 | HB_INTERNAL void init0 (hb_face_t *face); |
84 | HB_INTERNAL void fini (void); |
85 | |
86 | #define HB_OT_LAYOUT_TABLE_ORDER(Namespace, Type) \ |
87 | HB_PASTE (ORDER_, HB_PASTE (Namespace, HB_PASTE (_, Type))) |
88 | enum order_t |
89 | { |
90 | ORDER_ZERO, |
91 | #define HB_OT_LAYOUT_TABLE(Namespace, Type) HB_OT_LAYOUT_TABLE_ORDER (Namespace, Type), |
92 | #define HB_OT_LAYOUT_ACCELERATOR(Namespace, Type) HB_OT_LAYOUT_TABLE (Namespace, Type) |
93 | HB_OT_LAYOUT_TABLES |
94 | #undef HB_OT_LAYOUT_ACCELERATOR |
95 | #undef HB_OT_LAYOUT_TABLE |
96 | }; |
97 | |
98 | hb_face_t *face; /* MUST be JUST before the lazy loaders. */ |
99 | #define HB_OT_LAYOUT_TABLE(Namespace, Type) \ |
100 | hb_table_lazy_loader_t<Namespace::Type, HB_OT_LAYOUT_TABLE_ORDER (Namespace, Type)> Type; |
101 | #define HB_OT_LAYOUT_ACCELERATOR(Namespace, Type) \ |
102 | hb_face_lazy_loader_t<Namespace::Type##_accelerator_t, HB_OT_LAYOUT_TABLE_ORDER (Namespace, Type)> Type; |
103 | HB_OT_LAYOUT_TABLES |
104 | #undef HB_OT_LAYOUT_ACCELERATOR |
105 | #undef HB_OT_LAYOUT_TABLE |
106 | }; |
107 | |
108 | |
109 | HB_INTERNAL hb_ot_face_data_t * |
110 | _hb_ot_face_data_create (hb_face_t *face); |
111 | |
112 | HB_INTERNAL void |
113 | _hb_ot_face_data_destroy (hb_ot_face_data_t *data); |
114 | |
115 | |
116 | #endif /* HB_OT_FACE_HH */ |
117 | |