/work/workdir/UnpackedTarball/harfbuzz/src/hb-ot-layout-gpos-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_GPOS_TABLE_HH |
30 | | #define HB_OT_LAYOUT_GPOS_TABLE_HH |
31 | | |
32 | | #include "OT/Layout/GPOS/GPOS.hh" |
33 | | |
34 | | namespace OT { |
35 | | namespace Layout { |
36 | | namespace GPOS_impl { |
37 | | |
38 | | // TODO(garretrieger): Move into new layout directory. |
39 | | /* Out-of-class implementation for methods recursing */ |
40 | | #ifndef HB_NO_OT_LAYOUT |
41 | | template <typename context_t> |
42 | | /*static*/ typename context_t::return_t PosLookup::dispatch_recurse_func (context_t *c, unsigned int lookup_index) |
43 | | { |
44 | | const PosLookup &l = c->face->table.GPOS.get_relaxed ()->table->get_lookup (lookup_index); |
45 | | return l.dispatch (c); |
46 | | } |
47 | | |
48 | | template <> |
49 | | inline hb_closure_lookups_context_t::return_t |
50 | | PosLookup::dispatch_recurse_func<hb_closure_lookups_context_t> (hb_closure_lookups_context_t *c, unsigned this_index) |
51 | 0 | { |
52 | 0 | const PosLookup &l = c->face->table.GPOS.get_relaxed ()->table->get_lookup (this_index); |
53 | 0 | return l.closure_lookups (c, this_index); |
54 | 0 | } |
55 | | |
56 | | template <> |
57 | | inline bool PosLookup::dispatch_recurse_func<hb_ot_apply_context_t> (hb_ot_apply_context_t *c, unsigned int lookup_index) |
58 | 2.55k | { |
59 | 2.55k | auto *gpos = c->face->table.GPOS.get_relaxed (); |
60 | 2.55k | const PosLookup &l = gpos->table->get_lookup (lookup_index); |
61 | 2.55k | unsigned int saved_lookup_props = c->lookup_props; |
62 | 2.55k | unsigned int saved_lookup_index = c->lookup_index; |
63 | 2.55k | c->set_lookup_index (lookup_index); |
64 | 2.55k | c->set_lookup_props (l.get_props ()); |
65 | | |
66 | 2.55k | bool ret = false; |
67 | 2.55k | auto *accel = gpos->get_accel (lookup_index); |
68 | 2.55k | ret = accel && accel->apply (c, l.get_subtable_count (), false); |
69 | | |
70 | 2.55k | c->set_lookup_index (saved_lookup_index); |
71 | 2.55k | c->set_lookup_props (saved_lookup_props); |
72 | 2.55k | return ret; |
73 | 2.55k | } |
74 | | #endif |
75 | | |
76 | | } /* namespace GPOS_impl */ |
77 | | } /* namespace Layout */ |
78 | | } /* namespace OT */ |
79 | | |
80 | | |
81 | | #endif /* HB_OT_LAYOUT_GPOS_TABLE_HH */ |