blob: fd8109950ed59965def5577558c61b8b0b5026c0 [file] [log] [blame]
Behdad Esfahbod5a2b0b32010-10-08 20:14:57 -04001/*
Behdad Esfahbod2409d5f2011-04-21 17:14:28 -04002 * Copyright © 2009,2010 Red Hat, Inc.
Behdad Esfahbod06a44e82013-04-21 15:13:08 -04003 * Copyright © 2010,2011,2013 Google, Inc.
Behdad Esfahbod5a2b0b32010-10-08 20:14:57 -04004 *
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
Behdad Esfahbodc77ae402018-08-25 22:36:36 -070029#include "hb-ot-map.hh"
Behdad Esfahbod5a2b0b32010-10-08 20:14:57 -040030
Behdad Esfahbodc77ae402018-08-25 22:36:36 -070031#include "hb-ot-layout.hh"
Behdad Esfahbod2265be02013-05-02 14:25:09 -040032
Behdad Esfahbod5a2b0b32010-10-08 20:14:57 -040033
Behdad Esfahbod7ceadbe2016-09-10 02:44:20 -070034void hb_ot_map_t::collect_lookups (unsigned int table_index, hb_set_t *lookups_out) const
Behdad Esfahbodd2ba0162010-10-12 15:35:45 -040035{
Behdad Esfahbod7ceadbe2016-09-10 02:44:20 -070036 for (unsigned int i = 0; i < lookups[table_index].len; i++)
37 hb_set_add (lookups_out, lookups[table_index][i].index);
Behdad Esfahbodd2ba0162010-10-12 15:35:45 -040038}
39
Behdad Esfahbod7ceadbe2016-09-10 02:44:20 -070040
Behdad Esfahbod6fddf2d2012-11-12 17:57:24 -080041hb_ot_map_builder_t::hb_ot_map_builder_t (hb_face_t *face_,
42 const hb_segment_properties_t *props_)
43{
44 memset (this, 0, sizeof (*this));
45
Behdad Esfahbodf9abbf82018-06-02 15:30:59 -070046 feature_infos.init ();
47 for (unsigned int table_index = 0; table_index < 2; table_index++)
48 stages[table_index].init ();
49
Behdad Esfahbod6fddf2d2012-11-12 17:57:24 -080050 face = face_;
51 props = *props_;
52
53
54 /* Fetch script/language indices for GSUB/GPOS. We need these later to skip
55 * features not available in either table and not waste precious bits for them. */
56
David Corbett91067712017-12-08 11:21:14 -050057 unsigned int script_count = HB_OT_MAX_TAGS_PER_SCRIPT;
58 unsigned int language_count = HB_OT_MAX_TAGS_PER_LANGUAGE;
59 hb_tag_t script_tags[HB_OT_MAX_TAGS_PER_SCRIPT];
60 hb_tag_t language_tags[HB_OT_MAX_TAGS_PER_LANGUAGE];
Behdad Esfahbod6fddf2d2012-11-12 17:57:24 -080061
David Corbett7f1fbfe2018-07-23 21:19:23 -040062 hb_ot_tags_from_script_and_language (props.script, props.language, &script_count, script_tags, &language_count, language_tags);
Behdad Esfahbod6fddf2d2012-11-12 17:57:24 -080063
64 for (unsigned int table_index = 0; table_index < 2; table_index++) {
65 hb_tag_t table_tag = table_tags[table_index];
David Corbett91067712017-12-08 11:21:14 -050066 found_script[table_index] = (bool) hb_ot_layout_table_select_script (face, table_tag, script_count, script_tags, &script_index[table_index], &chosen_script[table_index]);
67 hb_ot_layout_script_select_language (face, table_tag, script_index[table_index], language_count, language_tags, &language_index[table_index]);
Behdad Esfahbod6fddf2d2012-11-12 17:57:24 -080068 }
69}
Behdad Esfahbodd2ba0162010-10-12 15:35:45 -040070
Behdad Esfahbodf9abbf82018-06-02 15:30:59 -070071hb_ot_map_builder_t::~hb_ot_map_builder_t (void)
72{
73 feature_infos.fini ();
74 for (unsigned int table_index = 0; table_index < 2; table_index++)
75 stages[table_index].fini ();
76}
77
Behdad Esfahbodf048ead2018-09-24 18:01:53 -040078void hb_ot_map_builder_t::add_feature (hb_tag_t tag,
79 hb_ot_map_feature_flags_t flags,
80 unsigned int value)
Behdad Esfahbod51881a62011-05-27 18:15:56 -040081{
Jonathan Kewda132932014-04-27 14:05:24 +010082 if (unlikely (!tag)) return;
Behdad Esfahbod8be0e5f2018-10-23 13:39:50 -070083 feature_info_t *info = feature_infos.push();
Behdad Esfahbod51881a62011-05-27 18:15:56 -040084 info->tag = tag;
85 info->seq = feature_infos.len;
86 info->max_value = value;
Behdad Esfahbodec544862013-02-14 11:25:10 -050087 info->flags = flags;
88 info->default_value = (flags & F_GLOBAL) ? value : 0;
Behdad Esfahbodb70c96d2011-07-07 21:07:41 -040089 info->stage[0] = current_stage[0];
90 info->stage[1] = current_stage[1];
91}
92
Behdad Esfahbod7ceadbe2016-09-10 02:44:20 -070093void
94hb_ot_map_builder_t::add_lookups (hb_ot_map_t &m,
Behdad Esfahbod7ceadbe2016-09-10 02:44:20 -070095 unsigned int table_index,
96 unsigned int feature_index,
Behdad Esfahbod72ada4f2016-09-10 03:57:24 -070097 unsigned int variations_index,
Behdad Esfahbod7ceadbe2016-09-10 02:44:20 -070098 hb_mask_t mask,
Behdad Esfahbodcdf1fd02017-07-14 12:43:34 +010099 bool auto_zwnj,
David Corbettc2a75e02018-01-25 14:22:03 -0500100 bool auto_zwj,
101 bool random)
Behdad Esfahbodd2984a22012-04-23 17:21:14 -0400102{
Behdad Esfahbod7ceadbe2016-09-10 02:44:20 -0700103 unsigned int lookup_indices[32];
104 unsigned int offset, len;
105 unsigned int table_lookup_count;
106
107 table_lookup_count = hb_ot_layout_table_get_lookup_count (face, table_tags[table_index]);
108
109 offset = 0;
110 do {
111 len = ARRAY_LENGTH (lookup_indices);
Behdad Esfahbod72ada4f2016-09-10 03:57:24 -0700112 hb_ot_layout_feature_with_variations_get_lookups (face,
113 table_tags[table_index],
114 feature_index,
115 variations_index,
116 offset, &len,
117 lookup_indices);
Behdad Esfahbod7ceadbe2016-09-10 02:44:20 -0700118
119 for (unsigned int i = 0; i < len; i++)
120 {
121 if (lookup_indices[i] >= table_lookup_count)
122 continue;
123 hb_ot_map_t::lookup_map_t *lookup = m.lookups[table_index].push ();
Behdad Esfahbod7ceadbe2016-09-10 02:44:20 -0700124 lookup->mask = mask;
125 lookup->index = lookup_indices[i];
Behdad Esfahbodcdf1fd02017-07-14 12:43:34 +0100126 lookup->auto_zwnj = auto_zwnj;
Behdad Esfahbod7ceadbe2016-09-10 02:44:20 -0700127 lookup->auto_zwj = auto_zwj;
David Corbettc2a75e02018-01-25 14:22:03 -0500128 lookup->random = random;
Behdad Esfahbod7ceadbe2016-09-10 02:44:20 -0700129 }
130
131 offset += len;
132 } while (len == ARRAY_LENGTH (lookup_indices));
Behdad Esfahbodd2984a22012-04-23 17:21:14 -0400133}
Behdad Esfahbodb70c96d2011-07-07 21:07:41 -0400134
Behdad Esfahbod7ceadbe2016-09-10 02:44:20 -0700135
Behdad Esfahbod3e38c0f2012-08-02 09:44:18 -0400136void hb_ot_map_builder_t::add_pause (unsigned int table_index, hb_ot_map_t::pause_func_t pause_func)
Behdad Esfahbodb70c96d2011-07-07 21:07:41 -0400137{
Behdad Esfahbod8ac3c9c2013-04-21 15:19:38 -0400138 stage_info_t *s = stages[table_index].push ();
Behdad Esfahbodf7515762018-06-01 17:48:37 -0700139 s->index = current_stage[table_index];
140 s->pause_func = pause_func;
Behdad Esfahbodb70c96d2011-07-07 21:07:41 -0400141
142 current_stage[table_index]++;
Behdad Esfahbod51881a62011-05-27 18:15:56 -0400143}
144
Behdad Esfahbodd2ba0162010-10-12 15:35:45 -0400145void
Behdad Esfahbod72ada4f2016-09-10 03:57:24 -0700146hb_ot_map_builder_t::compile (hb_ot_map_t &m,
147 const int *coords,
148 unsigned int num_coords)
Behdad Esfahbod5a2b0b32010-10-08 20:14:57 -0400149{
Behdad Esfahbod606bf572018-09-16 19:33:48 +0200150 static_assert ((!(HB_GLYPH_FLAG_DEFINED & (HB_GLYPH_FLAG_DEFINED + 1))), "");
Behdad Esfahbod5287ccc2017-08-10 14:25:53 -0700151 unsigned int global_bit_mask = HB_GLYPH_FLAG_DEFINED + 1;
Behdad Esfahbodbddeb2b2018-07-10 14:12:37 +0200152 unsigned int global_bit_shift = hb_popcount (HB_GLYPH_FLAG_DEFINED);
Behdad Esfahbod5287ccc2017-08-10 14:25:53 -0700153
154 m.global_mask = global_bit_mask;
Behdad Esfahbod6fddf2d2012-11-12 17:57:24 -0800155
Jonathan Kewda132932014-04-27 14:05:24 +0100156 unsigned int required_feature_index[2];
157 hb_tag_t required_feature_tag[2];
158 /* We default to applying required feature in stage 0. If the required
159 * feature has a tag that is known to the shaper, we apply required feature
160 * in the stage for that tag.
161 */
162 unsigned int required_feature_stage[2] = {0, 0};
163
164 for (unsigned int table_index = 0; table_index < 2; table_index++)
165 {
Behdad Esfahbod6fddf2d2012-11-12 17:57:24 -0800166 m.chosen_script[table_index] = chosen_script[table_index];
Behdad Esfahbod851784f2012-11-14 16:24:05 -0800167 m.found_script[table_index] = found_script[table_index];
Jonathan Kewda132932014-04-27 14:05:24 +0100168
169 hb_ot_layout_language_get_required_feature (face,
170 table_tags[table_index],
171 script_index[table_index],
172 language_index[table_index],
173 &required_feature_index[table_index],
174 &required_feature_tag[table_index]);
Behdad Esfahbod851784f2012-11-14 16:24:05 -0800175 }
Behdad Esfahbod5a2b0b32010-10-08 20:14:57 -0400176
Behdad Esfahbod5a2b0b32010-10-08 20:14:57 -0400177 /* Sort features and merge duplicates */
Behdad Esfahbodf33ad6d2018-10-23 14:31:51 -0700178 if (feature_infos.len)
Behdad Esfahbod31f18ab2011-06-15 09:49:58 -0400179 {
Behdad Esfahbodfb8cc862014-06-19 15:30:18 -0400180 feature_infos.qsort ();
Behdad Esfahbod31f18ab2011-06-15 09:49:58 -0400181 unsigned int j = 0;
182 for (unsigned int i = 1; i < feature_infos.len; i++)
183 if (feature_infos[i].tag != feature_infos[j].tag)
184 feature_infos[++j] = feature_infos[i];
Behdad Esfahbod5a2b0b32010-10-08 20:14:57 -0400185 else {
Behdad Esfahbodec544862013-02-14 11:25:10 -0500186 if (feature_infos[i].flags & F_GLOBAL) {
187 feature_infos[j].flags |= F_GLOBAL;
Behdad Esfahbodb70c96d2011-07-07 21:07:41 -0400188 feature_infos[j].max_value = feature_infos[i].max_value;
189 feature_infos[j].default_value = feature_infos[i].default_value;
190 } else {
Behdad Esfahbodec544862013-02-14 11:25:10 -0500191 feature_infos[j].flags &= ~F_GLOBAL;
Behdad Esfahbod31f18ab2011-06-15 09:49:58 -0400192 feature_infos[j].max_value = MAX (feature_infos[j].max_value, feature_infos[i].max_value);
Behdad Esfahbod398238a2013-02-15 07:40:10 -0500193 /* Inherit default_value from j */
Behdad Esfahbod31f18ab2011-06-15 09:49:58 -0400194 }
Behdad Esfahbodec544862013-02-14 11:25:10 -0500195 feature_infos[j].flags |= (feature_infos[i].flags & F_HAS_FALLBACK);
Behdad Esfahbodb70c96d2011-07-07 21:07:41 -0400196 feature_infos[j].stage[0] = MIN (feature_infos[j].stage[0], feature_infos[i].stage[0]);
197 feature_infos[j].stage[1] = MIN (feature_infos[j].stage[1], feature_infos[i].stage[1]);
Behdad Esfahbod5a2b0b32010-10-08 20:14:57 -0400198 }
Behdad Esfahbod31f18ab2011-06-15 09:49:58 -0400199 feature_infos.shrink (j + 1);
200 }
Behdad Esfahbod5a2b0b32010-10-08 20:14:57 -0400201
202
203 /* Allocate bits now */
Behdad Esfahbod5287ccc2017-08-10 14:25:53 -0700204 unsigned int next_bit = global_bit_shift + 1;
Behdad Esfahbod40bd7e92016-05-02 14:47:45 +0200205
Jonathan Kewda132932014-04-27 14:05:24 +0100206 for (unsigned int i = 0; i < feature_infos.len; i++)
207 {
Behdad Esfahbod5a2b0b32010-10-08 20:14:57 -0400208 const feature_info_t *info = &feature_infos[i];
209
210 unsigned int bits_needed;
211
Behdad Esfahbodec544862013-02-14 11:25:10 -0500212 if ((info->flags & F_GLOBAL) && info->max_value == 1)
Behdad Esfahbod5a2b0b32010-10-08 20:14:57 -0400213 /* Uses the global bit */
214 bits_needed = 0;
215 else
Behdad Esfahbod71c9f842018-09-10 22:37:19 +0200216 /* Limit bits per feature. */
217 bits_needed = MIN(HB_OT_MAP_MAX_BITS, hb_bit_storage (info->max_value));
Behdad Esfahbod5a2b0b32010-10-08 20:14:57 -0400218
Behdad Esfahbod852912f2010-10-13 15:34:50 -0400219 if (!info->max_value || next_bit + bits_needed > 8 * sizeof (hb_mask_t))
Behdad Esfahbod5a2b0b32010-10-08 20:14:57 -0400220 continue; /* Feature disabled, or not enough bits. */
221
222
Behdad Esfahbod176fd172013-10-30 17:27:24 +0000223 hb_bool_t found = false;
Behdad Esfahbod5a2b0b32010-10-08 20:14:57 -0400224 unsigned int feature_index[2];
225 for (unsigned int table_index = 0; table_index < 2; table_index++)
Jonathan Kewda132932014-04-27 14:05:24 +0100226 {
227 if (required_feature_tag[table_index] == info->tag)
Jonathan Kewda132932014-04-27 14:05:24 +0100228 required_feature_stage[table_index] = info->stage[table_index];
Behdad Esfahbod731a4302016-03-02 13:32:42 -0800229
Behdad Esfahbod895fb5d2010-10-12 16:00:21 -0400230 found |= hb_ot_layout_language_find_feature (face,
Behdad Esfahbod5a2b0b32010-10-08 20:14:57 -0400231 table_tags[table_index],
232 script_index[table_index],
233 language_index[table_index],
234 info->tag,
235 &feature_index[table_index]);
Jonathan Kewda132932014-04-27 14:05:24 +0100236 }
Behdad Esfahbod0f98fe82015-07-23 11:52:11 +0100237 if (!found && (info->flags & F_GLOBAL_SEARCH))
238 {
239 for (unsigned int table_index = 0; table_index < 2; table_index++)
240 {
241 found |= hb_ot_layout_table_find_feature (face,
242 table_tags[table_index],
243 info->tag,
244 &feature_index[table_index]);
245 }
246 }
Behdad Esfahbodec544862013-02-14 11:25:10 -0500247 if (!found && !(info->flags & F_HAS_FALLBACK))
Behdad Esfahbod5a2b0b32010-10-08 20:14:57 -0400248 continue;
249
250
Behdad Esfahbod90645fb2011-05-27 18:13:31 -0400251 hb_ot_map_t::feature_map_t *map = m.features.push ();
Behdad Esfahbod5a2b0b32010-10-08 20:14:57 -0400252
253 map->tag = info->tag;
254 map->index[0] = feature_index[0];
255 map->index[1] = feature_index[1];
Behdad Esfahbodb70c96d2011-07-07 21:07:41 -0400256 map->stage[0] = info->stage[0];
257 map->stage[1] = info->stage[1];
Behdad Esfahbodcdf1fd02017-07-14 12:43:34 +0100258 map->auto_zwnj = !(info->flags & F_MANUAL_ZWNJ);
Behdad Esfahboda8cf7b42013-03-19 05:53:26 -0400259 map->auto_zwj = !(info->flags & F_MANUAL_ZWJ);
David Corbettf05df642018-01-26 21:36:15 -0500260 map->random = !!(info->flags & F_RANDOM);
Behdad Esfahbodec544862013-02-14 11:25:10 -0500261 if ((info->flags & F_GLOBAL) && info->max_value == 1) {
Behdad Esfahbod5a2b0b32010-10-08 20:14:57 -0400262 /* Uses the global bit */
Behdad Esfahbod5287ccc2017-08-10 14:25:53 -0700263 map->shift = global_bit_shift;
264 map->mask = global_bit_mask;
Behdad Esfahbod5a2b0b32010-10-08 20:14:57 -0400265 } else {
266 map->shift = next_bit;
Behdad Esfahbod33317312016-08-08 17:24:04 -0700267 map->mask = (1u << (next_bit + bits_needed)) - (1u << next_bit);
Behdad Esfahbod5a2b0b32010-10-08 20:14:57 -0400268 next_bit += bits_needed;
Behdad Esfahbod398238a2013-02-15 07:40:10 -0500269 m.global_mask |= (info->default_value << map->shift) & map->mask;
Behdad Esfahbod5a2b0b32010-10-08 20:14:57 -0400270 }
Behdad Esfahbod33317312016-08-08 17:24:04 -0700271 map->_1_mask = (1u << map->shift) & map->mask;
Behdad Esfahbodfabd3112012-09-05 22:19:28 -0400272 map->needs_fallback = !found;
Behdad Esfahbod5a2b0b32010-10-08 20:14:57 -0400273
274 }
Behdad Esfahbod68435692011-05-05 14:12:37 -0400275 feature_infos.shrink (0); /* Done with these */
Behdad Esfahbod5a2b0b32010-10-08 20:14:57 -0400276
277
Behdad Esfahboddbdbfe32017-10-15 12:11:08 +0200278 add_gsub_pause (nullptr);
279 add_gpos_pause (nullptr);
Behdad Esfahbodb70c96d2011-07-07 21:07:41 -0400280
Jonathan Kewda132932014-04-27 14:05:24 +0100281 for (unsigned int table_index = 0; table_index < 2; table_index++)
282 {
Behdad Esfahbod5a2b0b32010-10-08 20:14:57 -0400283 /* Collect lookup indices for features */
284
Behdad Esfahbod72ada4f2016-09-10 03:57:24 -0700285 unsigned int variations_index;
286 hb_ot_layout_table_find_feature_variations (face,
287 table_tags[table_index],
288 coords,
289 num_coords,
290 &variations_index);
291
Behdad Esfahbod8ac3c9c2013-04-21 15:19:38 -0400292 unsigned int stage_index = 0;
Behdad Esfahbodb70c96d2011-07-07 21:07:41 -0400293 unsigned int last_num_lookups = 0;
294 for (unsigned stage = 0; stage < current_stage[table_index]; stage++)
Behdad Esfahbod5a2b0b32010-10-08 20:14:57 -0400295 {
Jonathan Kewda132932014-04-27 14:05:24 +0100296 if (required_feature_index[table_index] != HB_OT_LAYOUT_NO_FEATURE_INDEX &&
297 required_feature_stage[table_index] == stage)
Behdad Esfahbod12757b62018-01-26 18:14:05 -0800298 add_lookups (m, table_index,
Behdad Esfahbodbde5e392016-09-10 02:43:20 -0700299 required_feature_index[table_index],
Behdad Esfahbod72ada4f2016-09-10 03:57:24 -0700300 variations_index,
Behdad Esfahbod5287ccc2017-08-10 14:25:53 -0700301 global_bit_mask);
Jonathan Kewda132932014-04-27 14:05:24 +0100302
Behdad Esfahbodb70c96d2011-07-07 21:07:41 -0400303 for (unsigned i = 0; i < m.features.len; i++)
304 if (m.features[i].stage[table_index] == stage)
Behdad Esfahbod12757b62018-01-26 18:14:05 -0800305 add_lookups (m, table_index,
Behdad Esfahbodbde5e392016-09-10 02:43:20 -0700306 m.features[i].index[table_index],
Behdad Esfahbod72ada4f2016-09-10 03:57:24 -0700307 variations_index,
Behdad Esfahbodbde5e392016-09-10 02:43:20 -0700308 m.features[i].mask,
Behdad Esfahbodcdf1fd02017-07-14 12:43:34 +0100309 m.features[i].auto_zwnj,
David Corbettc2a75e02018-01-25 14:22:03 -0500310 m.features[i].auto_zwj,
David Corbettf05df642018-01-26 21:36:15 -0500311 m.features[i].random);
Behdad Esfahbodb70c96d2011-07-07 21:07:41 -0400312
313 /* Sort lookups and merge duplicates */
314 if (last_num_lookups < m.lookups[table_index].len)
315 {
Behdad Esfahbodfb8cc862014-06-19 15:30:18 -0400316 m.lookups[table_index].qsort (last_num_lookups, m.lookups[table_index].len);
Behdad Esfahbodb70c96d2011-07-07 21:07:41 -0400317
318 unsigned int j = last_num_lookups;
319 for (unsigned int i = j + 1; i < m.lookups[table_index].len; i++)
320 if (m.lookups[table_index][i].index != m.lookups[table_index][j].index)
321 m.lookups[table_index][++j] = m.lookups[table_index][i];
322 else
Behdad Esfahbodcfc507c2013-02-14 10:40:12 -0500323 {
Behdad Esfahbodb70c96d2011-07-07 21:07:41 -0400324 m.lookups[table_index][j].mask |= m.lookups[table_index][i].mask;
Behdad Esfahbodcdf1fd02017-07-14 12:43:34 +0100325 m.lookups[table_index][j].auto_zwnj &= m.lookups[table_index][i].auto_zwnj;
Behdad Esfahboda8cf7b42013-03-19 05:53:26 -0400326 m.lookups[table_index][j].auto_zwj &= m.lookups[table_index][i].auto_zwj;
Behdad Esfahbodcfc507c2013-02-14 10:40:12 -0500327 }
Behdad Esfahbodb70c96d2011-07-07 21:07:41 -0400328 m.lookups[table_index].shrink (j + 1);
329 }
330
331 last_num_lookups = m.lookups[table_index].len;
332
Behdad Esfahbod8ac3c9c2013-04-21 15:19:38 -0400333 if (stage_index < stages[table_index].len && stages[table_index][stage_index].index == stage) {
Behdad Esfahbod893f57b2013-04-21 15:21:49 -0400334 hb_ot_map_t::stage_map_t *stage_map = m.stages[table_index].push ();
Behdad Esfahbodf7515762018-06-01 17:48:37 -0700335 stage_map->last_lookup = last_num_lookups;
336 stage_map->pause_func = stages[table_index][stage_index].pause_func;
Behdad Esfahbodb70c96d2011-07-07 21:07:41 -0400337
Behdad Esfahbod8ac3c9c2013-04-21 15:19:38 -0400338 stage_index++;
Behdad Esfahbodb70c96d2011-07-07 21:07:41 -0400339 }
Behdad Esfahbod5a2b0b32010-10-08 20:14:57 -0400340 }
341 }
342}