1/*
2 * Copyright © 2017 Google, Inc.
3 *
4 * This is part of HarfBuzz, a text shaping library.
5 *
6 * Permission is hereby granted, without written agreement and without
7 * license or royalty fees, to use, copy, modify, and distribute this
8 * software and its documentation for any purpose, provided that the
9 * above copyright notice and the following two paragraphs appear in
10 * all copies of this software.
11 *
12 * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
13 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
14 * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
15 * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
16 * DAMAGE.
17 *
18 * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
19 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
20 * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
21 * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
22 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
23 *
24 * Google Author(s): Behdad Esfahbod
25 */
26
27#include "hb-open-type.hh"
28
29#include "hb-ot-face.hh"
30#include "hb-aat-layout.hh"
31#include "hb-aat-layout-ankr-table.hh"
32#include "hb-aat-layout-bsln-table.hh" // Just so we compile it; unused otherwise.
33#include "hb-aat-layout-feat-table.hh" // Just so we compile it; unused otherwise.
34#include "hb-aat-layout-kerx-table.hh"
35#include "hb-aat-layout-morx-table.hh"
36#include "hb-aat-layout-trak-table.hh"
37#include "hb-aat-ltag-table.hh" // Just so we compile it; unused otherwise.
38
39/*
40 * morx/kerx/trak/ankr
41 */
42
43static inline const AAT::morx&
44_get_morx (hb_face_t *face, hb_blob_t **blob = nullptr)
45{
46 if (unlikely (!hb_ot_shaper_face_data_ensure (face)))
47 {
48 if (blob)
49 *blob = hb_blob_get_empty ();
50 return Null(AAT::morx);
51 }
52 const AAT::morx& morx = *(hb_ot_face_data (face)->morx.get ());
53 if (blob)
54 *blob = hb_ot_face_data (face)->morx.get_blob ();
55 return morx;
56}
57
58void
59hb_aat_layout_substitute (hb_font_t *font, hb_buffer_t *buffer)
60{
61 hb_blob_t *blob;
62 const AAT::morx& morx = _get_morx (font->face, &blob);
63
64 AAT::hb_aat_apply_context_t c (font, buffer, blob);
65 morx.apply (&c);
66}
67
68void
69hb_aat_layout_position (hb_font_t *font, hb_buffer_t *buffer)
70{
71#if 0
72 hb_blob_t *blob;
73 const AAT::ankr& ankr = _get_ankr (font->face, &blob);
74 const AAT::kerx& kerx = _get_kerx (font->face, &blob);
75 const AAT::trak& trak = _get_trak (font->face, &blob);
76
77 AAT::hb_aat_apply_context_t c (font, buffer, blob);
78 kerx.apply (&c, &ankr);
79 trak.apply (&c);
80#endif
81}
82