- Face index > 0 and dfont fonts
- HB_OT_LAYOUT_GLYPH_CLASS_BASE_GLYPH vs LookupType::... mess
- Rename LookupFlag::MarkAttachmentType to LookupFlag:IgnoreSpecialMarks
-- Skip forward/backward should only skip marks, not whatever lookupflags say!
- layout vs font split
- gpi again
return false;
unsigned int j = buffer->in_pos + 1;
- while (!_hb_ot_layout_check_glyph_property (layout, IN_INFO (j), lookup_flag, &property))
+ while (_hb_ot_layout_skip_mark (layout, IN_INFO (j), lookup_flag, NULL))
{
if (HB_UNLIKELY (j == end))
return false;
return false;
unsigned int j = buffer->in_pos + 1;
- while (!_hb_ot_layout_check_glyph_property (layout, IN_INFO (j), lookup_flag, &property))
+ while (_hb_ot_layout_skip_mark (layout, IN_INFO (j), lookup_flag, NULL))
{
if (HB_UNLIKELY (j == end))
return false;
private:
inline bool apply (APPLY_ARG_DEF) const
{
- if (lookup_flag & LookupFlag::IgnoreBaseGlyphs)
- return false;
-
unsigned int mark_index = (this+markCoverage) (IN_CURGLYPH ());
if (HB_LIKELY (mark_index == NOT_COVERED))
return false;
private:
inline bool apply (APPLY_ARG_DEF) const
{
- if (lookup_flag & LookupFlag::IgnoreLigatures)
- return false;
-
unsigned int mark_index = (this+markCoverage) (IN_CURGLYPH ());
if (HB_LIKELY (mark_index == NOT_COVERED))
return false;
private:
inline bool apply (APPLY_ARG_DEF) const
{
- if (lookup_flag & LookupFlag::IgnoreMarks)
- return false;
-
unsigned int mark1_index = (this+mark1Coverage) (IN_CURGLYPH ());
if (HB_LIKELY (mark1_index == NOT_COVERED))
return false;
glyph_id += deltaGlyphID;
_hb_buffer_replace_glyph (buffer, glyph_id);
- if ( _hb_ot_layout_has_new_glyph_classes (layout) )
- {
- /* we inherit the old glyph class to the substituted glyph */
+ /* We inherit the old glyph class to the substituted glyph */
+ if (_hb_ot_layout_has_new_glyph_classes (layout))
_hb_ot_layout_set_glyph_property (layout, glyph_id, property);
- }
return true;
}
glyph_id = substitute[index];
_hb_buffer_replace_glyph (buffer, glyph_id);
- if ( _hb_ot_layout_has_new_glyph_classes (layout) )
- {
- /* we inherit the old glyph class to the substituted glyph */
+ /* We inherit the old glyph class to the substituted glyph */
+ if (_hb_ot_layout_has_new_glyph_classes (layout))
_hb_ot_layout_set_glyph_property (layout, glyph_id, property);
- }
return true;
}
substitute.len, (const uint16_t *) substitute.array,
0xFFFF, 0xFFFF);
- if ( _hb_ot_layout_has_new_glyph_classes (layout) )
+ /* This is a guess only ... */
+ if (_hb_ot_layout_has_new_glyph_classes (layout))
{
- /* this is a guess only ... */
- if ( property == HB_OT_LAYOUT_GLYPH_CLASS_LIGATURE )
+ if (property == HB_OT_LAYOUT_GLYPH_CLASS_LIGATURE)
property = HB_OT_LAYOUT_GLYPH_CLASS_BASE_GLYPH;
unsigned int count = substitute.len;
_hb_buffer_replace_glyph (buffer, glyph_id);
- if ( _hb_ot_layout_has_new_glyph_classes (layout) )
- {
- /* we inherit the old glyph class to the substituted glyph */
+ /* We inherit the old glyph class to the substituted glyph */
+ if (_hb_ot_layout_has_new_glyph_classes (layout))
_hb_ot_layout_set_glyph_property (layout, glyph_id, property);
- }
return true;
}
for (i = 1, j = buffer->in_pos + 1; i < count; i++, j++)
{
- while (!_hb_ot_layout_check_glyph_property (layout, IN_INFO (j), lookup_flag, &property))
+ while (_hb_ot_layout_skip_mark (layout, IN_INFO (j), lookup_flag, &property))
{
if (HB_UNLIKELY (j + count - i == end))
return false;
if (!(property & HB_OT_LAYOUT_GLYPH_CLASS_MARK))
is_mark = FALSE;
- if (HB_LIKELY (IN_GLYPH(j) != component[i]))
+ if (HB_LIKELY (IN_GLYPH (j) != component[i]))
return false;
}
- if ( _hb_ot_layout_has_new_glyph_classes (layout) )
- /* this is just a guess ... */
+ /* This is just a guess ... */
+ if (_hb_ot_layout_has_new_glyph_classes (layout))
hb_ot_layout_set_glyph_class (layout, ligGlyph,
is_mark ? HB_OT_LAYOUT_GLYPH_CLASS_MARK
: HB_OT_LAYOUT_GLYPH_CLASS_LIGATURE);
for ( i = 1; i < count; i++ )
{
- while (!_hb_ot_layout_check_glyph_property (layout, IN_CURINFO(), lookup_flag, &property))
- _hb_buffer_add_output_glyph (buffer, IN_CURGLYPH(), i - 1, lig_id);
+ while (_hb_ot_layout_skip_mark (layout, IN_CURINFO (), lookup_flag, NULL))
+ _hb_buffer_add_output_glyph (buffer, IN_CURGLYPH (), i - 1, lig_id);
(buffer->in_pos)++;
}
match_coverage, (char *) this,
1))
{
- IN_CURGLYPH() = substitute[index];
+ IN_CURGLYPH () = substitute[index];
buffer->in_pos--; /* Reverse! */
return true;
}
for (i = 1, j = buffer->in_pos + 1; i < count; i++, j++)
{
- while (!_hb_ot_layout_check_glyph_property (layout, IN_INFO (j), lookup_flag, &property))
+ while (_hb_ot_layout_skip_mark (layout, IN_INFO (j), lookup_flag, NULL))
{
if (HB_UNLIKELY (j + count - i == end))
return false;
j++;
}
- if (HB_LIKELY (!match_func (IN_GLYPH(j), input[i - 1], match_data)))
+ if (HB_LIKELY (!match_func (IN_GLYPH (j), input[i - 1], match_data)))
return false;
}
for (unsigned int i = 0, j = buffer->out_pos - 1; i < count; i++, j--)
{
- while (!_hb_ot_layout_check_glyph_property (layout, OUT_INFO (j), lookup_flag, &property))
+ while (_hb_ot_layout_skip_mark (layout, OUT_INFO (j), lookup_flag, NULL))
{
if (HB_UNLIKELY (j + 1 == count - i))
return false;
j--;
}
- if (HB_LIKELY (!match_func (OUT_GLYPH(j), backtrack[i], match_data)))
+ if (HB_LIKELY (!match_func (OUT_GLYPH (j), backtrack[i], match_data)))
return false;
}
for (i = 0, j = buffer->in_pos + offset; i < count; i++, j++)
{
- while (!_hb_ot_layout_check_glyph_property (layout, OUT_INFO (j), lookup_flag, &property))
+ while (_hb_ot_layout_skip_mark (layout, OUT_INFO (j), lookup_flag, NULL))
{
if (HB_UNLIKELY (j + count - i == end))
return false;
j++;
}
- if (HB_LIKELY (!match_func (IN_GLYPH(j), lookahead[i], match_data)))
+ if (HB_LIKELY (!match_func (IN_GLYPH (j), lookahead[i], match_data)))
return false;
}
* Should be easy for in_place ones at least. */
for (unsigned int i = 0; i < count; i++)
{
- while (!_hb_ot_layout_check_glyph_property (layout, IN_CURINFO (), lookup_flag, &property))
+ while (_hb_ot_layout_skip_mark (layout, IN_CURINFO (), lookup_flag, NULL))
{
if (HB_UNLIKELY (buffer->in_pos == end))
return true;
unsigned int lookup_flags,
unsigned int *property);
+HB_INTERNAL hb_bool_t
+_hb_ot_layout_skip_mark (hb_ot_layout_t *layout,
+ hb_glyph_info_t *ginfo,
+ unsigned int lookup_flags,
+ unsigned int *property);
+
HB_END_DECLS
#endif /* HB_OT_LAYOUT_PRIVATE_H */
_hb_ot_layout_check_glyph_property (hb_ot_layout_t *layout,
hb_glyph_info_t *ginfo,
unsigned int lookup_flags,
- unsigned int *property)
+ unsigned int *property_out)
{
- hb_ot_layout_glyph_class_t glyph_class;
- unsigned int desired_attachment_class;
+ unsigned int property;
if (ginfo->gproperty == HB_BUFFER_GLYPH_PROPERTIES_UNKNOWN)
- {
- ginfo->gproperty = *property = _hb_ot_layout_get_glyph_property (layout, ginfo->gindex);
- if (ginfo->gproperty == HB_OT_LAYOUT_GLYPH_CLASS_UNCLASSIFIED)
- return false;
- }
-
- *property = ginfo->gproperty;
-
- /* If the glyph was found in the MarkAttachmentClass 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.
- */
- glyph_class = (hb_ot_layout_glyph_class_t) *property;
+ ginfo->gproperty = _hb_ot_layout_get_glyph_property (layout, ginfo->gindex);
+ property = ginfo->gproperty;
+ if (property_out)
+ *property_out = property;
- /* Not covered, if, for example, glyph_class is HB_GDEF_LIGATURE and
+ /* Not covered, if, for example, glyph class is ligature and
* lookup_flags includes LookupFlags::IgnoreLigatures
*/
- if (lookup_flags & glyph_class)
+ if (property & lookup_flags)
return false;
- if (glyph_class & HB_OT_LAYOUT_GLYPH_CLASS_MARK)
+ if (property & HB_OT_LAYOUT_GLYPH_CLASS_MARK)
{
/* If using mark filtering sets, the high short of
- * lookup_flags hsa the set index.
+ * lookup_flags has the set index.
*/
if (lookup_flags & LookupFlag::UseMarkFilteringSet)
return layout->gdef->mark_set_covers (lookup_flags >> 16, ginfo->gindex);
* "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_flags & LookupFlag::MarkAttachmentType && property & LookupFlag::MarkAttachmentType)
+ return (lookup_flags & LookupFlag::MarkAttachmentType) == (property & LookupFlag::MarkAttachmentType);
}
-
return true;
}
+HB_INTERNAL hb_bool_t
+_hb_ot_layout_skip_mark (hb_ot_layout_t *layout,
+ hb_glyph_info_t *ginfo,
+ unsigned int lookup_flags,
+ unsigned int *property_out)
+{
+ unsigned int property;
+
+ if (ginfo->gproperty == HB_BUFFER_GLYPH_PROPERTIES_UNKNOWN)
+ ginfo->gproperty = _hb_ot_layout_get_glyph_property (layout, ginfo->gindex);
+ property = ginfo->gproperty;
+ if (property_out)
+ *property_out = property;
+
+ if (property & HB_OT_LAYOUT_GLYPH_CLASS_MARK)
+ {
+ /* Skip mark if lookup_flags includes LookupFlags::IgnoreMarks */
+ if (lookup_flags & 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 !layout->gdef->mark_set_covers (lookup_flags >> 16, ginfo->gindex);
+
+ /* The second byte of lookup_flags 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);
+ }
+
+ return false;
+}
+
HB_INTERNAL void
_hb_ot_layout_set_glyph_property (hb_ot_layout_t *layout,
hb_codepoint_t glyph,