[HB] Simplify MarkAttachmentType handling

This commit is contained in:
Behdad Esfahbod 2009-05-26 15:45:41 -04:00
parent e4b92b85a7
commit 5130c35e93
3 changed files with 13 additions and 17 deletions

View File

@ -784,7 +784,7 @@ struct MarkBasePosFormat1
while (i <= count)
{
property = _hb_ot_layout_get_glyph_property (layout, IN_GLYPH (j));
if (!(property == HB_OT_LAYOUT_GLYPH_CLASS_MARK || property & LookupFlag::MarkAttachmentType))
if (!(property & HB_OT_LAYOUT_GLYPH_CLASS_MARK))
break;
i++, j--;
}
@ -909,7 +909,7 @@ struct MarkLigPosFormat1
while (i <= count)
{
property = _hb_ot_layout_get_glyph_property (layout, IN_GLYPH (j));
if (!(property == HB_OT_LAYOUT_GLYPH_CLASS_MARK || property & LookupFlag::MarkAttachmentType))
if (!(property & HB_OT_LAYOUT_GLYPH_CLASS_MARK))
break;
i++, j--;
}
@ -1047,7 +1047,7 @@ struct MarkMarkPosFormat1
while (i <= count)
{
property = _hb_ot_layout_get_glyph_property (layout, IN_GLYPH (j));
if (!(property == HB_OT_LAYOUT_GLYPH_CLASS_MARK || property & LookupFlag::MarkAttachmentType))
if (!(property & HB_OT_LAYOUT_GLYPH_CLASS_MARK))
return false;
if (!(lookup_flag & LookupFlag::MarkAttachmentType) ||
(lookup_flag & LookupFlag::MarkAttachmentType) == property)

View File

@ -310,8 +310,7 @@ struct Ligature
j++;
}
if (!(property == HB_OT_LAYOUT_GLYPH_CLASS_MARK ||
property & LookupFlag::MarkAttachmentType))
if (!(property & HB_OT_LAYOUT_GLYPH_CLASS_MARK))
is_mark = FALSE;
if (HB_LIKELY (IN_GLYPH(j) != component[i]))
@ -402,8 +401,7 @@ struct LigatureSubstFormat1
{
hb_codepoint_t glyph_id = IN_CURGLYPH ();
bool first_is_mark = (property == HB_OT_LAYOUT_GLYPH_CLASS_MARK ||
property & LookupFlag::MarkAttachmentType);
bool first_is_mark = !!(property & HB_OT_LAYOUT_GLYPH_CLASS_MARK);
unsigned int index = (this+coverage) (glyph_id);
if (HB_LIKELY (index == NOT_COVERED))

View File

@ -138,12 +138,6 @@ _hb_ot_layout_get_glyph_property (hb_ot_layout_t *layout,
{
hb_ot_layout_class_t klass;
/* TODO old harfbuzz doesn't always parse mark attachments as it says it was
* introduced without a version bump, so it may not be safe */
klass = layout->gdef->get_mark_attachment_type (glyph);
if (klass)
return klass << 8;
klass = layout->gdef->get_glyph_class (glyph);
if (!klass && glyph < layout->new_gdef.len)
@ -154,8 +148,12 @@ _hb_ot_layout_get_glyph_property (hb_ot_layout_t *layout,
case GDEF::UnclassifiedGlyph: return HB_OT_LAYOUT_GLYPH_CLASS_UNCLASSIFIED;
case GDEF::BaseGlyph: return HB_OT_LAYOUT_GLYPH_CLASS_BASE_GLYPH;
case GDEF::LigatureGlyph: return HB_OT_LAYOUT_GLYPH_CLASS_LIGATURE;
case GDEF::MarkGlyph: return HB_OT_LAYOUT_GLYPH_CLASS_MARK;
case GDEF::ComponentGlyph: return HB_OT_LAYOUT_GLYPH_CLASS_COMPONENT;
case GDEF::MarkGlyph:
/* TODO old harfbuzz doesn't always parse mark attachments as it says it was
* introduced without a version bump, so it may not be safe */
klass = layout->gdef->get_mark_attachment_type (glyph);
return HB_OT_LAYOUT_GLYPH_CLASS_MARK + klass << 8;
}
}
@ -178,9 +176,9 @@ _hb_ot_layout_check_glyph_property (hb_ot_layout_t *layout,
*property = ginfo->gproperty;
/* If the glyph was found in the MarkAttachmentClass table,
* then that class value is the high byte of the result,
* otherwise the low byte contains the basic type of the glyph
* as defined by the GlyphClassDef table.
* then that class value is stored in the high byte of the result.
* The low byte contains the basic type of the glyph as defined by
* the GlyphClassDef table.
*/
if (*property & LookupFlag::MarkAttachmentType)
basic_glyph_class = HB_OT_LAYOUT_GLYPH_CLASS_MARK;