[GPOS] Fix MarkMarkPos applied to results of MultipleSubst

This was broken as a result of 7b84c536c1.
As Khaled reported, MarkMark positioning was broken with glyphs
resulting from a MultipleSubst.  Fixed.  Test with the ALLAH character
in Amiri.
This commit is contained in:
Behdad Esfahbod 2012-07-25 18:37:51 -04:00
parent 35bdab3cf1
commit a3313e5400
2 changed files with 26 additions and 7 deletions

View File

@ -1169,11 +1169,11 @@ struct MarkMarkPosFormat1
unsigned int j = skippy_iter.idx;
/* Two marks match only if they belong to the same base, or same component
* of the same ligature. That is, the component numbers must match, and
* if those are non-zero, the ligid number should also match. */
if ((get_lig_comp (c->buffer->info[j]) != get_lig_comp (c->buffer->cur())) ||
(get_lig_comp (c->buffer->info[j]) > 0 &&
get_lig_id (c->buffer->info[j]) != get_lig_id (c->buffer->cur())))
* of the same ligature. That is, the lig_id numbers must match, and
* if those are non-zero, the lig_comp number should also match. */
if ((get_lig_id (c->buffer->info[j]) != get_lig_id (c->buffer->cur())) ||
(get_lig_id (c->buffer->info[j]) > 0 &&
get_lig_comp (c->buffer->info[j]) != get_lig_comp (c->buffer->cur())))
return TRACE_RETURN (false);
unsigned int mark2_index = (this+mark2Coverage) (c->buffer->info[j].codepoint);

View File

@ -68,8 +68,27 @@ _hb_ot_layout_skip_mark (hb_face_t *face,
* GSUB/GPOS
*/
/* unique ligature id */
/* component number in the ligature (0 = base) */
/* lig_id / lig_comp
*
* When a ligature is formed:
*
* - The ligature glyph and any marks in between all get a unique lig_id,
* - The ligature glyph will get lig_comp = 0
* - The marks get lig_comp > 0, reflecting which component of the ligature
* they were applied to.
* - This is used in GPOS to attach marks to the right component of a ligature
* in MarkLigPos.
*
* When a multiple-substitution is done:
*
* - All resulting glyphs will have lig_id = 0,
* - The resulting glyphs will have lig_comp = 0, 1, 2, ... respectively.
* - This is used in GPOS to attack marks to the first component of a
* multiple substitution in MarkBasePos.
*
* The numbers are also used in GPOS to do mark-to-mark positioning only
* to marks that belong to the same component of a ligature in MarkMarPos.
*/
static inline void
set_lig_props (hb_glyph_info_t &info, unsigned int lig_id, unsigned int lig_comp)
{