hb-ot-shape-complex-indic.cc revision c7fe56a1d5d3e969b6ec51cd9ecd471706a19568
1b9ddbd55930228422e82b34a141ad1b6093f5376Behdad Esfahbod/*
220503ccd578c9983162857954e3236413469ed35Behdad Esfahbod * Copyright © 2011  Google, Inc.
3b9ddbd55930228422e82b34a141ad1b6093f5376Behdad Esfahbod *
4b9ddbd55930228422e82b34a141ad1b6093f5376Behdad Esfahbod *  This is part of HarfBuzz, a text shaping library.
5b9ddbd55930228422e82b34a141ad1b6093f5376Behdad Esfahbod *
6b9ddbd55930228422e82b34a141ad1b6093f5376Behdad Esfahbod * Permission is hereby granted, without written agreement and without
7b9ddbd55930228422e82b34a141ad1b6093f5376Behdad Esfahbod * license or royalty fees, to use, copy, modify, and distribute this
8b9ddbd55930228422e82b34a141ad1b6093f5376Behdad Esfahbod * software and its documentation for any purpose, provided that the
9b9ddbd55930228422e82b34a141ad1b6093f5376Behdad Esfahbod * above copyright notice and the following two paragraphs appear in
10b9ddbd55930228422e82b34a141ad1b6093f5376Behdad Esfahbod * all copies of this software.
11b9ddbd55930228422e82b34a141ad1b6093f5376Behdad Esfahbod *
12b9ddbd55930228422e82b34a141ad1b6093f5376Behdad Esfahbod * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
13b9ddbd55930228422e82b34a141ad1b6093f5376Behdad Esfahbod * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
14b9ddbd55930228422e82b34a141ad1b6093f5376Behdad Esfahbod * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
15b9ddbd55930228422e82b34a141ad1b6093f5376Behdad Esfahbod * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
16b9ddbd55930228422e82b34a141ad1b6093f5376Behdad Esfahbod * DAMAGE.
17b9ddbd55930228422e82b34a141ad1b6093f5376Behdad Esfahbod *
18b9ddbd55930228422e82b34a141ad1b6093f5376Behdad Esfahbod * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
19b9ddbd55930228422e82b34a141ad1b6093f5376Behdad Esfahbod * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
20b9ddbd55930228422e82b34a141ad1b6093f5376Behdad Esfahbod * FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
21b9ddbd55930228422e82b34a141ad1b6093f5376Behdad Esfahbod * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
22b9ddbd55930228422e82b34a141ad1b6093f5376Behdad Esfahbod * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
23b9ddbd55930228422e82b34a141ad1b6093f5376Behdad Esfahbod *
24b9ddbd55930228422e82b34a141ad1b6093f5376Behdad Esfahbod * Google Author(s): Behdad Esfahbod
25b9ddbd55930228422e82b34a141ad1b6093f5376Behdad Esfahbod */
26b9ddbd55930228422e82b34a141ad1b6093f5376Behdad Esfahbod
27b9ddbd55930228422e82b34a141ad1b6093f5376Behdad Esfahbod#include "hb-ot-shape-complex-private.hh"
28b9ddbd55930228422e82b34a141ad1b6093f5376Behdad Esfahbod
29b9ddbd55930228422e82b34a141ad1b6093f5376Behdad EsfahbodHB_BEGIN_DECLS
30b9ddbd55930228422e82b34a141ad1b6093f5376Behdad Esfahbod
31b9ddbd55930228422e82b34a141ad1b6093f5376Behdad Esfahbod
32b9ddbd55930228422e82b34a141ad1b6093f5376Behdad Esfahbod/* buffer var allocations */
33867361c3ad39629a8d5b7dc48d558a1c19e37d43Behdad Esfahbod#define indic_category() var2.u8[0] /* indic_category_t */
34867361c3ad39629a8d5b7dc48d558a1c19e37d43Behdad Esfahbod#define indic_position() var2.u8[1] /* indic_matra_category_t */
35b9ddbd55930228422e82b34a141ad1b6093f5376Behdad Esfahbod
36b9ddbd55930228422e82b34a141ad1b6093f5376Behdad Esfahbod#define INDIC_TABLE_ELEMENT_TYPE uint8_t
37b9ddbd55930228422e82b34a141ad1b6093f5376Behdad Esfahbod
3820503ccd578c9983162857954e3236413469ed35Behdad Esfahbod/* Cateories used in the OpenType spec:
3920503ccd578c9983162857954e3236413469ed35Behdad Esfahbod * https://www.microsoft.com/typography/otfntdev/devanot/shaping.aspx
4020503ccd578c9983162857954e3236413469ed35Behdad Esfahbod */
41c7fe56a1d5d3e969b6ec51cd9ecd471706a19568Behdad Esfahbod/* Note: This enum is duplicated in the -machine.rl source file.
42c7fe56a1d5d3e969b6ec51cd9ecd471706a19568Behdad Esfahbod * Not sure how to avoid duplication. */
43867361c3ad39629a8d5b7dc48d558a1c19e37d43Behdad Esfahbodenum indic_category_t {
4420503ccd578c9983162857954e3236413469ed35Behdad Esfahbod  OT_X = 0,
4520503ccd578c9983162857954e3236413469ed35Behdad Esfahbod  OT_C,
46c7fe56a1d5d3e969b6ec51cd9ecd471706a19568Behdad Esfahbod  OT_Ra, /* Not explicitly listed in the OT spec, but used in the grammar. */
4720503ccd578c9983162857954e3236413469ed35Behdad Esfahbod  OT_V,
4820503ccd578c9983162857954e3236413469ed35Behdad Esfahbod  OT_N,
4920503ccd578c9983162857954e3236413469ed35Behdad Esfahbod  OT_H,
5020503ccd578c9983162857954e3236413469ed35Behdad Esfahbod  OT_ZWNJ,
5120503ccd578c9983162857954e3236413469ed35Behdad Esfahbod  OT_ZWJ,
5220503ccd578c9983162857954e3236413469ed35Behdad Esfahbod  OT_M,
5320503ccd578c9983162857954e3236413469ed35Behdad Esfahbod  OT_SM,
5420503ccd578c9983162857954e3236413469ed35Behdad Esfahbod  OT_VD,
5520503ccd578c9983162857954e3236413469ed35Behdad Esfahbod  OT_A,
56b9452bfc1696457e156e79037c863903da5454fcBehdad Esfahbod  OT_NBSP
5720503ccd578c9983162857954e3236413469ed35Behdad Esfahbod};
5820503ccd578c9983162857954e3236413469ed35Behdad Esfahbod
5920503ccd578c9983162857954e3236413469ed35Behdad Esfahbod/* Categories used in IndicSyllabicCategory.txt from UCD */
6020503ccd578c9983162857954e3236413469ed35Behdad Esfahbod/* The assignments are guesswork */
61b9ddbd55930228422e82b34a141ad1b6093f5376Behdad Esfahbodenum indic_syllabic_category_t {
6220503ccd578c9983162857954e3236413469ed35Behdad Esfahbod  INDIC_SYLLABIC_CATEGORY_OTHER			= OT_X,
6320503ccd578c9983162857954e3236413469ed35Behdad Esfahbod
64422e08dbb8e2c0c5664f1bdc7e159a673cfea8c5Behdad Esfahbod  INDIC_SYLLABIC_CATEGORY_AVAGRAHA		= OT_X,
6520503ccd578c9983162857954e3236413469ed35Behdad Esfahbod  INDIC_SYLLABIC_CATEGORY_BINDU			= OT_SM,
6620503ccd578c9983162857954e3236413469ed35Behdad Esfahbod  INDIC_SYLLABIC_CATEGORY_CONSONANT		= OT_C,
6720503ccd578c9983162857954e3236413469ed35Behdad Esfahbod  INDIC_SYLLABIC_CATEGORY_CONSONANT_DEAD	= OT_C,
6820503ccd578c9983162857954e3236413469ed35Behdad Esfahbod  INDIC_SYLLABIC_CATEGORY_CONSONANT_FINAL	= OT_C,
6920503ccd578c9983162857954e3236413469ed35Behdad Esfahbod  INDIC_SYLLABIC_CATEGORY_CONSONANT_HEAD_LETTER	= OT_C,
7020503ccd578c9983162857954e3236413469ed35Behdad Esfahbod  INDIC_SYLLABIC_CATEGORY_CONSONANT_MEDIAL	= OT_C,
7120503ccd578c9983162857954e3236413469ed35Behdad Esfahbod  INDIC_SYLLABIC_CATEGORY_CONSONANT_PLACEHOLDER	= OT_NBSP,
7220503ccd578c9983162857954e3236413469ed35Behdad Esfahbod  INDIC_SYLLABIC_CATEGORY_CONSONANT_SUBJOINED	= OT_C,
7320503ccd578c9983162857954e3236413469ed35Behdad Esfahbod  INDIC_SYLLABIC_CATEGORY_CONSONANT_REPHA	= OT_C,
74422e08dbb8e2c0c5664f1bdc7e159a673cfea8c5Behdad Esfahbod  INDIC_SYLLABIC_CATEGORY_MODIFYING_LETTER	= OT_X,
7520503ccd578c9983162857954e3236413469ed35Behdad Esfahbod  INDIC_SYLLABIC_CATEGORY_NUKTA			= OT_N,
76422e08dbb8e2c0c5664f1bdc7e159a673cfea8c5Behdad Esfahbod  INDIC_SYLLABIC_CATEGORY_REGISTER_SHIFTER	= OT_X,
77422e08dbb8e2c0c5664f1bdc7e159a673cfea8c5Behdad Esfahbod  INDIC_SYLLABIC_CATEGORY_TONE_LETTER		= OT_X,
78422e08dbb8e2c0c5664f1bdc7e159a673cfea8c5Behdad Esfahbod  INDIC_SYLLABIC_CATEGORY_TONE_MARK		= OT_X,
7920503ccd578c9983162857954e3236413469ed35Behdad Esfahbod  INDIC_SYLLABIC_CATEGORY_VIRAMA		= OT_H,
8020503ccd578c9983162857954e3236413469ed35Behdad Esfahbod  INDIC_SYLLABIC_CATEGORY_VISARGA		= OT_SM,
8120503ccd578c9983162857954e3236413469ed35Behdad Esfahbod  INDIC_SYLLABIC_CATEGORY_VOWEL			= OT_V,
8220503ccd578c9983162857954e3236413469ed35Behdad Esfahbod  INDIC_SYLLABIC_CATEGORY_VOWEL_DEPENDENT	= OT_M,
83b9452bfc1696457e156e79037c863903da5454fcBehdad Esfahbod  INDIC_SYLLABIC_CATEGORY_VOWEL_INDEPENDENT	= OT_V
84b9ddbd55930228422e82b34a141ad1b6093f5376Behdad Esfahbod};
85b9ddbd55930228422e82b34a141ad1b6093f5376Behdad Esfahbod
8620503ccd578c9983162857954e3236413469ed35Behdad Esfahbod/* Categories used in IndicSMatraCategory.txt from UCD */
87b9ddbd55930228422e82b34a141ad1b6093f5376Behdad Esfahbodenum indic_matra_category_t {
8820503ccd578c9983162857954e3236413469ed35Behdad Esfahbod  INDIC_MATRA_CATEGORY_NOT_APPLICABLE		= 0,
8920503ccd578c9983162857954e3236413469ed35Behdad Esfahbod
90422e08dbb8e2c0c5664f1bdc7e159a673cfea8c5Behdad Esfahbod  INDIC_MATRA_CATEGORY_LEFT			= 0x01,
91422e08dbb8e2c0c5664f1bdc7e159a673cfea8c5Behdad Esfahbod  INDIC_MATRA_CATEGORY_TOP			= 0x02,
92422e08dbb8e2c0c5664f1bdc7e159a673cfea8c5Behdad Esfahbod  INDIC_MATRA_CATEGORY_BOTTOM			= 0x04,
93422e08dbb8e2c0c5664f1bdc7e159a673cfea8c5Behdad Esfahbod  INDIC_MATRA_CATEGORY_RIGHT			= 0x08,
94422e08dbb8e2c0c5664f1bdc7e159a673cfea8c5Behdad Esfahbod
95422e08dbb8e2c0c5664f1bdc7e159a673cfea8c5Behdad Esfahbod  /* We don't really care much about these since we decompose them
96422e08dbb8e2c0c5664f1bdc7e159a673cfea8c5Behdad Esfahbod   * in the generic pre-shaping layer. */
97422e08dbb8e2c0c5664f1bdc7e159a673cfea8c5Behdad Esfahbod  INDIC_MATRA_CATEGORY_BOTTOM_AND_RIGHT		= INDIC_MATRA_CATEGORY_BOTTOM +
98422e08dbb8e2c0c5664f1bdc7e159a673cfea8c5Behdad Esfahbod						  INDIC_MATRA_CATEGORY_RIGHT,
99422e08dbb8e2c0c5664f1bdc7e159a673cfea8c5Behdad Esfahbod  INDIC_MATRA_CATEGORY_LEFT_AND_RIGHT		= INDIC_MATRA_CATEGORY_LEFT +
100422e08dbb8e2c0c5664f1bdc7e159a673cfea8c5Behdad Esfahbod						  INDIC_MATRA_CATEGORY_RIGHT,
101422e08dbb8e2c0c5664f1bdc7e159a673cfea8c5Behdad Esfahbod  INDIC_MATRA_CATEGORY_TOP_AND_BOTTOM		= INDIC_MATRA_CATEGORY_TOP +
102422e08dbb8e2c0c5664f1bdc7e159a673cfea8c5Behdad Esfahbod						  INDIC_MATRA_CATEGORY_BOTTOM,
103422e08dbb8e2c0c5664f1bdc7e159a673cfea8c5Behdad Esfahbod  INDIC_MATRA_CATEGORY_TOP_AND_BOTTOM_AND_RIGHT	= INDIC_MATRA_CATEGORY_TOP +
104422e08dbb8e2c0c5664f1bdc7e159a673cfea8c5Behdad Esfahbod						  INDIC_MATRA_CATEGORY_BOTTOM +
105422e08dbb8e2c0c5664f1bdc7e159a673cfea8c5Behdad Esfahbod						  INDIC_MATRA_CATEGORY_RIGHT,
106422e08dbb8e2c0c5664f1bdc7e159a673cfea8c5Behdad Esfahbod  INDIC_MATRA_CATEGORY_TOP_AND_LEFT		= INDIC_MATRA_CATEGORY_TOP +
107422e08dbb8e2c0c5664f1bdc7e159a673cfea8c5Behdad Esfahbod						  INDIC_MATRA_CATEGORY_LEFT,
108422e08dbb8e2c0c5664f1bdc7e159a673cfea8c5Behdad Esfahbod  INDIC_MATRA_CATEGORY_TOP_AND_LEFT_AND_RIGHT	= INDIC_MATRA_CATEGORY_TOP +
109422e08dbb8e2c0c5664f1bdc7e159a673cfea8c5Behdad Esfahbod						  INDIC_MATRA_CATEGORY_LEFT +
110422e08dbb8e2c0c5664f1bdc7e159a673cfea8c5Behdad Esfahbod						  INDIC_MATRA_CATEGORY_RIGHT,
111422e08dbb8e2c0c5664f1bdc7e159a673cfea8c5Behdad Esfahbod  INDIC_MATRA_CATEGORY_TOP_AND_RIGHT		= INDIC_MATRA_CATEGORY_TOP +
112422e08dbb8e2c0c5664f1bdc7e159a673cfea8c5Behdad Esfahbod						  INDIC_MATRA_CATEGORY_RIGHT,
113422e08dbb8e2c0c5664f1bdc7e159a673cfea8c5Behdad Esfahbod
114422e08dbb8e2c0c5664f1bdc7e159a673cfea8c5Behdad Esfahbod  INDIC_MATRA_CATEGORY_INVISIBLE		= INDIC_MATRA_CATEGORY_NOT_APPLICABLE,
115422e08dbb8e2c0c5664f1bdc7e159a673cfea8c5Behdad Esfahbod  INDIC_MATRA_CATEGORY_OVERSTRUCK		= INDIC_MATRA_CATEGORY_NOT_APPLICABLE,
116422e08dbb8e2c0c5664f1bdc7e159a673cfea8c5Behdad Esfahbod  INDIC_MATRA_CATEGORY_VISUAL_ORDER_LEFT	= INDIC_MATRA_CATEGORY_NOT_APPLICABLE
117b9ddbd55930228422e82b34a141ad1b6093f5376Behdad Esfahbod};
118b9ddbd55930228422e82b34a141ad1b6093f5376Behdad Esfahbod
11920503ccd578c9983162857954e3236413469ed35Behdad Esfahbod#define INDIC_COMBINE_CATEGORIES(S,M) \
12020503ccd578c9983162857954e3236413469ed35Behdad Esfahbod  (ASSERT_STATIC_EXPR (M == INDIC_MATRA_CATEGORY_NOT_APPLICABLE || (S == INDIC_SYLLABIC_CATEGORY_VIRAMA || S == INDIC_SYLLABIC_CATEGORY_VOWEL_DEPENDENT)), \
12120503ccd578c9983162857954e3236413469ed35Behdad Esfahbod   ASSERT_STATIC_EXPR (S < 16 && M < 16), \
12220503ccd578c9983162857954e3236413469ed35Behdad Esfahbod   (M << 4) | S)
123b9ddbd55930228422e82b34a141ad1b6093f5376Behdad Esfahbod
124b9ddbd55930228422e82b34a141ad1b6093f5376Behdad Esfahbod#include "hb-ot-shape-complex-indic-table.hh"
125b9ddbd55930228422e82b34a141ad1b6093f5376Behdad Esfahbod
126c7fe56a1d5d3e969b6ec51cd9ecd471706a19568Behdad Esfahbod
127c7fe56a1d5d3e969b6ec51cd9ecd471706a19568Behdad Esfahbodstatic const struct {
128c7fe56a1d5d3e969b6ec51cd9ecd471706a19568Behdad Esfahbod  hb_tag_t tag;
129c7fe56a1d5d3e969b6ec51cd9ecd471706a19568Behdad Esfahbod  hb_bool_t is_global;
130c7fe56a1d5d3e969b6ec51cd9ecd471706a19568Behdad Esfahbod} indic_basic_features[] =
131b9ddbd55930228422e82b34a141ad1b6093f5376Behdad Esfahbod{
132c7fe56a1d5d3e969b6ec51cd9ecd471706a19568Behdad Esfahbod  {HB_TAG('n','u','k','t'), true},
133c7fe56a1d5d3e969b6ec51cd9ecd471706a19568Behdad Esfahbod  {HB_TAG('a','k','h','n'), false},
134c7fe56a1d5d3e969b6ec51cd9ecd471706a19568Behdad Esfahbod  {HB_TAG('r','p','h','f'), false},
135c7fe56a1d5d3e969b6ec51cd9ecd471706a19568Behdad Esfahbod  {HB_TAG('r','k','r','f'), false},
136c7fe56a1d5d3e969b6ec51cd9ecd471706a19568Behdad Esfahbod  {HB_TAG('p','r','e','f'), false},
137c7fe56a1d5d3e969b6ec51cd9ecd471706a19568Behdad Esfahbod  {HB_TAG('b','l','w','f'), false},
138c7fe56a1d5d3e969b6ec51cd9ecd471706a19568Behdad Esfahbod  {HB_TAG('h','a','l','f'), false},
139c7fe56a1d5d3e969b6ec51cd9ecd471706a19568Behdad Esfahbod  {HB_TAG('v','a','t','u'), true},
140c7fe56a1d5d3e969b6ec51cd9ecd471706a19568Behdad Esfahbod  {HB_TAG('p','s','t','f'), false},
141c7fe56a1d5d3e969b6ec51cd9ecd471706a19568Behdad Esfahbod  {HB_TAG('c','j','c','t'), true},
142c7fe56a1d5d3e969b6ec51cd9ecd471706a19568Behdad Esfahbod};
143c7fe56a1d5d3e969b6ec51cd9ecd471706a19568Behdad Esfahbod
144c7fe56a1d5d3e969b6ec51cd9ecd471706a19568Behdad Esfahbod/* Same order as the indic_basic_features array */
145c7fe56a1d5d3e969b6ec51cd9ecd471706a19568Behdad Esfahbodenum {
146c7fe56a1d5d3e969b6ec51cd9ecd471706a19568Behdad Esfahbod  _NUKT,
147c7fe56a1d5d3e969b6ec51cd9ecd471706a19568Behdad Esfahbod  AKHN,
148c7fe56a1d5d3e969b6ec51cd9ecd471706a19568Behdad Esfahbod  RPHF,
149c7fe56a1d5d3e969b6ec51cd9ecd471706a19568Behdad Esfahbod  RKRF,
150c7fe56a1d5d3e969b6ec51cd9ecd471706a19568Behdad Esfahbod  PREF,
151c7fe56a1d5d3e969b6ec51cd9ecd471706a19568Behdad Esfahbod  BLWF,
152c7fe56a1d5d3e969b6ec51cd9ecd471706a19568Behdad Esfahbod  HALF,
153c7fe56a1d5d3e969b6ec51cd9ecd471706a19568Behdad Esfahbod  _VATU,
154c7fe56a1d5d3e969b6ec51cd9ecd471706a19568Behdad Esfahbod  PSTF,
155c7fe56a1d5d3e969b6ec51cd9ecd471706a19568Behdad Esfahbod  _CJCT,
156b9ddbd55930228422e82b34a141ad1b6093f5376Behdad Esfahbod};
157b9ddbd55930228422e82b34a141ad1b6093f5376Behdad Esfahbod
158b9ddbd55930228422e82b34a141ad1b6093f5376Behdad Esfahbodstatic const hb_tag_t indic_other_features[] =
159b9ddbd55930228422e82b34a141ad1b6093f5376Behdad Esfahbod{
160b9ddbd55930228422e82b34a141ad1b6093f5376Behdad Esfahbod  HB_TAG('p','r','e','s'),
161b9ddbd55930228422e82b34a141ad1b6093f5376Behdad Esfahbod  HB_TAG('a','b','v','s'),
162b9ddbd55930228422e82b34a141ad1b6093f5376Behdad Esfahbod  HB_TAG('b','l','w','s'),
163b9ddbd55930228422e82b34a141ad1b6093f5376Behdad Esfahbod  HB_TAG('p','s','t','s'),
164b9ddbd55930228422e82b34a141ad1b6093f5376Behdad Esfahbod  HB_TAG('h','a','l','n'),
165b9ddbd55930228422e82b34a141ad1b6093f5376Behdad Esfahbod
166b9ddbd55930228422e82b34a141ad1b6093f5376Behdad Esfahbod  HB_TAG('d','i','s','t'),
167b9ddbd55930228422e82b34a141ad1b6093f5376Behdad Esfahbod  HB_TAG('a','b','v','m'),
168b9ddbd55930228422e82b34a141ad1b6093f5376Behdad Esfahbod  HB_TAG('b','l','w','m'),
169b9ddbd55930228422e82b34a141ad1b6093f5376Behdad Esfahbod};
170b9ddbd55930228422e82b34a141ad1b6093f5376Behdad Esfahbod
171b9ddbd55930228422e82b34a141ad1b6093f5376Behdad Esfahbod
172b9ddbd55930228422e82b34a141ad1b6093f5376Behdad Esfahbodvoid
173867361c3ad39629a8d5b7dc48d558a1c19e37d43Behdad Esfahbod_hb_ot_shape_complex_collect_features_indic (hb_ot_shape_planner_t *planner, const hb_segment_properties_t *props HB_UNUSED)
174b9ddbd55930228422e82b34a141ad1b6093f5376Behdad Esfahbod{
175b9ddbd55930228422e82b34a141ad1b6093f5376Behdad Esfahbod  for (unsigned int i = 0; i < ARRAY_LENGTH (indic_basic_features); i++)
176c7fe56a1d5d3e969b6ec51cd9ecd471706a19568Behdad Esfahbod    planner->map.add_bool_feature (indic_basic_features[i].tag, indic_basic_features[i].is_global);
177b9ddbd55930228422e82b34a141ad1b6093f5376Behdad Esfahbod
178b9ddbd55930228422e82b34a141ad1b6093f5376Behdad Esfahbod  for (unsigned int i = 0; i < ARRAY_LENGTH (indic_other_features); i++)
179b9ddbd55930228422e82b34a141ad1b6093f5376Behdad Esfahbod    planner->map.add_bool_feature (indic_other_features[i], true);
180b9ddbd55930228422e82b34a141ad1b6093f5376Behdad Esfahbod}
181b9ddbd55930228422e82b34a141ad1b6093f5376Behdad Esfahbod
182867361c3ad39629a8d5b7dc48d558a1c19e37d43Behdad Esfahbod
183867361c3ad39629a8d5b7dc48d558a1c19e37d43Behdad Esfahbod
184867361c3ad39629a8d5b7dc48d558a1c19e37d43Behdad Esfahbod#include "hb-ot-shape-complex-indic-machine.hh"
185867361c3ad39629a8d5b7dc48d558a1c19e37d43Behdad Esfahbod
186867361c3ad39629a8d5b7dc48d558a1c19e37d43Behdad Esfahbod
187b9ddbd55930228422e82b34a141ad1b6093f5376Behdad Esfahbodvoid
188b9ddbd55930228422e82b34a141ad1b6093f5376Behdad Esfahbod_hb_ot_shape_complex_setup_masks_indic	(hb_ot_shape_context_t *c)
189b9ddbd55930228422e82b34a141ad1b6093f5376Behdad Esfahbod{
190b9ddbd55930228422e82b34a141ad1b6093f5376Behdad Esfahbod  unsigned int count = c->buffer->len;
191b9ddbd55930228422e82b34a141ad1b6093f5376Behdad Esfahbod
192b9ddbd55930228422e82b34a141ad1b6093f5376Behdad Esfahbod  for (unsigned int i = 0; i < count; i++)
193b9ddbd55930228422e82b34a141ad1b6093f5376Behdad Esfahbod  {
194867361c3ad39629a8d5b7dc48d558a1c19e37d43Behdad Esfahbod    unsigned int type = get_indic_categories (c->buffer->info[i].codepoint);
195b9ddbd55930228422e82b34a141ad1b6093f5376Behdad Esfahbod
196867361c3ad39629a8d5b7dc48d558a1c19e37d43Behdad Esfahbod    c->buffer->info[i].indic_category() = type & 0x0F;
197867361c3ad39629a8d5b7dc48d558a1c19e37d43Behdad Esfahbod    c->buffer->info[i].indic_position() = type >> 4;
198b9ddbd55930228422e82b34a141ad1b6093f5376Behdad Esfahbod  }
199b9ddbd55930228422e82b34a141ad1b6093f5376Behdad Esfahbod
200867361c3ad39629a8d5b7dc48d558a1c19e37d43Behdad Esfahbod  find_syllables (c);
201867361c3ad39629a8d5b7dc48d558a1c19e37d43Behdad Esfahbod
202b9ddbd55930228422e82b34a141ad1b6093f5376Behdad Esfahbod  hb_mask_t mask_array[ARRAY_LENGTH (indic_basic_features)] = {0};
203b9ddbd55930228422e82b34a141ad1b6093f5376Behdad Esfahbod  unsigned int num_masks = ARRAY_LENGTH (indic_basic_features);
204b9ddbd55930228422e82b34a141ad1b6093f5376Behdad Esfahbod  for (unsigned int i = 0; i < num_masks; i++)
205c7fe56a1d5d3e969b6ec51cd9ecd471706a19568Behdad Esfahbod    mask_array[i] = c->plan->map.get_1_mask (indic_basic_features[i].tag);
206b9ddbd55930228422e82b34a141ad1b6093f5376Behdad Esfahbod}
207b9ddbd55930228422e82b34a141ad1b6093f5376Behdad Esfahbod
208b9ddbd55930228422e82b34a141ad1b6093f5376Behdad Esfahbod
209b9ddbd55930228422e82b34a141ad1b6093f5376Behdad EsfahbodHB_END_DECLS
210