Coverage Report

Created: 2025-11-24 06:44

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/harfbuzz/src/OT/Layout/GSUB/AlternateSubst.hh
Line
Count
Source
1
#ifndef OT_LAYOUT_GSUB_ALTERNATESUBST_HH
2
#define OT_LAYOUT_GSUB_ALTERNATESUBST_HH
3
4
#include "AlternateSubstFormat1.hh"
5
#include "Common.hh"
6
7
namespace OT {
8
namespace Layout {
9
namespace GSUB_impl {
10
11
struct AlternateSubst
12
{
13
  protected:
14
  union {
15
  struct { HBUINT16 v; }    format;         /* Format identifier */
16
  AlternateSubstFormat1_2<SmallTypes> format1;
17
#ifndef HB_NO_BEYOND_64K
18
  AlternateSubstFormat1_2<MediumTypes>  format2;
19
#endif
20
  } u;
21
  public:
22
23
  template <typename context_t, typename ...Ts>
24
  typename context_t::return_t dispatch (context_t *c, Ts&&... ds) const
25
955k
  {
26
955k
    if (unlikely (!c->may_dispatch (this, &u.format.v))) return c->no_dispatch_return_value ();
27
955k
    TRACE_DISPATCH (this, u.format.v);
28
955k
    switch (u.format.v) {
29
32.9k
    case 1: return_trace (c->dispatch (u.format1, std::forward<Ts> (ds)...));
30
0
#ifndef HB_NO_BEYOND_64K
31
24.4k
    case 2: return_trace (c->dispatch (u.format2, std::forward<Ts> (ds)...));
32
0
#endif
33
898k
    default:return_trace (c->default_return_value ());
34
955k
    }
35
955k
  }
OT::hb_intersects_context_t::return_t OT::Layout::GSUB_impl::AlternateSubst::dispatch<OT::hb_intersects_context_t>(OT::hb_intersects_context_t*) const
Line
Count
Source
25
201k
  {
26
201k
    if (unlikely (!c->may_dispatch (this, &u.format.v))) return c->no_dispatch_return_value ();
27
201k
    TRACE_DISPATCH (this, u.format.v);
28
201k
    switch (u.format.v) {
29
7.11k
    case 1: return_trace (c->dispatch (u.format1, std::forward<Ts> (ds)...));
30
0
#ifndef HB_NO_BEYOND_64K
31
3.36k
    case 2: return_trace (c->dispatch (u.format2, std::forward<Ts> (ds)...));
32
0
#endif
33
190k
    default:return_trace (c->default_return_value ());
34
201k
    }
35
201k
  }
hb_sanitize_context_t::return_t OT::Layout::GSUB_impl::AlternateSubst::dispatch<hb_sanitize_context_t>(hb_sanitize_context_t*) const
Line
Count
Source
25
134k
  {
26
134k
    if (unlikely (!c->may_dispatch (this, &u.format.v))) return c->no_dispatch_return_value ();
27
134k
    TRACE_DISPATCH (this, u.format.v);
28
134k
    switch (u.format.v) {
29
5.90k
    case 1: return_trace (c->dispatch (u.format1, std::forward<Ts> (ds)...));
30
0
#ifndef HB_NO_BEYOND_64K
31
3.39k
    case 2: return_trace (c->dispatch (u.format2, std::forward<Ts> (ds)...));
32
0
#endif
33
125k
    default:return_trace (c->default_return_value ());
34
134k
    }
35
134k
  }
OT::hb_have_non_1to1_context_t::return_t OT::Layout::GSUB_impl::AlternateSubst::dispatch<OT::hb_have_non_1to1_context_t>(OT::hb_have_non_1to1_context_t*) const
Line
Count
Source
25
11.2k
  {
26
11.2k
    if (unlikely (!c->may_dispatch (this, &u.format.v))) return c->no_dispatch_return_value ();
27
11.2k
    TRACE_DISPATCH (this, u.format.v);
28
11.2k
    switch (u.format.v) {
29
269
    case 1: return_trace (c->dispatch (u.format1, std::forward<Ts> (ds)...));
30
0
#ifndef HB_NO_BEYOND_64K
31
0
    case 2: return_trace (c->dispatch (u.format2, std::forward<Ts> (ds)...));
32
0
#endif
33
10.9k
    default:return_trace (c->default_return_value ());
34
11.2k
    }
35
11.2k
  }
Unexecuted instantiation: OT::hb_ot_apply_context_t::return_t OT::Layout::GSUB_impl::AlternateSubst::dispatch<OT::hb_ot_apply_context_t>(OT::hb_ot_apply_context_t*) const
OT::hb_closure_context_t::return_t OT::Layout::GSUB_impl::AlternateSubst::dispatch<OT::hb_closure_context_t>(OT::hb_closure_context_t*) const
Line
Count
Source
25
512k
  {
26
512k
    if (unlikely (!c->may_dispatch (this, &u.format.v))) return c->no_dispatch_return_value ();
27
512k
    TRACE_DISPATCH (this, u.format.v);
28
512k
    switch (u.format.v) {
29
13.1k
    case 1: return_trace (c->dispatch (u.format1, std::forward<Ts> (ds)...));
30
0
#ifndef HB_NO_BEYOND_64K
31
14.2k
    case 2: return_trace (c->dispatch (u.format2, std::forward<Ts> (ds)...));
32
0
#endif
33
485k
    default:return_trace (c->default_return_value ());
34
512k
    }
35
512k
  }
OT::hb_closure_lookups_context_t::return_t OT::Layout::GSUB_impl::AlternateSubst::dispatch<OT::hb_closure_lookups_context_t>(OT::hb_closure_lookups_context_t*) const
Line
Count
Source
25
91.3k
  {
26
91.3k
    if (unlikely (!c->may_dispatch (this, &u.format.v))) return c->no_dispatch_return_value ();
27
91.3k
    TRACE_DISPATCH (this, u.format.v);
28
91.3k
    switch (u.format.v) {
29
2.83k
    case 1: return_trace (c->dispatch (u.format1, std::forward<Ts> (ds)...));
30
0
#ifndef HB_NO_BEYOND_64K
31
2.03k
    case 2: return_trace (c->dispatch (u.format2, std::forward<Ts> (ds)...));
32
0
#endif
33
86.4k
    default:return_trace (c->default_return_value ());
34
91.3k
    }
35
91.3k
  }
Unexecuted instantiation: OT::hb_collect_glyphs_context_t::return_t OT::Layout::GSUB_impl::AlternateSubst::dispatch<OT::hb_collect_glyphs_context_t>(OT::hb_collect_glyphs_context_t*) const
Unexecuted instantiation: OT::hb_would_apply_context_t::return_t OT::Layout::GSUB_impl::AlternateSubst::dispatch<OT::hb_would_apply_context_t>(OT::hb_would_apply_context_t*) const
hb_subset_context_t::return_t OT::Layout::GSUB_impl::AlternateSubst::dispatch<hb_subset_context_t>(hb_subset_context_t*) const
Line
Count
Source
25
4.97k
  {
26
4.97k
    if (unlikely (!c->may_dispatch (this, &u.format.v))) return c->no_dispatch_return_value ();
27
4.97k
    TRACE_DISPATCH (this, u.format.v);
28
4.97k
    switch (u.format.v) {
29
3.64k
    case 1: return_trace (c->dispatch (u.format1, std::forward<Ts> (ds)...));
30
0
#ifndef HB_NO_BEYOND_64K
31
1.33k
    case 2: return_trace (c->dispatch (u.format2, std::forward<Ts> (ds)...));
32
0
#endif
33
0
    default:return_trace (c->default_return_value ());
34
4.97k
    }
35
4.97k
  }
Unexecuted instantiation: OT::hb_accelerate_subtables_context_t::return_t OT::Layout::GSUB_impl::AlternateSubst::dispatch<OT::hb_accelerate_subtables_context_t>(OT::hb_accelerate_subtables_context_t*) const
Unexecuted instantiation: hb_get_glyph_alternates_dispatch_t::return_t OT::Layout::GSUB_impl::AlternateSubst::dispatch<hb_get_glyph_alternates_dispatch_t, unsigned int&, unsigned int&, unsigned int*&, unsigned int*&>(hb_get_glyph_alternates_dispatch_t*, unsigned int&, unsigned int&, unsigned int*&, unsigned int*&) const
Unexecuted instantiation: hb_collect_glyph_alternates_dispatch_t::return_t OT::Layout::GSUB_impl::AlternateSubst::dispatch<hb_collect_glyph_alternates_dispatch_t, hb_map_t*&, hb_map_t*&>(hb_collect_glyph_alternates_dispatch_t*, hb_map_t*&, hb_map_t*&) const
36
37
  /* TODO This function is unused and not updated to 24bit GIDs. Should be done by using
38
   * iterators. While at it perhaps using iterator of arrays of hb_codepoint_t instead. */
39
  bool serialize (hb_serialize_context_t *c,
40
                  hb_sorted_array_t<const HBGlyphID16> glyphs,
41
                  hb_array_t<const unsigned int> alternate_len_list,
42
                  hb_array_t<const HBGlyphID16> alternate_glyphs_list)
43
0
  {
44
0
    TRACE_SERIALIZE (this);
45
0
    if (unlikely (!c->extend_min (u.format.v))) return_trace (false);
46
0
    unsigned int format = 1;
47
0
    u.format.v = format;
48
0
    switch (u.format.v) {
49
0
    case 1: return_trace (u.format1.serialize (c, glyphs, alternate_len_list, alternate_glyphs_list));
50
0
    default:return_trace (false);
51
0
    }
52
0
  }
53
54
  /* TODO subset() should choose format. */
55
56
};
57
58
}
59
}
60
}
61
62
#endif  /* OT_LAYOUT_GSUB_ALTERNATESUBST_HH */