From 4a1e02ef7979d58fe0c726ee7c665b2420c42ddd Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 11 Apr 2012 14:37:53 -0400 Subject: [PATCH] Fix shape to presentation forms font check As reported by Jonathan Kew on the list. --- src/hb-ot-shape-complex-arabic.cc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/hb-ot-shape-complex-arabic.cc b/src/hb-ot-shape-complex-arabic.cc index 4b6f54d..a56d161 100644 --- a/src/hb-ot-shape-complex-arabic.cc +++ b/src/hb-ot-shape-complex-arabic.cc @@ -211,9 +211,12 @@ arabic_fallback_shape (hb_font_t *font, hb_buffer_t *buffer) hb_codepoint_t glyph; /* Shape to presentation forms */ - for (unsigned int i = 0; i < count; i++) - if (hb_font_get_glyph (font, buffer->info[i].codepoint, 0, &glyph)) - buffer->info[i].codepoint = get_arabic_shape (buffer->info[i].codepoint, buffer->info[i].arabic_shaping_action()); + for (unsigned int i = 0; i < count; i++) { + hb_codepoint_t u = buffer->info[i].codepoint; + hb_codepoint_t shaped = get_arabic_shape (u, buffer->info[i].arabic_shaping_action()); + if (shaped != u && hb_font_get_glyph (font, shaped, 0, &glyph)) + buffer->info[i].codepoint = shaped; + } /* Mandatory ligatures */ buffer->clear_output (); -- 2.7.4