提交 8c69e65a 编写于 作者: B Behdad Esfahbod

Rename lookup_flags to lookup_props since it's more than just flags

上级 98370e89
...@@ -290,7 +290,11 @@ struct Lookup ...@@ -290,7 +290,11 @@ struct Lookup
inline unsigned int get_subtable_count (void) const { return subTable.len; } inline unsigned int get_subtable_count (void) const { return subTable.len; }
inline unsigned int get_type (void) const { return lookupType; } 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; unsigned int flag = lookupFlag;
if (unlikely (flag & LookupFlag::UseMarkFilteringSet)) if (unlikely (flag & LookupFlag::UseMarkFilteringSet))
......
...@@ -625,7 +625,7 @@ struct PairPosFormat1 ...@@ -625,7 +625,7 @@ struct PairPosFormat1
return false; return false;
unsigned int j = c->buffer->i + 1; 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)) if (unlikely (j == end))
return false; return false;
...@@ -687,7 +687,7 @@ struct PairPosFormat2 ...@@ -687,7 +687,7 @@ struct PairPosFormat2
return false; return false;
unsigned int j = c->buffer->i + 1; 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)) if (unlikely (j == end))
return false; return false;
...@@ -840,7 +840,7 @@ struct CursivePosFormat1 ...@@ -840,7 +840,7 @@ struct CursivePosFormat1
return false; return false;
unsigned int j = c->buffer->i + 1; 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)) if (unlikely (j == end))
return false; return false;
...@@ -876,7 +876,7 @@ struct CursivePosFormat1 ...@@ -876,7 +876,7 @@ struct CursivePosFormat1
c->buffer->pos[i].y_advance = c->buffer->pos[i].y_offset + exit_y - entry_y; 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; c->buffer->pos[i].cursive_chain() = j - i;
if (likely (HB_DIRECTION_IS_HORIZONTAL (direction))) if (likely (HB_DIRECTION_IS_HORIZONTAL (direction)))
...@@ -1192,7 +1192,7 @@ struct MarkMarkPosFormat1 ...@@ -1192,7 +1192,7 @@ struct MarkMarkPosFormat1
if (unlikely (!j)) if (unlikely (!j))
return false; return false;
j--; 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)) if (!(property & HB_OT_LAYOUT_GLYPH_CLASS_MARK))
return false; return false;
...@@ -1411,9 +1411,9 @@ struct PosLookup : Lookup ...@@ -1411,9 +1411,9 @@ struct PosLookup : Lookup
c->lookup_mask = lookup_mask; c->lookup_mask = lookup_mask;
c->context_length = context_length; c->context_length = context_length;
c->nesting_level_left = nesting_level_left; 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; return false;
for (unsigned int i = 0; i < get_subtable_count (); i++) for (unsigned int i = 0; i < get_subtable_count (); i++)
......
...@@ -354,7 +354,7 @@ struct Ligature ...@@ -354,7 +354,7 @@ struct Ligature
for (i = 1, j = c->buffer->i + 1; i < count; i++, j++) for (i = 1, j = c->buffer->i + 1; i < count; i++, j++)
{ {
unsigned int property; 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)) if (unlikely (j + count - i == end))
return false; return false;
...@@ -392,7 +392,7 @@ struct Ligature ...@@ -392,7 +392,7 @@ struct Ligature
for (i = 1; i < count; i++) 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].component() = i;
c->buffer->info[c->buffer->i].lig_id() = lig_id; c->buffer->info[c->buffer->i].lig_id() = lig_id;
...@@ -776,9 +776,9 @@ struct SubstLookup : Lookup ...@@ -776,9 +776,9 @@ struct SubstLookup : Lookup
c->lookup_mask = lookup_mask; c->lookup_mask = lookup_mask;
c->context_length = context_length; c->context_length = context_length;
c->nesting_level_left = nesting_level_left; 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; return false;
if (unlikely (lookup_type == SubstLookupSubTable::Extension)) if (unlikely (lookup_type == SubstLookupSubTable::Extension))
......
...@@ -53,7 +53,7 @@ struct hb_apply_context_t ...@@ -53,7 +53,7 @@ struct hb_apply_context_t
hb_mask_t lookup_mask; hb_mask_t lookup_mask;
unsigned int context_length; unsigned int context_length;
unsigned int nesting_level_left; unsigned int nesting_level_left;
unsigned int lookup_flag; unsigned int lookup_props;
unsigned int property; /* propety of first glyph */ unsigned int property; /* propety of first glyph */
...@@ -126,7 +126,7 @@ static inline bool match_input (hb_apply_context_t *c, ...@@ -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++) 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)) if (unlikely (j + count - i == end))
return false; return false;
...@@ -153,7 +153,7 @@ static inline bool match_backtrack (hb_apply_context_t *c, ...@@ -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--) 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)) if (unlikely (j + 1 == count - i))
return false; return false;
...@@ -181,7 +181,7 @@ static inline bool match_lookahead (hb_apply_context_t *c, ...@@ -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++) 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)) if (unlikely (j + count - i == end))
return false; return false;
...@@ -235,7 +235,7 @@ static inline bool apply_lookup (hb_apply_context_t *c, ...@@ -235,7 +235,7 @@ static inline bool apply_lookup (hb_apply_context_t *c,
*/ */
for (unsigned int i = 0; i < count; /* NOP */) 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)) if (unlikely (c->buffer->i == end))
return true; return true;
......
...@@ -97,13 +97,13 @@ _hb_ot_layout_free (hb_ot_layout_t *layout); ...@@ -97,13 +97,13 @@ _hb_ot_layout_free (hb_ot_layout_t *layout);
HB_INTERNAL hb_bool_t HB_INTERNAL hb_bool_t
_hb_ot_layout_check_glyph_property (hb_face_t *face, _hb_ot_layout_check_glyph_property (hb_face_t *face,
hb_glyph_info_t *ginfo, hb_glyph_info_t *ginfo,
unsigned int lookup_flags, unsigned int lookup_props,
unsigned int *property); unsigned int *property);
HB_INTERNAL hb_bool_t HB_INTERNAL hb_bool_t
_hb_ot_layout_skip_mark (hb_face_t *face, _hb_ot_layout_skip_mark (hb_face_t *face,
hb_glyph_info_t *ginfo, hb_glyph_info_t *ginfo,
unsigned int lookup_flags, unsigned int lookup_props,
unsigned int *property); unsigned int *property);
......
...@@ -138,7 +138,7 @@ _hb_ot_layout_get_glyph_property (hb_face_t *face, ...@@ -138,7 +138,7 @@ _hb_ot_layout_get_glyph_property (hb_face_t *face,
hb_bool_t hb_bool_t
_hb_ot_layout_check_glyph_property (hb_face_t *face, _hb_ot_layout_check_glyph_property (hb_face_t *face,
hb_glyph_info_t *ginfo, hb_glyph_info_t *ginfo,
unsigned int lookup_flags, unsigned int lookup_props,
unsigned int *property_out) unsigned int *property_out)
{ {
unsigned int property; unsigned int property;
...@@ -148,25 +148,25 @@ _hb_ot_layout_check_glyph_property (hb_face_t *face, ...@@ -148,25 +148,25 @@ _hb_ot_layout_check_glyph_property (hb_face_t *face,
*property_out = property; *property_out = property;
/* Not covered, if, for example, glyph class is ligature and /* 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; return false;
if (property & HB_OT_LAYOUT_GLYPH_CLASS_MARK) if (property & HB_OT_LAYOUT_GLYPH_CLASS_MARK)
{ {
/* If using mark filtering sets, the high short of /* 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) if (lookup_props & LookupFlag::UseMarkFilteringSet)
return _get_gdef (face).mark_set_covers (lookup_flags >> 16, ginfo->codepoint); 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 * "ignore marks of attachment type different than
* the attachment type specified." * the attachment type specified."
*/ */
if (lookup_flags & LookupFlag::MarkAttachmentType && property & LookupFlag::MarkAttachmentType) if (lookup_props & LookupFlag::MarkAttachmentType && property & LookupFlag::MarkAttachmentType)
return (lookup_flags & LookupFlag::MarkAttachmentType) == (property & LookupFlag::MarkAttachmentType); return (lookup_props & LookupFlag::MarkAttachmentType) == (property & LookupFlag::MarkAttachmentType);
} }
return true; return true;
...@@ -175,7 +175,7 @@ _hb_ot_layout_check_glyph_property (hb_face_t *face, ...@@ -175,7 +175,7 @@ _hb_ot_layout_check_glyph_property (hb_face_t *face,
hb_bool_t hb_bool_t
_hb_ot_layout_skip_mark (hb_face_t *face, _hb_ot_layout_skip_mark (hb_face_t *face,
hb_glyph_info_t *ginfo, hb_glyph_info_t *ginfo,
unsigned int lookup_flags, unsigned int lookup_props,
unsigned int *property_out) unsigned int *property_out)
{ {
unsigned int property; unsigned int property;
...@@ -186,18 +186,18 @@ _hb_ot_layout_skip_mark (hb_face_t *face, ...@@ -186,18 +186,18 @@ _hb_ot_layout_skip_mark (hb_face_t *face,
if (property & HB_OT_LAYOUT_GLYPH_CLASS_MARK) if (property & HB_OT_LAYOUT_GLYPH_CLASS_MARK)
{ {
/* Skip mark if lookup_flags includes LookupFlags::IgnoreMarks */ /* Skip mark if lookup_props includes LookupFlags::IgnoreMarks */
if (lookup_flags & LookupFlag::IgnoreMarks) if (lookup_props & LookupFlag::IgnoreMarks)
return true; return true;
/* If using mark filtering sets, the high short of lookup_flags has the set index. */ /* If using mark filtering sets, the high short of lookup_props has the set index. */
if (lookup_flags & LookupFlag::UseMarkFilteringSet) if (lookup_props & LookupFlag::UseMarkFilteringSet)
return !_get_gdef (face).mark_set_covers (lookup_flags >> 16, ginfo->codepoint); 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." */ * different than the attachment type specified." */
if (lookup_flags & LookupFlag::MarkAttachmentType && property & LookupFlag::MarkAttachmentType) if (lookup_props & LookupFlag::MarkAttachmentType && property & LookupFlag::MarkAttachmentType)
return (lookup_flags & LookupFlag::MarkAttachmentType) != (property & LookupFlag::MarkAttachmentType); return (lookup_props & LookupFlag::MarkAttachmentType) != (property & LookupFlag::MarkAttachmentType);
} }
return false; return false;
......
...@@ -161,8 +161,8 @@ main (int argc, char **argv) ...@@ -161,8 +161,8 @@ main (int argc, char **argv)
printf (" %d lookup(s) found in table\n", num_lookups); printf (" %d lookup(s) found in table\n", num_lookups);
for (int n_lookup = 0; n_lookup < num_lookups; n_lookup++) { for (int n_lookup = 0; n_lookup < num_lookups; n_lookup++) {
const Lookup &lookup = g.get_lookup (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, printf (" Lookup %2d of %2d: type %d, props 0x%04X\n", n_lookup, num_lookups,
lookup.get_type(), lookup.get_flag()); lookup.get_type(), lookup.get_props());
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册