Refactor common macro

This commit is contained in:
Behdad Esfahbod 2012-09-06 14:25:48 -04:00
parent 07cfbe21b5
commit 028a1706f8
4 changed files with 12 additions and 12 deletions

View File

@ -349,10 +349,7 @@ position_cluster (const hb_ot_shape_plan_t *plan,
/* Find the base glyph */ /* Find the base glyph */
for (unsigned int i = start; i < end; i++) for (unsigned int i = start; i < end; i++)
if (is_a_ligature (buffer->info[i]) || if (is_a_ligature (buffer->info[i]) ||
!(FLAG (_hb_glyph_info_get_general_category (&buffer->info[i])) & !HB_UNICODE_GENERAL_CATEGORY_IS_MARK (_hb_glyph_info_get_general_category (&buffer->info[i])))
(FLAG (HB_UNICODE_GENERAL_CATEGORY_SPACING_MARK) |
FLAG (HB_UNICODE_GENERAL_CATEGORY_ENCLOSING_MARK) |
FLAG (HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK))))
{ {
position_around_base (plan, font, buffer, i, end); position_around_base (plan, font, buffer, i, end);
break; break;

View File

@ -130,10 +130,7 @@ compose_func (hb_unicode_funcs_t *unicode,
hb_codepoint_t *ab) hb_codepoint_t *ab)
{ {
/* XXX, this belongs to indic normalizer. */ /* XXX, this belongs to indic normalizer. */
if ((FLAG (unicode->general_category (a)) & if (HB_UNICODE_GENERAL_CATEGORY_IS_MARK (unicode->general_category (a)))
(FLAG (HB_UNICODE_GENERAL_CATEGORY_SPACING_MARK) |
FLAG (HB_UNICODE_GENERAL_CATEGORY_ENCLOSING_MARK) |
FLAG (HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK))))
return false; return false;
/* XXX, add composition-exclusion exceptions to Indic shaper. */ /* XXX, add composition-exclusion exceptions to Indic shaper. */
if (a == 0x09AF && b == 0x09BC) { *ab = 0x09DF; return true; } if (a == 0x09AF && b == 0x09BC) { *ab = 0x09DF; return true; }

View File

@ -270,10 +270,7 @@ hb_form_clusters (hb_buffer_t *buffer)
{ {
unsigned int count = buffer->len; unsigned int count = buffer->len;
for (unsigned int i = 1; i < count; i++) for (unsigned int i = 1; i < count; i++)
if (FLAG (_hb_glyph_info_get_general_category (&buffer->info[i])) & if (HB_UNICODE_GENERAL_CATEGORY_IS_MARK (_hb_glyph_info_get_general_category (&buffer->info[i])))
(FLAG (HB_UNICODE_GENERAL_CATEGORY_SPACING_MARK) |
FLAG (HB_UNICODE_GENERAL_CATEGORY_ENCLOSING_MARK) |
FLAG (HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK)))
buffer->merge_clusters (i - 1, i + 1); buffer->merge_clusters (i - 1, i + 1);
} }

View File

@ -268,4 +268,13 @@ extern HB_INTERNAL const hb_unicode_funcs_t _hb_unicode_funcs_nil;
#define HB_MODIFIED_COMBINING_CLASS_CCC132 132 /* sign u */ #define HB_MODIFIED_COMBINING_CLASS_CCC132 132 /* sign u */
/* Misc */
#define HB_UNICODE_GENERAL_CATEGORY_IS_MARK(gen_cat) \
(FLAG (gen_cat) & \
(FLAG (HB_UNICODE_GENERAL_CATEGORY_SPACING_MARK) | \
FLAG (HB_UNICODE_GENERAL_CATEGORY_ENCLOSING_MARK) | \
FLAG (HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK)))
#endif /* HB_UNICODE_PRIVATE_HH */ #endif /* HB_UNICODE_PRIVATE_HH */