Coverage Report

Created: 2026-04-09 11:41

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/work/workdir/UnpackedTarball/harfbuzz/src/hb-static.cc
Line
Count
Source
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
#ifndef HB_STATIC_CC
28
#define HB_STATIC_CC
29
#ifdef HB_STATIC_CC /* Pacify -Wunused-macros. */
30
31
#include "hb.hh"
32
33
#include "hb-open-type.hh"
34
#include "hb-face.hh"
35
36
#include "hb-aat-layout-common.hh"
37
#include "hb-aat-layout-feat-table.hh"
38
#include "hb-cff-interp-common.hh"
39
#include "hb-ot-layout-common.hh"
40
#include "hb-ot-cmap-table.hh"
41
#include "OT/Color/COLR/COLR.hh"
42
#include "hb-ot-glyf-table.hh"
43
#include "hb-ot-head-table.hh"
44
#include "hb-ot-hmtx-table.hh"
45
#include "hb-ot-maxp-table.hh"
46
47
#ifndef HB_NO_VISIBILITY
48
49
#include "hb-ot-name-language-static.hh"
50
51
uint64_t const _hb_NullPool[(HB_NULL_POOL_SIZE + sizeof (uint64_t) - 1) / sizeof (uint64_t)] = {};
52
/*thread_local*/ uint64_t _hb_CrapPool[(HB_NULL_POOL_SIZE + sizeof (uint64_t) - 1) / sizeof (uint64_t)] = {};
53
54
DEFINE_NULL_NAMESPACE_BYTES (OT, Index) =  {0xFF,0xFF};
55
DEFINE_NULL_NAMESPACE_BYTES (OT, VarIdx) =  {0xFF,0xFF,0xFF,0xFF};
56
DEFINE_NULL_NAMESPACE_BYTES (OT, LangSys) = {0x00,0x00, 0xFF,0xFF, 0x00,0x00};
57
DEFINE_NULL_NAMESPACE_BYTES (OT, RangeRecord) = {0x01};
58
DEFINE_NULL_NAMESPACE_BYTES (OT, ClipRecord) = {0x01};
59
DEFINE_NULL_NAMESPACE_BYTES (OT, CmapSubtableLongGroup) = {0x00,0x00,0x00,0x01, 0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00};
60
DEFINE_NULL_NAMESPACE_BYTES (AAT, SettingName) = {0xFF,0xFF, 0xFF,0xFF};
61
DEFINE_NULL_NAMESPACE_BYTES (AAT, Lookup) = {0xFF,0xFF};
62
63
64
/* hb_map_t */
65
66
const hb_codepoint_t minus_1 = -1;
67
static const unsigned char static_endchar_str[] = {OpCode_endchar};
68
const unsigned char *endchar_str = static_endchar_str;
69
70
/* hb_face_t */
71
72
#ifndef HB_NO_BEYOND_64K
73
static inline unsigned
74
load_num_glyphs_from_loca (const hb_face_t *face)
75
{
76
  unsigned ret = 0;
77
78
  unsigned indexToLocFormat = face->table.head->indexToLocFormat;
79
80
  if (indexToLocFormat <= 1)
81
  {
82
    bool short_offset = 0 == indexToLocFormat;
83
    hb_blob_t *loca_blob = face->table.loca.get_blob ();
84
    ret = hb_max (1u, loca_blob->length / (short_offset ? 2 : 4)) - 1;
85
  }
86
87
  return ret;
88
}
89
#endif
90
91
static inline unsigned
92
load_num_glyphs_from_maxp (const hb_face_t *face)
93
298
{
94
298
  return face->table.maxp->get_num_glyphs ();
95
298
}
96
97
unsigned int
98
hb_face_t::load_num_glyphs () const
99
298
{
100
298
  unsigned ret = 0;
101
102
#ifndef HB_NO_BEYOND_64K
103
  ret = hb_max (ret, load_num_glyphs_from_loca (this));
104
#endif
105
106
298
  ret = hb_max (ret, load_num_glyphs_from_maxp (this));
107
108
298
  num_glyphs = ret;
109
298
  return ret;
110
298
}
111
112
unsigned int
113
hb_face_t::load_upem () const
114
6.31k
{
115
6.31k
  unsigned int ret = table.head->get_upem ();
116
6.31k
  upem = ret;
117
6.31k
  return ret;
118
6.31k
}
119
120
#endif
121
122
#endif /* HB_STATIC_CC pacify */
123
#endif /* HB_STATIC_CC guard */