2 * Copyright © 2009,2010 Red Hat, Inc.
3 * Copyright © 2010,2011,2013 Google, Inc.
5 * This is part of HarfBuzz, a text shaping library.
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.
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
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.
25 * Red Hat Author(s): Behdad Esfahbod
26 * Google Author(s): Behdad Esfahbod
29 #include "hb-aat-map.hh"
31 #include "hb-aat-layout.hh"
34 void hb_aat_map_builder_t::add_feature (hb_tag_t tag,
37 if (tag == HB_TAG ('a','a','l','t'))
39 feature_info_t *info = features.push();
40 info->type = HB_AAT_LAYOUT_FEATURE_TYPE_CHARACTER_ALTERNATIVES;
41 info->setting = (hb_aat_layout_feature_selector_t) value;
45 const hb_aat_feature_mapping_t *mapping = hb_aat_layout_find_feature_mapping (tag);
48 feature_info_t *info = features.push();
49 info->type = mapping->aatFeatureType;
50 info->setting = value ? mapping->selectorToEnable : mapping->selectorToDisable;
54 hb_aat_map_builder_t::compile (hb_aat_map_t &m)
56 /* Sort features and merge duplicates */
61 for (unsigned int i = 1; i < features.length; i++)
62 if (features[i].type != features[j].type)
63 features[++j] = features[i];
64 features.shrink (j + 1);
67 hb_aat_layout_compile_map (this, &m);