Fix MarkMark issue with ligid and components

This commit is contained in:
Behdad Esfahbod 2009-11-05 16:16:14 -05:00
parent d0351314cd
commit c3f9f7e59d
2 changed files with 7 additions and 10 deletions

View File

@ -1065,9 +1065,9 @@ struct MarkLigPosFormat1
* is identical to the ligature ID of the found ligature. If yes, we * is identical to the ligature ID of the found ligature. If yes, we
* can directly use the component index. If not, we attach the mark * can directly use the component index. If not, we attach the mark
* glyph to the last component of the ligature. */ * glyph to the last component of the ligature. */
if (IN_LIGID (j) == IN_LIGID (buffer->in_pos)) if (IN_LIGID (j) && IN_LIGID (j) == IN_LIGID (buffer->in_pos) && IN_COMPONENT (buffer->in_pos))
{ {
comp_index = IN_COMPONENT (buffer->in_pos); comp_index = IN_COMPONENT (buffer->in_pos) - 1;
if (comp_index >= comp_count) if (comp_index >= comp_count)
comp_index = comp_count - 1; comp_index = comp_count - 1;
} }
@ -1164,9 +1164,10 @@ struct MarkMarkPosFormat1
return false; return false;
/* Two marks match only if they belong to the same base, or same component /* Two marks match only if they belong to the same base, or same component
* of the same ligature. */ * of the same ligature. That is, the component numbers must match, and
if (IN_LIGID (j) != IN_LIGID (buffer->in_pos) || * if those are non-zero, the ligid number should also match. */
IN_COMPONENT (j) != IN_COMPONENT (buffer->in_pos)) if ((IN_COMPONENT (j) != IN_COMPONENT (buffer->in_pos)) ||
(IN_COMPONENT (j) && IN_LIGID (j) != IN_LIGID (buffer->in_pos)))
return false; return false;
unsigned int mark2_index = (this+mark2Coverage) (IN_GLYPH (j)); unsigned int mark2_index = (this+mark2Coverage) (IN_GLYPH (j));

View File

@ -406,14 +406,10 @@ struct Ligature
for ( i = 1; i < count; i++ ) for ( i = 1; i < count; i++ )
{ {
while (_hb_ot_layout_skip_mark (context->face, IN_CURINFO (), lookup_flag, NULL)) while (_hb_ot_layout_skip_mark (context->face, IN_CURINFO (), lookup_flag, NULL))
_hb_buffer_add_output_glyph (buffer, IN_CURGLYPH (), i - 1, lig_id); _hb_buffer_add_output_glyph (buffer, IN_CURGLYPH (), i, lig_id);
(buffer->in_pos)++; (buffer->in_pos)++;
} }
/* TODO We should possibly reassign lig_id and component for any
* components of a previous ligature that s now being removed as part of
* this ligature. */
} }
return true; return true;