Remove zero-width chars in the fallback shaper too

This commit is contained in:
Behdad Esfahbod 2012-06-08 10:53:35 -04:00
parent 68b76121f8
commit 6da9dbff21
1 changed files with 12 additions and 4 deletions

View File

@ -34,16 +34,24 @@ _hb_fallback_shape (hb_font_t *font,
const hb_feature_t *features HB_UNUSED, const hb_feature_t *features HB_UNUSED,
unsigned int num_features HB_UNUSED) unsigned int num_features HB_UNUSED)
{ {
/* TODO Save the space character in the font? */
hb_codepoint_t space;
hb_font_get_glyph (font, ' ', 0, &space);
buffer->guess_properties (); buffer->guess_properties ();
buffer->clear_positions ();
unsigned int count = buffer->len; unsigned int count = buffer->len;
for (unsigned int i = 0; i < count; i++) for (unsigned int i = 0; i < count; i++)
{
if (_hb_unicode_is_zero_width (buffer->info[i].codepoint)) {
buffer->info[i].codepoint = space;
buffer->pos[i].x_advance = 0;
buffer->pos[i].y_advance = 0;
continue;
}
hb_font_get_glyph (font, buffer->info[i].codepoint, 0, &buffer->info[i].codepoint); hb_font_get_glyph (font, buffer->info[i].codepoint, 0, &buffer->info[i].codepoint);
buffer->clear_positions ();
for (unsigned int i = 0; i < count; i++) {
hb_font_get_glyph_advance_for_direction (font, buffer->info[i].codepoint, hb_font_get_glyph_advance_for_direction (font, buffer->info[i].codepoint,
buffer->props.direction, buffer->props.direction,
&buffer->pos[i].x_advance, &buffer->pos[i].x_advance,