Arabic mark width-zeroing regression

Mozilla Bug 873902 - Display Arabic text with diacritics is bad
https://bugzilla.mozilla.org/show_bug.cgi?id=873902
This commit is contained in:
Behdad Esfahbod 2013-05-20 09:11:35 -04:00
parent fa3d0a0ce6
commit 127daf15e0
6 changed files with 36 additions and 14 deletions

View File

@ -352,6 +352,6 @@ const hb_ot_complex_shaper_t _hb_ot_complex_shaper_arabic =
NULL, /* decompose */ NULL, /* decompose */
NULL, /* compose */ NULL, /* compose */
setup_masks_arabic, setup_masks_arabic,
HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF, HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_LATE,
true, /* fallback_position */ true, /* fallback_position */
}; };

View File

@ -215,6 +215,6 @@ const hb_ot_complex_shaper_t _hb_ot_complex_shaper_default =
NULL, /* decompose */ NULL, /* decompose */
compose_default, compose_default,
NULL, /* setup_masks */ NULL, /* setup_masks */
HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_UNICODE, HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_UNICODE_LATE,
true, /* fallback_position */ true, /* fallback_position */
}; };

View File

@ -540,6 +540,6 @@ const hb_ot_complex_shaper_t _hb_ot_complex_shaper_myanmar =
NULL, /* decompose */ NULL, /* decompose */
NULL, /* compose */ NULL, /* compose */
setup_masks_myanmar, setup_masks_myanmar,
HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF, HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_EARLY,
false, /* fallback_position */ false, /* fallback_position */
}; };

View File

@ -41,8 +41,10 @@
enum hb_ot_shape_zero_width_marks_type_t { enum hb_ot_shape_zero_width_marks_type_t {
HB_OT_SHAPE_ZERO_WIDTH_MARKS_NONE, HB_OT_SHAPE_ZERO_WIDTH_MARKS_NONE,
HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_UNICODE, // HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_UNICODE_EARLY,
HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_UNICODE_LATE,
HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_EARLY,
HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_LATE
}; };

View File

@ -373,6 +373,6 @@ const hb_ot_complex_shaper_t _hb_ot_complex_shaper_thai =
NULL, /* decompose */ NULL, /* decompose */
NULL, /* compose */ NULL, /* compose */
NULL, /* setup_masks */ NULL, /* setup_masks */
HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_UNICODE, HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_UNICODE_LATE,
false,/* fallback_position */ false,/* fallback_position */
}; };

View File

@ -419,11 +419,11 @@ hb_ot_position_default (hb_ot_shape_context_t *c)
} }
/* Zero'ing mark widths by GDEF (as used in Myanmar spec) happens
* *before* GPOS. */
switch (c->plan->shaper->zero_width_marks) switch (c->plan->shaper->zero_width_marks)
{ {
case HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF: /* Zero'ing mark widths by GDEF (as used in Myanmar spec) may happen
* *before* GPOS. */
case HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_EARLY:
for (unsigned int i = 0; i < count; i++) for (unsigned int i = 0; i < count; i++)
if ((c->buffer->info[i].glyph_props() & HB_OT_LAYOUT_GLYPH_PROPS_MARK)) if ((c->buffer->info[i].glyph_props() & HB_OT_LAYOUT_GLYPH_PROPS_MARK))
{ {
@ -432,9 +432,21 @@ hb_ot_position_default (hb_ot_shape_context_t *c)
} }
break; break;
/* Not currently used for any shaper:
case HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_UNICODE_EARLY:
for (unsigned int i = 0; i < count; i++)
if (_hb_glyph_info_get_general_category (&c->buffer->info[i]) == HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK)
{
c->buffer->pos[i].x_advance = 0;
c->buffer->pos[i].y_advance = 0;
}
break;
*/
default: default:
case HB_OT_SHAPE_ZERO_WIDTH_MARKS_NONE: case HB_OT_SHAPE_ZERO_WIDTH_MARKS_NONE:
case HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_UNICODE: case HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_UNICODE_LATE:
case HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_LATE:
break; break;
} }
} }
@ -468,11 +480,9 @@ hb_ot_position_complex (hb_ot_shape_context_t *c)
ret = true; ret = true;
} }
/* Zero'ing mark widths by Unicode happens
* *after* GPOS. */
switch (c->plan->shaper->zero_width_marks) switch (c->plan->shaper->zero_width_marks)
{ {
case HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_UNICODE: case HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_UNICODE_LATE:
for (unsigned int i = 0; i < count; i++) for (unsigned int i = 0; i < count; i++)
if (_hb_glyph_info_get_general_category (&c->buffer->info[i]) == HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK) if (_hb_glyph_info_get_general_category (&c->buffer->info[i]) == HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK)
{ {
@ -481,9 +491,19 @@ hb_ot_position_complex (hb_ot_shape_context_t *c)
} }
break; break;
case HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_LATE:
for (unsigned int i = 0; i < count; i++)
if ((c->buffer->info[i].glyph_props() & HB_OT_LAYOUT_GLYPH_PROPS_MARK))
{
c->buffer->pos[i].x_advance = 0;
c->buffer->pos[i].y_advance = 0;
}
break;
default: default:
case HB_OT_SHAPE_ZERO_WIDTH_MARKS_NONE: case HB_OT_SHAPE_ZERO_WIDTH_MARKS_NONE:
case HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF: //case HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_UNICODE_EARLY:
case HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_EARLY:
break; break;
} }