Handle singleton decompositions

This commit is contained in:
Behdad Esfahbod 2011-07-22 17:14:46 -04:00
parent 34c22f8168
commit dcdc51cdc0

View File

@ -72,26 +72,28 @@ decompose (hb_ot_shape_context_t *c,
hb_codepoint_t a, b, glyph; hb_codepoint_t a, b, glyph;
if (!hb_unicode_decompose (c->buffer->unicode, ab, &a, &b) || if (!hb_unicode_decompose (c->buffer->unicode, ab, &a, &b) ||
!hb_font_get_glyph (c->font, b, 0, &glyph)) (b && !hb_font_get_glyph (c->font, b, 0, &glyph)))
return FALSE; return FALSE;
/* XXX handle singleton decompositions */
bool has_a = hb_font_get_glyph (c->font, a, 0, &glyph); bool has_a = hb_font_get_glyph (c->font, a, 0, &glyph);
if (shortest && has_a) { if (shortest && has_a) {
/* Output a and b */ /* Output a and b */
c->buffer->output_glyph (a); c->buffer->output_glyph (a);
c->buffer->output_glyph (b); if (b)
c->buffer->output_glyph (b);
return TRUE; return TRUE;
} }
if (decompose (c, shortest, a)) { if (decompose (c, shortest, a)) {
c->buffer->output_glyph (b); if (b)
c->buffer->output_glyph (b);
return TRUE; return TRUE;
} }
if (has_a) { if (has_a) {
c->buffer->output_glyph (a); c->buffer->output_glyph (a);
c->buffer->output_glyph (b); if (b)
c->buffer->output_glyph (b);
return TRUE; return TRUE;
} }