Flip logic around

This commit is contained in:
Behdad Esfahbod 2012-04-07 14:49:13 -04:00
parent aaa25d5f45
commit e02d925786
1 changed files with 13 additions and 25 deletions

View File

@ -198,17 +198,6 @@ _hb_ot_shape_normalize (hb_font_t *font, hb_buffer_t *buffer,
buffer->swap_buffers (); buffer->swap_buffers ();
/* Technically speaking, two characters with ccc=0 may combine. But all
* those cases are in languages that the indic module handles (which expects
* decomposed), or in Hangul jamo, which again, we want decomposed anyway.
* So we don't bother combining across cluster boundaries. This is a huge
* performance saver if the compose() callback is slow.
*
* TODO: Am I right about Hangul? If I am, we should add a Hangul module
* that requests decomposed. If for Hangul we end up wanting composed, we
* can do that in the Hangul module.
*/
if (!has_multichar_clusters) if (!has_multichar_clusters)
return; /* Done! */ return; /* Done! */
@ -261,24 +250,23 @@ _hb_ot_shape_normalize (hb_font_t *font, hb_buffer_t *buffer,
} }
hb_codepoint_t composed, glyph; hb_codepoint_t composed, glyph;
if ((buffer->out_info[buffer->out_len - 1].combining_class() >= if ((buffer->out_info[buffer->out_len - 1].combining_class() < buffer->info[buffer->idx].combining_class()) &&
buffer->info[buffer->idx].combining_class()) || hb_unicode_compose (buffer->unicode,
!hb_unicode_compose (buffer->unicode, buffer->out_info[starter].codepoint,
buffer->out_info[starter].codepoint, buffer->info[buffer->idx].codepoint,
buffer->info[buffer->idx].codepoint, &composed) &&
&composed) || hb_font_get_glyph (font, composed, 0, &glyph))
!hb_font_get_glyph (font, composed, 0, &glyph))
{ {
/* Blocked, or doesn't compose. */ /* Composes. Modify starter and carry on. */
buffer->next_glyph (); buffer->out_info[starter].codepoint = composed;
hb_glyph_info_set_unicode_props (&buffer->out_info[starter], buffer->unicode);
buffer->skip_glyph ();
continue; continue;
} }
/* Composes. Modify starter and carry on. */ /* Blocked, or doesn't compose. */
buffer->out_info[starter].codepoint = composed; buffer->next_glyph ();
hb_glyph_info_set_unicode_props (&buffer->out_info[starter], buffer->unicode);
buffer->skip_glyph ();
} }
buffer->swap_buffers (); buffer->swap_buffers ();