From 028a1706f898bfcee0d14acfba47ebe1de09f0c4 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Thu, 6 Sep 2012 14:25:48 -0400 Subject: [PATCH] Refactor common macro --- src/hb-ot-shape-fallback.cc | 5 +---- src/hb-ot-shape-normalize.cc | 5 +---- src/hb-ot-shape.cc | 5 +---- src/hb-unicode-private.hh | 9 +++++++++ 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/hb-ot-shape-fallback.cc b/src/hb-ot-shape-fallback.cc index 8f7eb4764..ae1137a16 100644 --- a/src/hb-ot-shape-fallback.cc +++ b/src/hb-ot-shape-fallback.cc @@ -349,10 +349,7 @@ position_cluster (const hb_ot_shape_plan_t *plan, /* Find the base glyph */ for (unsigned int i = start; i < end; i++) if (is_a_ligature (buffer->info[i]) || - !(FLAG (_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)))) + !HB_UNICODE_GENERAL_CATEGORY_IS_MARK (_hb_glyph_info_get_general_category (&buffer->info[i]))) { position_around_base (plan, font, buffer, i, end); break; diff --git a/src/hb-ot-shape-normalize.cc b/src/hb-ot-shape-normalize.cc index f4d833091..18a3f3f44 100644 --- a/src/hb-ot-shape-normalize.cc +++ b/src/hb-ot-shape-normalize.cc @@ -130,10 +130,7 @@ compose_func (hb_unicode_funcs_t *unicode, hb_codepoint_t *ab) { /* XXX, this belongs to indic normalizer. */ - if ((FLAG (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)))) + if (HB_UNICODE_GENERAL_CATEGORY_IS_MARK (unicode->general_category (a))) return false; /* XXX, add composition-exclusion exceptions to Indic shaper. */ if (a == 0x09AF && b == 0x09BC) { *ab = 0x09DF; return true; } diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc index 1dd8b0a6e..9e44c5db2 100644 --- a/src/hb-ot-shape.cc +++ b/src/hb-ot-shape.cc @@ -270,10 +270,7 @@ hb_form_clusters (hb_buffer_t *buffer) { unsigned int count = buffer->len; for (unsigned int i = 1; i < count; i++) - if (FLAG (_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))) + if (HB_UNICODE_GENERAL_CATEGORY_IS_MARK (_hb_glyph_info_get_general_category (&buffer->info[i]))) buffer->merge_clusters (i - 1, i + 1); } diff --git a/src/hb-unicode-private.hh b/src/hb-unicode-private.hh index 7ef582074..9f24a9fbc 100644 --- a/src/hb-unicode-private.hh +++ b/src/hb-unicode-private.hh @@ -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 */ +/* 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 */