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_PRIVATE_HH
30 #define HB_OT_LAYOUT_PRIVATE_HH
31
32 #include "hb-private.hh"
33
34 #include "hb-font-private.hh"
35 #include "hb-buffer-private.hh"
36 #include "hb-set-private.hh"
37
38
39 /* Private API corresponding to hb-ot-layout.h: */
40
41 HB_INTERNAL hb_bool_t
42 hb_ot_layout_table_find_feature (hb_face_t *face,
43 hb_tag_t table_tag,
44 hb_tag_t feature_tag,
45 unsigned int *feature_index);
46
47
48 /*
49 * GDEF
50 */
51
52 enum hb_ot_layout_glyph_props_flags_t
53 {
54 /* The following three match LookupFlags::Ignore* numbers. */
55 HB_OT_LAYOUT_GLYPH_PROPS_BASE_GLYPH = 0x02u,
56 HB_OT_LAYOUT_GLYPH_PROPS_LIGATURE = 0x04u,
108 HB_INTERNAL void
109 hb_ot_layout_position_finish_advances (hb_font_t *font,
110 hb_buffer_t *buffer);
111
112 /* Should be called after hb_ot_layout_position_finish_advances, to finish offsets. */
113 HB_INTERNAL void
114 hb_ot_layout_position_finish_offsets (hb_font_t *font,
115 hb_buffer_t *buffer);
116
117
118
119 /*
120 * hb_ot_layout_t
121 */
122
123 namespace OT {
124 struct GDEF;
125 struct GSUB;
126 struct GPOS;
127 struct MATH;
128 }
129
130 struct hb_ot_layout_lookup_accelerator_t
131 {
132 template <typename TLookup>
133 inline void init (const TLookup &lookup)
134 {
135 digest.init ();
136 lookup.add_coverage (&digest);
137 }
138
139 inline void fini (void)
140 {
141 }
142
143 inline bool may_have (hb_codepoint_t g) const {
144 return digest.may_have (g);
145 }
146
147 private:
148 hb_set_digest_t digest;
149 };
150
151 struct hb_ot_layout_t
152 {
153 hb_blob_t *gdef_blob;
154 hb_blob_t *gsub_blob;
155 hb_blob_t *gpos_blob;
156 hb_blob_t *math_blob;
157
158 const struct OT::GDEF *gdef;
159 const struct OT::GSUB *gsub;
160 const struct OT::GPOS *gpos;
161 const struct OT::MATH *math;
162
163 unsigned int gsub_lookup_count;
164 unsigned int gpos_lookup_count;
165
166 hb_ot_layout_lookup_accelerator_t *gsub_accels;
167 hb_ot_layout_lookup_accelerator_t *gpos_accels;
168 };
169
170
171 HB_INTERNAL hb_ot_layout_t *
172 _hb_ot_layout_create (hb_face_t *face);
173
174 HB_INTERNAL void
175 _hb_ot_layout_destroy (hb_ot_layout_t *layout);
176
177
178 #define hb_ot_layout_from_face(face) ((hb_ot_layout_t *) face->shaper_data.ot)
179
180
181 /*
182 * Buffer var routines.
183 */
184
185 /* buffer var allocations, used during the entire shaping process */
186 #define unicode_props() var2.u16[0]
187
188 /* buffer var allocations, used during the GSUB/GPOS processing */
189 #define glyph_props() var1.u16[0] /* GDEF glyph properties */
190 #define lig_props() var1.u8[2] /* GSUB/GPOS ligature tracking */
191 #define syllable() var1.u8[3] /* GSUB/GPOS shaping boundaries */
192
193
194 /* loop over syllables */
195
196 #define foreach_syllable(buffer, start, end) \
197 for (unsigned int \
198 _count = buffer->len, \
199 start = 0, end = _count ? _next_syllable (buffer, 0) : 0; \
200 start < _count; \
201 start = end, end = _next_syllable (buffer, start))
202
203 static inline unsigned int
204 _next_syllable (hb_buffer_t *buffer, unsigned int start)
205 {
206 hb_glyph_info_t *info = buffer->info;
207 unsigned int count = buffer->len;
208
209 unsigned int syllable = info[start].syllable();
210 while (++start < count && syllable == info[start].syllable())
211 ;
212
213 return start;
214 }
215
216
217 /* unicode_props */
218
219 /* Design:
220 * unicode_props() is a two-byte number. The low byte includes:
221 * - General_Category: 5 bits.
222 * - A bit each for:
223 * * Is it Default_Ignorable(); we have a modified Default_Ignorable().
224 * * Whether it's one of the three Mongolian Free Variation Selectors.
225 * * One free bit right now.
226 *
227 * The high-byte has different meanings, switched by the Gen-Cat:
228 * - For Mn,Mc,Me: the modified Combining_Class.
229 * - For Cf: whether it's ZWJ, ZWNJ, or something else.
230 * - For Ws: index of which space character this is, if space fallback
231 * is needed, ie. we don't set this by default, only if asked to.
232 */
233
234 enum hb_unicode_props_flags_t {
235 UPROPS_MASK_GEN_CAT = 0x001Fu,
236 UPROPS_MASK_IGNORABLE = 0x0020u,
237 UPROPS_MASK_FVS = 0x0040u, /* MONGOLIAN FREE VARIATION SELECTOR 1..3 */
238
239 /* If GEN_CAT=FORMAT, top byte masks: */
240 UPROPS_MASK_Cf_ZWJ = 0x0100u,
241 UPROPS_MASK_Cf_ZWNJ = 0x0200u
242 };
243 HB_MARK_AS_FLAG_T (hb_unicode_props_flags_t);
244
245 static inline void
246 _hb_glyph_info_set_unicode_props (hb_glyph_info_t *info, hb_buffer_t *buffer)
247 {
248 hb_unicode_funcs_t *unicode = buffer->unicode;
249 unsigned int u = info->codepoint;
250 unsigned int gen_cat = (unsigned int) unicode->general_category (u);
251 unsigned int props = gen_cat;
252
253 if (u >= 0x80)
254 {
255 buffer->scratch_flags |= HB_BUFFER_SCRATCH_FLAG_HAS_NON_ASCII;
256 if (unlikely (unicode->is_default_ignorable (u)))
257 {
258 buffer->scratch_flags |= HB_BUFFER_SCRATCH_FLAG_HAS_DEFAULT_IGNORABLES;
259 props |= UPROPS_MASK_IGNORABLE;
260 if (u == 0x200Cu) props |= UPROPS_MASK_Cf_ZWNJ;
261 if (u == 0x200Du) props |= UPROPS_MASK_Cf_ZWJ;
262 /* Mongolian Free Variation Selectors need to be remembered
263 * because although we need to hide them like default-ignorables,
264 * they need to non-ignorable during shaping. This is similar to
265 * what we do for joiners in Indic-like shapers, but since the
266 * FVSes are GC=Mn, we have use a separate bit to remember them.
267 * Fixes:
268 * https://github.com/behdad/harfbuzz/issues/234
269 */
270 if (unlikely (hb_in_range (u, 0x180Bu, 0x180Du))) props |= UPROPS_MASK_FVS;
271 }
272 else if (unlikely (HB_UNICODE_GENERAL_CATEGORY_IS_NON_ENCLOSING_MARK_OR_MODIFIER_SYMBOL (gen_cat)))
273 {
274 /* The above check is just an optimization to let in only things we need further
275 * processing on. */
276
277 /* Only Mn and Mc can have non-zero ccc:
278 * http://www.unicode.org/policies/stability_policy.html#Property_Value
279 * """
280 * Canonical_Combining_Class, General_Category
281 * All characters other than those with General_Category property values
282 * Spacing_Mark (Mc) and Nonspacing_Mark (Mn) have the Canonical_Combining_Class
283 * property value 0.
284 * 1.1.5+
285 * """
286 *
287 * Also, all Mn's that are Default_Ignorable, have ccc=0, hence
288 * the "else if".
289 */
290 props |= unicode->modified_combining_class (info->codepoint)<<8;
320
321 static inline bool
322 _hb_glyph_info_is_unicode_mark (const hb_glyph_info_t *info)
323 {
324 return HB_UNICODE_GENERAL_CATEGORY_IS_MARK (info->unicode_props() & UPROPS_MASK_GEN_CAT);
325 }
326 static inline void
327 _hb_glyph_info_set_modified_combining_class (hb_glyph_info_t *info,
328 unsigned int modified_class)
329 {
330 if (unlikely (!_hb_glyph_info_is_unicode_mark (info)))
331 return;
332 info->unicode_props() = (modified_class<<8) | (info->unicode_props() & 0xFF);
333 }
334 static inline unsigned int
335 _hb_glyph_info_get_modified_combining_class (const hb_glyph_info_t *info)
336 {
337 return _hb_glyph_info_is_unicode_mark (info) ? info->unicode_props()>>8 : 0;
338 }
339
340 static inline bool
341 _hb_glyph_info_is_unicode_space (const hb_glyph_info_t *info)
342 {
343 return _hb_glyph_info_get_general_category (info) ==
344 HB_UNICODE_GENERAL_CATEGORY_SPACE_SEPARATOR;
345 }
346 static inline void
347 _hb_glyph_info_set_unicode_space_fallback_type (hb_glyph_info_t *info, hb_unicode_funcs_t::space_t s)
348 {
349 if (unlikely (!_hb_glyph_info_is_unicode_space (info)))
350 return;
351 info->unicode_props() = (((unsigned int) s)<<8) | (info->unicode_props() & 0xFF);
352 }
353 static inline hb_unicode_funcs_t::space_t
354 _hb_glyph_info_get_unicode_space_fallback_type (const hb_glyph_info_t *info)
355 {
356 return _hb_glyph_info_is_unicode_space (info) ?
357 (hb_unicode_funcs_t::space_t) (info->unicode_props()>>8) :
358 hb_unicode_funcs_t::NOT_SPACE;
359 }
360
361 static inline bool _hb_glyph_info_ligated (const hb_glyph_info_t *info);
362
363 static inline hb_bool_t
364 _hb_glyph_info_is_default_ignorable (const hb_glyph_info_t *info)
365 {
366 return (info->unicode_props() & UPROPS_MASK_IGNORABLE) &&
367 !_hb_glyph_info_ligated (info);
368 }
369 static inline hb_bool_t
370 _hb_glyph_info_is_default_ignorable_and_not_fvs (const hb_glyph_info_t *info)
371 {
372 return ((info->unicode_props() & (UPROPS_MASK_IGNORABLE|UPROPS_MASK_FVS))
373 == UPROPS_MASK_IGNORABLE) &&
374 !_hb_glyph_info_ligated (info);
375 }
376
377 static inline bool
378 _hb_glyph_info_is_unicode_format (const hb_glyph_info_t *info)
379 {
380 return _hb_glyph_info_get_general_category (info) ==
381 HB_UNICODE_GENERAL_CATEGORY_FORMAT;
382 }
383 static inline hb_bool_t
384 _hb_glyph_info_is_zwnj (const hb_glyph_info_t *info)
385 {
386 return _hb_glyph_info_is_unicode_format (info) && (info->unicode_props() & UPROPS_MASK_Cf_ZWNJ);
387 }
388 static inline hb_bool_t
389 _hb_glyph_info_is_zwj (const hb_glyph_info_t *info)
390 {
391 return _hb_glyph_info_is_unicode_format (info) && (info->unicode_props() & UPROPS_MASK_Cf_ZWJ);
392 }
599 _hb_buffer_deallocate_gsubgpos_vars (hb_buffer_t *buffer)
600 {
601 HB_BUFFER_DEALLOCATE_VAR (buffer, syllable);
602 HB_BUFFER_DEALLOCATE_VAR (buffer, lig_props);
603 HB_BUFFER_DEALLOCATE_VAR (buffer, glyph_props);
604 }
605
606 static inline void
607 _hb_buffer_assert_gsubgpos_vars (hb_buffer_t *buffer)
608 {
609 HB_BUFFER_ASSERT_VAR (buffer, glyph_props);
610 HB_BUFFER_ASSERT_VAR (buffer, lig_props);
611 HB_BUFFER_ASSERT_VAR (buffer, syllable);
612 }
613
614 /* Make sure no one directly touches our props... */
615 #undef unicode_props0
616 #undef unicode_props1
617 #undef lig_props
618 #undef glyph_props
619
620
621 #endif /* HB_OT_LAYOUT_PRIVATE_HH */
|
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_PRIVATE_HH
30 #define HB_OT_LAYOUT_PRIVATE_HH
31
32 #include "hb-private.hh"
33
34 #include "hb-font-private.hh"
35 #include "hb-buffer-private.hh"
36 #include "hb-set-digest-private.hh"
37 #include "hb-open-type-private.hh"
38
39
40 /* Private API corresponding to hb-ot-layout.h: */
41
42 HB_INTERNAL hb_bool_t
43 hb_ot_layout_table_find_feature (hb_face_t *face,
44 hb_tag_t table_tag,
45 hb_tag_t feature_tag,
46 unsigned int *feature_index);
47
48
49 /*
50 * GDEF
51 */
52
53 enum hb_ot_layout_glyph_props_flags_t
54 {
55 /* The following three match LookupFlags::Ignore* numbers. */
56 HB_OT_LAYOUT_GLYPH_PROPS_BASE_GLYPH = 0x02u,
57 HB_OT_LAYOUT_GLYPH_PROPS_LIGATURE = 0x04u,
109 HB_INTERNAL void
110 hb_ot_layout_position_finish_advances (hb_font_t *font,
111 hb_buffer_t *buffer);
112
113 /* Should be called after hb_ot_layout_position_finish_advances, to finish offsets. */
114 HB_INTERNAL void
115 hb_ot_layout_position_finish_offsets (hb_font_t *font,
116 hb_buffer_t *buffer);
117
118
119
120 /*
121 * hb_ot_layout_t
122 */
123
124 namespace OT {
125 struct GDEF;
126 struct GSUB;
127 struct GPOS;
128 struct MATH;
129 struct fvar;
130 struct avar;
131 }
132
133 struct hb_ot_layout_lookup_accelerator_t
134 {
135 template <typename TLookup>
136 inline void init (const TLookup &lookup)
137 {
138 digest.init ();
139 lookup.add_coverage (&digest);
140 }
141
142 inline void fini (void)
143 {
144 }
145
146 inline bool may_have (hb_codepoint_t g) const {
147 return digest.may_have (g);
148 }
149
150 private:
151 hb_set_digest_t digest;
152 };
153
154 struct hb_ot_layout_t
155 {
156 hb_blob_t *gdef_blob;
157 hb_blob_t *gsub_blob;
158 hb_blob_t *gpos_blob;
159
160 const struct OT::GDEF *gdef;
161 const struct OT::GSUB *gsub;
162 const struct OT::GPOS *gpos;
163
164 /* TODO Move the following out of this struct. */
165 OT::hb_lazy_table_loader_t<struct OT::MATH> math;
166 OT::hb_lazy_table_loader_t<struct OT::fvar> fvar;
167 OT::hb_lazy_table_loader_t<struct OT::avar> avar;
168
169 unsigned int gsub_lookup_count;
170 unsigned int gpos_lookup_count;
171
172 hb_ot_layout_lookup_accelerator_t *gsub_accels;
173 hb_ot_layout_lookup_accelerator_t *gpos_accels;
174 };
175
176
177 HB_INTERNAL hb_ot_layout_t *
178 _hb_ot_layout_create (hb_face_t *face);
179
180 HB_INTERNAL void
181 _hb_ot_layout_destroy (hb_ot_layout_t *layout);
182
183
184 #define hb_ot_layout_from_face(face) ((hb_ot_layout_t *) face->shaper_data.ot)
185
186
187 /*
188 * Buffer var routines.
189 */
190
191 /* buffer var allocations, used during the entire shaping process */
192 #define unicode_props() var2.u16[0]
193
194 /* buffer var allocations, used during the GSUB/GPOS processing */
195 #define glyph_props() var1.u16[0] /* GDEF glyph properties */
196 #define lig_props() var1.u8[2] /* GSUB/GPOS ligature tracking */
197 #define syllable() var1.u8[3] /* GSUB/GPOS shaping boundaries */
198
199
200 /* Loop over syllables. Based on foreach_cluster(). */
201 #define foreach_syllable(buffer, start, end) \
202 for (unsigned int \
203 _count = buffer->len, \
204 start = 0, end = _count ? _next_syllable (buffer, 0) : 0; \
205 start < _count; \
206 start = end, end = _next_syllable (buffer, start))
207
208 static inline unsigned int
209 _next_syllable (hb_buffer_t *buffer, unsigned int start)
210 {
211 hb_glyph_info_t *info = buffer->info;
212 unsigned int count = buffer->len;
213
214 unsigned int syllable = info[start].syllable();
215 while (++start < count && syllable == info[start].syllable())
216 ;
217
218 return start;
219 }
220
221
222 /* unicode_props */
223
224 /* Design:
225 * unicode_props() is a two-byte number. The low byte includes:
226 * - General_Category: 5 bits.
227 * - A bit each for:
228 * * Is it Default_Ignorable(); we have a modified Default_Ignorable().
229 * * Whether it's one of the three Mongolian Free Variation Selectors,
230 * CGJ, or other characters that are hidden but should not be ignored
231 * like most other Default_Ignorable()s do during matching.
232 * * One free bit right now.
233 *
234 * The high-byte has different meanings, switched by the Gen-Cat:
235 * - For Mn,Mc,Me: the modified Combining_Class.
236 * - For Cf: whether it's ZWJ, ZWNJ, or something else.
237 * - For Ws: index of which space character this is, if space fallback
238 * is needed, ie. we don't set this by default, only if asked to.
239 */
240
241 enum hb_unicode_props_flags_t {
242 UPROPS_MASK_GEN_CAT = 0x001Fu,
243 UPROPS_MASK_IGNORABLE = 0x0020u,
244 UPROPS_MASK_HIDDEN = 0x0040u, /* MONGOLIAN FREE VARIATION SELECTOR 1..3,
245 * or TAG characters */
246
247 /* If GEN_CAT=FORMAT, top byte masks: */
248 UPROPS_MASK_Cf_ZWJ = 0x0100u,
249 UPROPS_MASK_Cf_ZWNJ = 0x0200u
250 };
251 HB_MARK_AS_FLAG_T (hb_unicode_props_flags_t);
252
253 static inline void
254 _hb_glyph_info_set_unicode_props (hb_glyph_info_t *info, hb_buffer_t *buffer)
255 {
256 hb_unicode_funcs_t *unicode = buffer->unicode;
257 unsigned int u = info->codepoint;
258 unsigned int gen_cat = (unsigned int) unicode->general_category (u);
259 unsigned int props = gen_cat;
260
261 if (u >= 0x80)
262 {
263 buffer->scratch_flags |= HB_BUFFER_SCRATCH_FLAG_HAS_NON_ASCII;
264 if (unlikely (unicode->is_default_ignorable (u)))
265 {
266 buffer->scratch_flags |= HB_BUFFER_SCRATCH_FLAG_HAS_DEFAULT_IGNORABLES;
267 props |= UPROPS_MASK_IGNORABLE;
268 if (u == 0x200Cu) props |= UPROPS_MASK_Cf_ZWNJ;
269 else if (u == 0x200Du) props |= UPROPS_MASK_Cf_ZWJ;
270 /* Mongolian Free Variation Selectors need to be remembered
271 * because although we need to hide them like default-ignorables,
272 * they need to non-ignorable during shaping. This is similar to
273 * what we do for joiners in Indic-like shapers, but since the
274 * FVSes are GC=Mn, we have use a separate bit to remember them.
275 * Fixes:
276 * https://github.com/behdad/harfbuzz/issues/234 */
277 else if (unlikely (hb_in_range (u, 0x180Bu, 0x180Du))) props |= UPROPS_MASK_HIDDEN;
278 /* TAG characters need similar treatment. Fixes:
279 * https://github.com/behdad/harfbuzz/issues/463 */
280 else if (unlikely (hb_in_range (u, 0xE0020u, 0xE007Fu))) props |= UPROPS_MASK_HIDDEN;
281 /* COMBINING GRAPHEME JOINER should not be skipped; at least some times.
282 * https://github.com/behdad/harfbuzz/issues/554 */
283 else if (unlikely (u == 0x034Fu)) props |= UPROPS_MASK_HIDDEN;
284 }
285 else if (unlikely (HB_UNICODE_GENERAL_CATEGORY_IS_NON_ENCLOSING_MARK_OR_MODIFIER_SYMBOL (gen_cat)))
286 {
287 /* The above check is just an optimization to let in only things we need further
288 * processing on. */
289
290 /* Only Mn and Mc can have non-zero ccc:
291 * http://www.unicode.org/policies/stability_policy.html#Property_Value
292 * """
293 * Canonical_Combining_Class, General_Category
294 * All characters other than those with General_Category property values
295 * Spacing_Mark (Mc) and Nonspacing_Mark (Mn) have the Canonical_Combining_Class
296 * property value 0.
297 * 1.1.5+
298 * """
299 *
300 * Also, all Mn's that are Default_Ignorable, have ccc=0, hence
301 * the "else if".
302 */
303 props |= unicode->modified_combining_class (info->codepoint)<<8;
333
334 static inline bool
335 _hb_glyph_info_is_unicode_mark (const hb_glyph_info_t *info)
336 {
337 return HB_UNICODE_GENERAL_CATEGORY_IS_MARK (info->unicode_props() & UPROPS_MASK_GEN_CAT);
338 }
339 static inline void
340 _hb_glyph_info_set_modified_combining_class (hb_glyph_info_t *info,
341 unsigned int modified_class)
342 {
343 if (unlikely (!_hb_glyph_info_is_unicode_mark (info)))
344 return;
345 info->unicode_props() = (modified_class<<8) | (info->unicode_props() & 0xFF);
346 }
347 static inline unsigned int
348 _hb_glyph_info_get_modified_combining_class (const hb_glyph_info_t *info)
349 {
350 return _hb_glyph_info_is_unicode_mark (info) ? info->unicode_props()>>8 : 0;
351 }
352
353 #define info_cc(info) (_hb_glyph_info_get_modified_combining_class (&(info)))
354
355 static inline bool
356 _hb_glyph_info_is_unicode_space (const hb_glyph_info_t *info)
357 {
358 return _hb_glyph_info_get_general_category (info) ==
359 HB_UNICODE_GENERAL_CATEGORY_SPACE_SEPARATOR;
360 }
361 static inline void
362 _hb_glyph_info_set_unicode_space_fallback_type (hb_glyph_info_t *info, hb_unicode_funcs_t::space_t s)
363 {
364 if (unlikely (!_hb_glyph_info_is_unicode_space (info)))
365 return;
366 info->unicode_props() = (((unsigned int) s)<<8) | (info->unicode_props() & 0xFF);
367 }
368 static inline hb_unicode_funcs_t::space_t
369 _hb_glyph_info_get_unicode_space_fallback_type (const hb_glyph_info_t *info)
370 {
371 return _hb_glyph_info_is_unicode_space (info) ?
372 (hb_unicode_funcs_t::space_t) (info->unicode_props()>>8) :
373 hb_unicode_funcs_t::NOT_SPACE;
374 }
375
376 static inline bool _hb_glyph_info_ligated (const hb_glyph_info_t *info);
377
378 static inline hb_bool_t
379 _hb_glyph_info_is_default_ignorable (const hb_glyph_info_t *info)
380 {
381 return (info->unicode_props() & UPROPS_MASK_IGNORABLE) &&
382 !_hb_glyph_info_ligated (info);
383 }
384 static inline hb_bool_t
385 _hb_glyph_info_is_default_ignorable_and_not_hidden (const hb_glyph_info_t *info)
386 {
387 return ((info->unicode_props() & (UPROPS_MASK_IGNORABLE|UPROPS_MASK_HIDDEN))
388 == UPROPS_MASK_IGNORABLE) &&
389 !_hb_glyph_info_ligated (info);
390 }
391
392 static inline bool
393 _hb_glyph_info_is_unicode_format (const hb_glyph_info_t *info)
394 {
395 return _hb_glyph_info_get_general_category (info) ==
396 HB_UNICODE_GENERAL_CATEGORY_FORMAT;
397 }
398 static inline hb_bool_t
399 _hb_glyph_info_is_zwnj (const hb_glyph_info_t *info)
400 {
401 return _hb_glyph_info_is_unicode_format (info) && (info->unicode_props() & UPROPS_MASK_Cf_ZWNJ);
402 }
403 static inline hb_bool_t
404 _hb_glyph_info_is_zwj (const hb_glyph_info_t *info)
405 {
406 return _hb_glyph_info_is_unicode_format (info) && (info->unicode_props() & UPROPS_MASK_Cf_ZWJ);
407 }
614 _hb_buffer_deallocate_gsubgpos_vars (hb_buffer_t *buffer)
615 {
616 HB_BUFFER_DEALLOCATE_VAR (buffer, syllable);
617 HB_BUFFER_DEALLOCATE_VAR (buffer, lig_props);
618 HB_BUFFER_DEALLOCATE_VAR (buffer, glyph_props);
619 }
620
621 static inline void
622 _hb_buffer_assert_gsubgpos_vars (hb_buffer_t *buffer)
623 {
624 HB_BUFFER_ASSERT_VAR (buffer, glyph_props);
625 HB_BUFFER_ASSERT_VAR (buffer, lig_props);
626 HB_BUFFER_ASSERT_VAR (buffer, syllable);
627 }
628
629 /* Make sure no one directly touches our props... */
630 #undef unicode_props0
631 #undef unicode_props1
632 #undef lig_props
633 #undef glyph_props
634
635 #endif /* HB_OT_LAYOUT_PRIVATE_HH */
|