Coverage Report

Created: 2025-08-29 06:20

/src/harfbuzz/src/OT/Layout/GSUB/LigatureSubst.hh
Line
Count
Source (jump to first uncovered line)
1
#ifndef OT_LAYOUT_GSUB_LIGATURESUBST_HH
2
#define OT_LAYOUT_GSUB_LIGATURESUBST_HH
3
4
#include "Common.hh"
5
#include "LigatureSubstFormat1.hh"
6
7
namespace OT {
8
namespace Layout {
9
namespace GSUB_impl {
10
11
struct LigatureSubst
12
{
13
  protected:
14
  union {
15
  HBUINT16        format;         /* Format identifier */
16
  LigatureSubstFormat1_2<SmallTypes>  format1;
17
#ifndef HB_NO_BEYOND_64K
18
  LigatureSubstFormat1_2<MediumTypes> format2;
19
#endif
20
  } u;
21
22
  public:
23
  template <typename context_t, typename ...Ts>
24
  typename context_t::return_t dispatch (context_t *c, Ts&&... ds) const
25
100
  {
26
100
    if (unlikely (!c->may_dispatch (this, &u.format))) return c->no_dispatch_return_value ();
27
100
    TRACE_DISPATCH (this, u.format);
28
100
    switch (u.format) {
29
100
    case 1: return_trace (c->dispatch (u.format1, std::forward<Ts> (ds)...));
30
#ifndef HB_NO_BEYOND_64K
31
    case 2: return_trace (c->dispatch (u.format2, std::forward<Ts> (ds)...));
32
#endif
33
0
    default:return_trace (c->default_return_value ());
34
100
    }
35
100
  }
Unexecuted instantiation: OT::hb_intersects_context_t::return_t OT::Layout::GSUB_impl::LigatureSubst::dispatch<OT::hb_intersects_context_t>(OT::hb_intersects_context_t*) const
hb_sanitize_context_t::return_t OT::Layout::GSUB_impl::LigatureSubst::dispatch<hb_sanitize_context_t>(hb_sanitize_context_t*) const
Line
Count
Source
25
90
  {
26
90
    if (unlikely (!c->may_dispatch (this, &u.format))) return c->no_dispatch_return_value ();
27
90
    TRACE_DISPATCH (this, u.format);
28
90
    switch (u.format) {
29
90
    case 1: return_trace (c->dispatch (u.format1, std::forward<Ts> (ds)...));
30
#ifndef HB_NO_BEYOND_64K
31
    case 2: return_trace (c->dispatch (u.format2, std::forward<Ts> (ds)...));
32
#endif
33
0
    default:return_trace (c->default_return_value ());
34
90
    }
35
90
  }
Unexecuted instantiation: OT::hb_have_non_1to1_context_t::return_t OT::Layout::GSUB_impl::LigatureSubst::dispatch<OT::hb_have_non_1to1_context_t>(OT::hb_have_non_1to1_context_t*) const
Unexecuted instantiation: OT::hb_ot_apply_context_t::return_t OT::Layout::GSUB_impl::LigatureSubst::dispatch<OT::hb_ot_apply_context_t>(OT::hb_ot_apply_context_t*) const
Unexecuted instantiation: OT::hb_closure_context_t::return_t OT::Layout::GSUB_impl::LigatureSubst::dispatch<OT::hb_closure_context_t>(OT::hb_closure_context_t*) const
Unexecuted instantiation: OT::hb_closure_lookups_context_t::return_t OT::Layout::GSUB_impl::LigatureSubst::dispatch<OT::hb_closure_lookups_context_t>(OT::hb_closure_lookups_context_t*) const
Unexecuted instantiation: OT::hb_collect_glyphs_context_t::return_t OT::Layout::GSUB_impl::LigatureSubst::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::LigatureSubst::dispatch<OT::hb_would_apply_context_t>(OT::hb_would_apply_context_t*) const
Unexecuted instantiation: hb_subset_context_t::return_t OT::Layout::GSUB_impl::LigatureSubst::dispatch<hb_subset_context_t>(hb_subset_context_t*) const
OT::hb_accelerate_subtables_context_t::return_t OT::Layout::GSUB_impl::LigatureSubst::dispatch<OT::hb_accelerate_subtables_context_t>(OT::hb_accelerate_subtables_context_t*) const
Line
Count
Source
25
10
  {
26
10
    if (unlikely (!c->may_dispatch (this, &u.format))) return c->no_dispatch_return_value ();
27
10
    TRACE_DISPATCH (this, u.format);
28
10
    switch (u.format) {
29
10
    case 1: return_trace (c->dispatch (u.format1, std::forward<Ts> (ds)...));
30
#ifndef HB_NO_BEYOND_64K
31
    case 2: return_trace (c->dispatch (u.format2, std::forward<Ts> (ds)...));
32
#endif
33
0
    default:return_trace (c->default_return_value ());
34
10
    }
35
10
  }
Unexecuted instantiation: hb_get_glyph_alternates_dispatch_t::return_t OT::Layout::GSUB_impl::LigatureSubst::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
36
37
  /* TODO This function is only used by small GIDs, and not updated to 24bit GIDs. Should
38
   * be done by using iterators. While at it perhaps using iterator of arrays of hb_codepoint_t
39
   * instead. */
40
  bool serialize (hb_serialize_context_t *c,
41
                  hb_sorted_array_t<const HBGlyphID16> first_glyphs,
42
                  hb_array_t<const unsigned int> ligature_per_first_glyph_count_list,
43
                  hb_array_t<const HBGlyphID16> ligatures_list,
44
                  hb_array_t<const unsigned int> component_count_list,
45
                  hb_array_t<const HBGlyphID16> component_list /* Starting from second for each ligature */)
46
0
  {
47
0
    TRACE_SERIALIZE (this);
48
0
    if (unlikely (!c->extend_min (u.format))) return_trace (false);
49
0
    unsigned int format = 1;
50
0
    u.format = format;
51
0
    switch (u.format) {
52
0
    case 1: return_trace (u.format1.serialize (c,
53
0
                                               first_glyphs,
54
0
                                               ligature_per_first_glyph_count_list,
55
0
                                               ligatures_list,
56
0
                                               component_count_list,
57
0
                                               component_list));
58
0
    default:return_trace (false);
59
0
    }
60
0
  }
61
62
  /* TODO subset() should choose format. */
63
64
};
65
66
67
}
68
}
69
}
70
71
#endif  /* OT_LAYOUT_GSUB_LIGATURESUBST_HH */