summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@behdad.org>2009-11-22 18:23:35 -0500
committerBehdad Esfahbod <behdad@behdad.org>2009-11-22 18:23:35 -0500
commit40bade07f999a0535e0cbc8c2afe45d44e92a663 (patch)
treed47edbd44a154a461d1b33c645be70c143e1073b
parent29010456474a512c4193f2fec583c2723f3e2806 (diff)
downloadpango-40bade07f999a0535e0cbc8c2afe45d44e92a663.tar.gz
Fix MarkMark issue with ligid and components
Cherry-picked from harfbuzz-ng repo.
-rw-r--r--pango/opentype/hb-ot-layout-gpos-private.hh11
-rw-r--r--pango/opentype/hb-ot-layout-gsub-private.hh6
2 files changed, 7 insertions, 10 deletions
diff --git a/pango/opentype/hb-ot-layout-gpos-private.hh b/pango/opentype/hb-ot-layout-gpos-private.hh
index 2ab079f9..81b7fa15 100644
--- a/pango/opentype/hb-ot-layout-gpos-private.hh
+++ b/pango/opentype/hb-ot-layout-gpos-private.hh
@@ -1080,9 +1080,9 @@ struct MarkLigPosFormat1
* 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
* 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)
comp_index = comp_count - 1;
}
@@ -1179,9 +1179,10 @@ struct MarkMarkPosFormat1
return false;
/* Two marks match only if they belong to the same base, or same component
- * of the same ligature. */
- if (IN_LIGID (j) != IN_LIGID (buffer->in_pos) ||
- IN_COMPONENT (j) != IN_COMPONENT (buffer->in_pos))
+ * of the same ligature. That is, the component numbers must match, and
+ * if those are non-zero, the ligid number should also match. */
+ if ((IN_COMPONENT (j) != IN_COMPONENT (buffer->in_pos)) ||
+ (IN_COMPONENT (j) && IN_LIGID (j) != IN_LIGID (buffer->in_pos)))
return false;
unsigned int mark2_index = (this+mark2Coverage) (IN_GLYPH (j));
diff --git a/pango/opentype/hb-ot-layout-gsub-private.hh b/pango/opentype/hb-ot-layout-gsub-private.hh
index dde1cf5a..75ca150b 100644
--- a/pango/opentype/hb-ot-layout-gsub-private.hh
+++ b/pango/opentype/hb-ot-layout-gsub-private.hh
@@ -406,14 +406,10 @@ struct Ligature
for ( i = 1; i < count; i++ )
{
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)++;
}
-
- /* 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;