[GSUB] Further adjustments to mark-attachment vs ligation interaction

The d1d69ec52e change broke Kannada badly,
since it was ligating consonants, pushing matra out, and then ligating
with the matra.  Adjust for that.  See comments.
This commit is contained in:
Behdad Esfahbod 2012-07-30 01:46:34 -04:00
parent 0aef425e25
commit a973b5ce86
2 changed files with 9 additions and 3 deletions

View File

@ -522,7 +522,11 @@ struct Ligature
* - Ligatures cannot be formed across glyphs attached to different components * - Ligatures cannot be formed across glyphs attached to different components
* of previous ligatures. Eg. the sequence is LAM,SHADDA,LAM,FATHA,HEH, and * of previous ligatures. Eg. the sequence is LAM,SHADDA,LAM,FATHA,HEH, and
* LAM,LAM,HEH form a ligature, leaving SHADDA,FATHA next to eachother. * LAM,LAM,HEH form a ligature, leaving SHADDA,FATHA next to eachother.
* However, it would be wrong to ligate that SHADDA,FATHA sequence. * However, it would be wrong to ligate that SHADDA,FATHA sequence.o
* There is an exception to this: If a ligature tries ligating with marks that
* belong to it itself, go ahead, assuming that the font designer knows what
* they are doing (otherwise it can break Indic stuff when a matra wants to
* ligate with a conjunct...)
*/ */
bool is_mark_ligature = !!(c->property & HB_OT_LAYOUT_GLYPH_CLASS_MARK); bool is_mark_ligature = !!(c->property & HB_OT_LAYOUT_GLYPH_CLASS_MARK);
@ -543,6 +547,7 @@ struct Ligature
unsigned int this_lig_id = get_lig_id (c->buffer->info[skippy_iter.idx]); unsigned int this_lig_id = get_lig_id (c->buffer->info[skippy_iter.idx]);
unsigned int this_lig_comp = get_lig_comp (c->buffer->info[skippy_iter.idx]); unsigned int this_lig_comp = get_lig_comp (c->buffer->info[skippy_iter.idx]);
if (first_lig_id && first_lig_comp) { if (first_lig_id && first_lig_comp) {
/* If first component was attached to a previous ligature component, /* If first component was attached to a previous ligature component,
* all subsequent components should be attached to the same ligature * all subsequent components should be attached to the same ligature
@ -552,8 +557,8 @@ struct Ligature
} else { } else {
/* If first component was NOT attached to a previous ligature component, /* If first component was NOT attached to a previous ligature component,
* all subsequent components should also NOT be attached to any ligature * all subsequent components should also NOT be attached to any ligature
* component, otherwise we shouldn't ligate them. */ * component, unless they are attached to the first component itself! */
if (this_lig_id && this_lig_comp) if (this_lig_id && this_lig_comp && (this_lig_id != first_lig_id))
return TRACE_RETURN (false); return TRACE_RETURN (false);
} }

View File

@ -16,3 +16,4 @@
ಕೈ ಕೈ
ಕೋ ಕೋ
ಕ್ಷ ಕ್ಷ
ಕ್ಷಿ