From 8c69e65abed961002d90024c92e18538c6516262 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 27 Oct 2010 22:07:49 -0400 Subject: [PATCH] Rename lookup_flags to lookup_props since it's more than just flags --- src/hb-ot-layout-common-private.hh | 6 ++++- src/hb-ot-layout-gpos-private.hh | 14 +++++------ src/hb-ot-layout-gsub-private.hh | 8 +++---- src/hb-ot-layout-gsubgpos-private.hh | 10 ++++---- src/hb-ot-layout-private.hh | 4 ++-- src/hb-ot-layout.cc | 36 ++++++++++++++-------------- src/main.cc | 4 ++-- 7 files changed, 43 insertions(+), 39 deletions(-) diff --git a/src/hb-ot-layout-common-private.hh b/src/hb-ot-layout-common-private.hh index 2ba0ef452..2855425a7 100644 --- a/src/hb-ot-layout-common-private.hh +++ b/src/hb-ot-layout-common-private.hh @@ -290,7 +290,11 @@ struct Lookup inline unsigned int get_subtable_count (void) const { return subTable.len; } inline unsigned int get_type (void) const { return lookupType; } - inline unsigned int get_flag (void) const + + /* lookup_props is a 32-bit integer where the lower 16-bit is LookupFlag and + * higher 16-bit is mark-filtering-set if the lookup uses one. + * Not to be confused with glyph_props which is very similar. */ + inline uint32_t get_props (void) const { unsigned int flag = lookupFlag; if (unlikely (flag & LookupFlag::UseMarkFilteringSet)) diff --git a/src/hb-ot-layout-gpos-private.hh b/src/hb-ot-layout-gpos-private.hh index cb97cfbf5..2cfabf95f 100644 --- a/src/hb-ot-layout-gpos-private.hh +++ b/src/hb-ot-layout-gpos-private.hh @@ -625,7 +625,7 @@ struct PairPosFormat1 return false; unsigned int j = c->buffer->i + 1; - while (_hb_ot_layout_skip_mark (c->layout->face, &c->buffer->info[j], c->lookup_flag, NULL)) + while (_hb_ot_layout_skip_mark (c->layout->face, &c->buffer->info[j], c->lookup_props, NULL)) { if (unlikely (j == end)) return false; @@ -687,7 +687,7 @@ struct PairPosFormat2 return false; unsigned int j = c->buffer->i + 1; - while (_hb_ot_layout_skip_mark (c->layout->face, &c->buffer->info[j], c->lookup_flag, NULL)) + while (_hb_ot_layout_skip_mark (c->layout->face, &c->buffer->info[j], c->lookup_props, NULL)) { if (unlikely (j == end)) return false; @@ -840,7 +840,7 @@ struct CursivePosFormat1 return false; unsigned int j = c->buffer->i + 1; - while (_hb_ot_layout_skip_mark (c->layout->face, &c->buffer->info[j], c->lookup_flag, NULL)) + while (_hb_ot_layout_skip_mark (c->layout->face, &c->buffer->info[j], c->lookup_props, NULL)) { if (unlikely (j == end)) return false; @@ -876,7 +876,7 @@ struct CursivePosFormat1 c->buffer->pos[i].y_advance = c->buffer->pos[i].y_offset + exit_y - entry_y; } - if (c->lookup_flag & LookupFlag::RightToLeft) + if (c->lookup_props & LookupFlag::RightToLeft) { c->buffer->pos[i].cursive_chain() = j - i; if (likely (HB_DIRECTION_IS_HORIZONTAL (direction))) @@ -1192,7 +1192,7 @@ struct MarkMarkPosFormat1 if (unlikely (!j)) return false; j--; - } while (_hb_ot_layout_skip_mark (c->layout->face, &c->buffer->info[j], c->lookup_flag, &property)); + } while (_hb_ot_layout_skip_mark (c->layout->face, &c->buffer->info[j], c->lookup_props, &property)); if (!(property & HB_OT_LAYOUT_GLYPH_CLASS_MARK)) return false; @@ -1411,9 +1411,9 @@ struct PosLookup : Lookup c->lookup_mask = lookup_mask; c->context_length = context_length; c->nesting_level_left = nesting_level_left; - c->lookup_flag = get_flag (); + c->lookup_props = get_props (); - if (!_hb_ot_layout_check_glyph_property (c->layout->face, &c->buffer->info[c->buffer->i], c->lookup_flag, &c->property)) + if (!_hb_ot_layout_check_glyph_property (c->layout->face, &c->buffer->info[c->buffer->i], c->lookup_props, &c->property)) return false; for (unsigned int i = 0; i < get_subtable_count (); i++) diff --git a/src/hb-ot-layout-gsub-private.hh b/src/hb-ot-layout-gsub-private.hh index a69f41f7f..f63386bb6 100644 --- a/src/hb-ot-layout-gsub-private.hh +++ b/src/hb-ot-layout-gsub-private.hh @@ -354,7 +354,7 @@ struct Ligature for (i = 1, j = c->buffer->i + 1; i < count; i++, j++) { unsigned int property; - while (_hb_ot_layout_skip_mark (c->layout->face, &c->buffer->info[j], c->lookup_flag, &property)) + while (_hb_ot_layout_skip_mark (c->layout->face, &c->buffer->info[j], c->lookup_props, &property)) { if (unlikely (j + count - i == end)) return false; @@ -392,7 +392,7 @@ struct Ligature for (i = 1; i < count; i++) { - while (_hb_ot_layout_skip_mark (c->layout->face, &c->buffer->info[c->buffer->i], c->lookup_flag, NULL)) + while (_hb_ot_layout_skip_mark (c->layout->face, &c->buffer->info[c->buffer->i], c->lookup_props, NULL)) { c->buffer->info[c->buffer->i].component() = i; c->buffer->info[c->buffer->i].lig_id() = lig_id; @@ -776,9 +776,9 @@ struct SubstLookup : Lookup c->lookup_mask = lookup_mask; c->context_length = context_length; c->nesting_level_left = nesting_level_left; - c->lookup_flag = get_flag (); + c->lookup_props = get_props (); - if (!_hb_ot_layout_check_glyph_property (c->layout->face, &c->buffer->info[c->buffer->i], c->lookup_flag, &c->property)) + if (!_hb_ot_layout_check_glyph_property (c->layout->face, &c->buffer->info[c->buffer->i], c->lookup_props, &c->property)) return false; if (unlikely (lookup_type == SubstLookupSubTable::Extension)) diff --git a/src/hb-ot-layout-gsubgpos-private.hh b/src/hb-ot-layout-gsubgpos-private.hh index 5dc6f3ae5..5dd6b31db 100644 --- a/src/hb-ot-layout-gsubgpos-private.hh +++ b/src/hb-ot-layout-gsubgpos-private.hh @@ -53,7 +53,7 @@ struct hb_apply_context_t hb_mask_t lookup_mask; unsigned int context_length; unsigned int nesting_level_left; - unsigned int lookup_flag; + unsigned int lookup_props; unsigned int property; /* propety of first glyph */ @@ -126,7 +126,7 @@ static inline bool match_input (hb_apply_context_t *c, for (i = 1, j = c->buffer->i + 1; i < count; i++, j++) { - while (_hb_ot_layout_skip_mark (c->layout->face, &c->buffer->info[j], c->lookup_flag, NULL)) + while (_hb_ot_layout_skip_mark (c->layout->face, &c->buffer->info[j], c->lookup_props, NULL)) { if (unlikely (j + count - i == end)) return false; @@ -153,7 +153,7 @@ static inline bool match_backtrack (hb_apply_context_t *c, for (unsigned int i = 0, j = c->buffer->out_len - 1; i < count; i++, j--) { - while (_hb_ot_layout_skip_mark (c->layout->face, &c->buffer->out_info[j], c->lookup_flag, NULL)) + while (_hb_ot_layout_skip_mark (c->layout->face, &c->buffer->out_info[j], c->lookup_props, NULL)) { if (unlikely (j + 1 == count - i)) return false; @@ -181,7 +181,7 @@ static inline bool match_lookahead (hb_apply_context_t *c, for (i = 0, j = c->buffer->i + offset; i < count; i++, j++) { - while (_hb_ot_layout_skip_mark (c->layout->face, &c->buffer->info[j], c->lookup_flag, NULL)) + while (_hb_ot_layout_skip_mark (c->layout->face, &c->buffer->info[j], c->lookup_props, NULL)) { if (unlikely (j + count - i == end)) return false; @@ -235,7 +235,7 @@ static inline bool apply_lookup (hb_apply_context_t *c, */ for (unsigned int i = 0; i < count; /* NOP */) { - while (_hb_ot_layout_skip_mark (c->layout->face, &c->buffer->info[c->buffer->i], c->lookup_flag, NULL)) + while (_hb_ot_layout_skip_mark (c->layout->face, &c->buffer->info[c->buffer->i], c->lookup_props, NULL)) { if (unlikely (c->buffer->i == end)) return true; diff --git a/src/hb-ot-layout-private.hh b/src/hb-ot-layout-private.hh index a0886871c..d9d65a59d 100644 --- a/src/hb-ot-layout-private.hh +++ b/src/hb-ot-layout-private.hh @@ -97,13 +97,13 @@ _hb_ot_layout_free (hb_ot_layout_t *layout); HB_INTERNAL hb_bool_t _hb_ot_layout_check_glyph_property (hb_face_t *face, hb_glyph_info_t *ginfo, - unsigned int lookup_flags, + unsigned int lookup_props, unsigned int *property); HB_INTERNAL hb_bool_t _hb_ot_layout_skip_mark (hb_face_t *face, hb_glyph_info_t *ginfo, - unsigned int lookup_flags, + unsigned int lookup_props, unsigned int *property); diff --git a/src/hb-ot-layout.cc b/src/hb-ot-layout.cc index d128fdba1..e4f5e2d19 100644 --- a/src/hb-ot-layout.cc +++ b/src/hb-ot-layout.cc @@ -138,7 +138,7 @@ _hb_ot_layout_get_glyph_property (hb_face_t *face, hb_bool_t _hb_ot_layout_check_glyph_property (hb_face_t *face, hb_glyph_info_t *ginfo, - unsigned int lookup_flags, + unsigned int lookup_props, unsigned int *property_out) { unsigned int property; @@ -148,25 +148,25 @@ _hb_ot_layout_check_glyph_property (hb_face_t *face, *property_out = property; /* Not covered, if, for example, glyph class is ligature and - * lookup_flags includes LookupFlags::IgnoreLigatures + * lookup_props includes LookupFlags::IgnoreLigatures */ - if (property & lookup_flags & LookupFlag::IgnoreFlags) + if (property & lookup_props & LookupFlag::IgnoreFlags) return false; if (property & HB_OT_LAYOUT_GLYPH_CLASS_MARK) { /* If using mark filtering sets, the high short of - * lookup_flags has the set index. + * lookup_props has the set index. */ - if (lookup_flags & LookupFlag::UseMarkFilteringSet) - return _get_gdef (face).mark_set_covers (lookup_flags >> 16, ginfo->codepoint); + if (lookup_props & LookupFlag::UseMarkFilteringSet) + return _get_gdef (face).mark_set_covers (lookup_props >> 16, ginfo->codepoint); - /* The second byte of lookup_flags has the meaning + /* The second byte of lookup_props has the meaning * "ignore marks of attachment type different than * the attachment type specified." */ - if (lookup_flags & LookupFlag::MarkAttachmentType && property & LookupFlag::MarkAttachmentType) - return (lookup_flags & LookupFlag::MarkAttachmentType) == (property & LookupFlag::MarkAttachmentType); + if (lookup_props & LookupFlag::MarkAttachmentType && property & LookupFlag::MarkAttachmentType) + return (lookup_props & LookupFlag::MarkAttachmentType) == (property & LookupFlag::MarkAttachmentType); } return true; @@ -175,7 +175,7 @@ _hb_ot_layout_check_glyph_property (hb_face_t *face, hb_bool_t _hb_ot_layout_skip_mark (hb_face_t *face, hb_glyph_info_t *ginfo, - unsigned int lookup_flags, + unsigned int lookup_props, unsigned int *property_out) { unsigned int property; @@ -186,18 +186,18 @@ _hb_ot_layout_skip_mark (hb_face_t *face, if (property & HB_OT_LAYOUT_GLYPH_CLASS_MARK) { - /* Skip mark if lookup_flags includes LookupFlags::IgnoreMarks */ - if (lookup_flags & LookupFlag::IgnoreMarks) + /* Skip mark if lookup_props includes LookupFlags::IgnoreMarks */ + if (lookup_props & LookupFlag::IgnoreMarks) return true; - /* If using mark filtering sets, the high short of lookup_flags has the set index. */ - if (lookup_flags & LookupFlag::UseMarkFilteringSet) - return !_get_gdef (face).mark_set_covers (lookup_flags >> 16, ginfo->codepoint); + /* If using mark filtering sets, the high short of lookup_props has the set index. */ + if (lookup_props & LookupFlag::UseMarkFilteringSet) + return !_get_gdef (face).mark_set_covers (lookup_props >> 16, ginfo->codepoint); - /* The second byte of lookup_flags has the meaning "ignore marks of attachment type + /* The second byte of lookup_props has the meaning "ignore marks of attachment type * different than the attachment type specified." */ - if (lookup_flags & LookupFlag::MarkAttachmentType && property & LookupFlag::MarkAttachmentType) - return (lookup_flags & LookupFlag::MarkAttachmentType) != (property & LookupFlag::MarkAttachmentType); + if (lookup_props & LookupFlag::MarkAttachmentType && property & LookupFlag::MarkAttachmentType) + return (lookup_props & LookupFlag::MarkAttachmentType) != (property & LookupFlag::MarkAttachmentType); } return false; diff --git a/src/main.cc b/src/main.cc index 083908eaa..8126daec2 100644 --- a/src/main.cc +++ b/src/main.cc @@ -161,8 +161,8 @@ main (int argc, char **argv) printf (" %d lookup(s) found in table\n", num_lookups); for (int n_lookup = 0; n_lookup < num_lookups; n_lookup++) { const Lookup &lookup = g.get_lookup (n_lookup); - printf (" Lookup %2d of %2d: type %d, flags 0x%04X\n", n_lookup, num_lookups, - lookup.get_type(), lookup.get_flag()); + printf (" Lookup %2d of %2d: type %d, props 0x%04X\n", n_lookup, num_lookups, + lookup.get_type(), lookup.get_props()); } }