1/*
2 * Copyright © 2018 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.hh"
28
29#include "hb-open-type.hh"
30#include "hb-ot-layout-common.hh"
31
32#include "hb-face.hh"
33#include "hb-ot-head-table.hh"
34#include "hb-ot-maxp-table.hh"
35
36#ifndef HB_NO_VISIBILITY
37
38hb_vector_size_impl_t const _hb_NullPool[(HB_NULL_POOL_SIZE + sizeof (hb_vector_size_impl_t) - 1) / sizeof (hb_vector_size_impl_t)] = {};
39/*thread_local*/ hb_vector_size_impl_t _hb_CrapPool[(HB_NULL_POOL_SIZE + sizeof (hb_vector_size_impl_t) - 1) / sizeof (hb_vector_size_impl_t)] = {};
40
41DEFINE_NULL_NAMESPACE_BYTES (OT, Index) = {0xFF,0xFF};
42DEFINE_NULL_NAMESPACE_BYTES (OT, LangSys) = {0x00,0x00, 0xFF,0xFF, 0x00,0x00};
43DEFINE_NULL_NAMESPACE_BYTES (OT, RangeRecord) = {0x00,0x01, 0x00,0x00, 0x00, 0x00};
44
45
46void
47hb_face_t::load_num_glyphs (void) const
48{
49 hb_sanitize_context_t c = hb_sanitize_context_t ();
50 c.set_num_glyphs (0); /* So we don't recurse ad infinitum. */
51 hb_blob_t *maxp_blob = c.reference_table<OT::maxp> (this);
52 const OT::maxp *maxp_table = maxp_blob->as<OT::maxp> ();
53 num_glyphs = maxp_table->get_num_glyphs ();
54 hb_blob_destroy (maxp_blob);
55}
56
57void
58hb_face_t::load_upem (void) const
59{
60 hb_blob_t *head_blob = hb_sanitize_context_t ().reference_table<OT::head> (this);
61 const OT::head *head_table = head_blob->as<OT::head> ();
62 upem = head_table->get_upem ();
63 hb_blob_destroy (head_blob);
64}
65
66#endif
67