blob: 5ac3538e44dd27590239b41cbdc824b66ea3046d [file] [log] [blame]
Behdad Esfahbodd9500222018-08-25 23:06:37 -07001/*
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"
Behdad Esfahbodd9500222018-08-25 23:06:37 -070035
Behdad Esfahbodb9291002018-08-26 01:15:47 -070036
37#define hb_ot_face_data(face) ((hb_ot_face_data_t *) face->shaper_data.ot.get_relaxed ())
38
39
Behdad Esfahbodd9500222018-08-25 23:06:37 -070040/*
41 * hb_ot_face_data_t
42 */
43
Behdad Esfahbodd9500222018-08-25 23:06:37 -070044/* 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. */ \
Behdad Esfahbodd9500222018-08-25 23:06:37 -070048 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) \
Behdad Esfahbodd9500222018-08-25 23:06:37 -070059 /* OpenType math. */ \
60 HB_OT_LAYOUT_TABLE(OT, MATH) \
61 /* OpenType fundamentals. */ \
Behdad Esfahbod4096fbe2018-08-26 01:25:54 -070062 HB_OT_LAYOUT_ACCELERATOR(OT, GDEF) \
Behdad Esfahbodb9291002018-08-26 01:15:47 -070063 HB_OT_LAYOUT_ACCELERATOR(OT, GSUB) \
64 HB_OT_LAYOUT_ACCELERATOR(OT, GPOS) \
Behdad Esfahbode6cb9382018-08-26 00:21:29 -070065 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) \
Behdad Esfahbodd9500222018-08-25 23:06:37 -070072 /* */
73
74/* Declare tables. */
75#define HB_OT_LAYOUT_TABLE(Namespace, Type) namespace Namespace { struct Type; }
Behdad Esfahbod3a0b3a22018-08-26 15:11:24 -070076#define HB_OT_LAYOUT_ACCELERATOR(Namespace, Type) HB_OT_LAYOUT_TABLE (Namespace, Type##_accelerator_t)
Behdad Esfahbodd9500222018-08-25 23:06:37 -070077HB_OT_LAYOUT_TABLES
Behdad Esfahbode6cb9382018-08-26 00:21:29 -070078#undef HB_OT_LAYOUT_ACCELERATOR
Behdad Esfahbodd9500222018-08-25 23:06:37 -070079#undef HB_OT_LAYOUT_TABLE
80
81struct hb_ot_face_data_t
82{
Behdad Esfahboda2680682018-08-26 15:18:46 -070083 HB_INTERNAL void init0 (hb_face_t *face);
84 HB_INTERNAL void fini (void);
Behdad Esfahbodd9500222018-08-25 23:06:37 -070085
86#define HB_OT_LAYOUT_TABLE_ORDER(Namespace, Type) \
Behdad Esfahboda2680682018-08-26 15:18:46 -070087 HB_PASTE (ORDER_, HB_PASTE (Namespace, HB_PASTE (_, Type)))
88 enum order_t
89 {
90 ORDER_ZERO,
Behdad Esfahbode6cb9382018-08-26 00:21:29 -070091#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)
Behdad Esfahbodd9500222018-08-25 23:06:37 -070093 HB_OT_LAYOUT_TABLES
Behdad Esfahbode6cb9382018-08-26 00:21:29 -070094#undef HB_OT_LAYOUT_ACCELERATOR
Behdad Esfahbodd9500222018-08-25 23:06:37 -070095#undef HB_OT_LAYOUT_TABLE
Behdad Esfahboda2680682018-08-26 15:18:46 -070096 };
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
Behdad Esfahbodd9500222018-08-25 23:06:37 -0700106};
107
108
109HB_INTERNAL hb_ot_face_data_t *
110_hb_ot_face_data_create (hb_face_t *face);
111
112HB_INTERNAL void
113_hb_ot_face_data_destroy (hb_ot_face_data_t *data);
114
115
Behdad Esfahbodd9500222018-08-25 23:06:37 -0700116#endif /* HB_OT_FACE_HH */