/src/harfbuzz/src/hb-ot-layout-gsub-table.hh
Line | Count | Source (jump to first uncovered line) |
1 | | /* |
2 | | * Copyright © 2007,2008,2009,2010 Red Hat, Inc. |
3 | | * Copyright © 2010,2012,2013 Google, Inc. |
4 | | * |
5 | | * This is part of HarfBuzz, a text shaping library. |
6 | | * |
7 | | * Permission is hereby granted, without written agreement and without |
8 | | * license or royalty fees, to use, copy, modify, and distribute this |
9 | | * software and its documentation for any purpose, provided that the |
10 | | * above copyright notice and the following two paragraphs appear in |
11 | | * all copies of this software. |
12 | | * |
13 | | * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR |
14 | | * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES |
15 | | * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN |
16 | | * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH |
17 | | * DAMAGE. |
18 | | * |
19 | | * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, |
20 | | * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND |
21 | | * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS |
22 | | * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO |
23 | | * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. |
24 | | * |
25 | | * Red Hat Author(s): Behdad Esfahbod |
26 | | * Google Author(s): Behdad Esfahbod |
27 | | */ |
28 | | |
29 | | #ifndef HB_OT_LAYOUT_GSUB_TABLE_HH |
30 | | #define HB_OT_LAYOUT_GSUB_TABLE_HH |
31 | | |
32 | | #include "OT/Layout/GSUB/GSUB.hh" |
33 | | |
34 | | namespace OT { |
35 | | namespace Layout { |
36 | | namespace GSUB_impl { |
37 | | |
38 | | // TODO(garretrieger): Move into the new layout directory. |
39 | | /* Out-of-class implementation for methods recursing */ |
40 | | |
41 | | #ifndef HB_NO_OT_LAYOUT |
42 | | /*static*/ inline bool ExtensionSubst::is_reverse () const |
43 | 0 | { |
44 | 0 | return SubstLookup::lookup_type_is_reverse (get_type ()); |
45 | 0 | } |
46 | | template <typename context_t> |
47 | | /*static*/ typename context_t::return_t SubstLookup::dispatch_recurse_func (context_t *c, unsigned int lookup_index) |
48 | 0 | { |
49 | 0 | const SubstLookup &l = c->face->table.GSUB.get_relaxed ()->table->get_lookup (lookup_index); |
50 | 0 | return l.dispatch (c); |
51 | 0 | } |
52 | | |
53 | | /*static*/ typename hb_closure_context_t::return_t SubstLookup::closure_glyphs_recurse_func (hb_closure_context_t *c, unsigned lookup_index, hb_set_t *covered_seq_indices, unsigned seq_index, unsigned end_index) |
54 | 0 | { |
55 | 0 | const SubstLookup &l = c->face->table.GSUB.get_relaxed ()->table->get_lookup (lookup_index); |
56 | 0 | if (l.may_have_non_1to1 ()) |
57 | 0 | hb_set_add_range (covered_seq_indices, seq_index, end_index); |
58 | 0 | return l.dispatch (c); |
59 | 0 | } |
60 | | |
61 | | template <> |
62 | | inline hb_closure_lookups_context_t::return_t |
63 | | SubstLookup::dispatch_recurse_func<hb_closure_lookups_context_t> (hb_closure_lookups_context_t *c, unsigned this_index) |
64 | 0 | { |
65 | 0 | const SubstLookup &l = c->face->table.GSUB.get_relaxed ()->table->get_lookup (this_index); |
66 | 0 | return l.closure_lookups (c, this_index); |
67 | 0 | } |
68 | | |
69 | | template <> |
70 | | inline bool SubstLookup::dispatch_recurse_func<hb_ot_apply_context_t> (hb_ot_apply_context_t *c, unsigned int lookup_index) |
71 | 0 | { |
72 | 0 | auto *gsub = c->face->table.GSUB.get_relaxed (); |
73 | 0 | const SubstLookup &l = gsub->table->get_lookup (lookup_index); |
74 | 0 | unsigned int saved_lookup_props = c->lookup_props; |
75 | 0 | unsigned int saved_lookup_index = c->lookup_index; |
76 | 0 | c->set_lookup_index (lookup_index); |
77 | 0 | c->set_lookup_props (l.get_props ()); |
78 | |
|
79 | 0 | bool ret = false; |
80 | 0 | auto *accel = gsub->get_accel (lookup_index); |
81 | 0 | ret = accel && accel->apply (c, l.get_subtable_count (), false); |
82 | |
|
83 | 0 | c->set_lookup_index (saved_lookup_index); |
84 | 0 | c->set_lookup_props (saved_lookup_props); |
85 | 0 | return ret; |
86 | 0 | } |
87 | | #endif |
88 | | |
89 | | } /* namespace GSUB_impl */ |
90 | | } /* namespace Layout */ |
91 | | } /* namespace OT */ |
92 | | |
93 | | |
94 | | #endif /* HB_OT_LAYOUT_GSUB_TABLE_HH */ |