diff --git a/src/hb-ot-shape-normalize.cc b/src/hb-ot-shape-normalize.cc index 2a6a43900..0d2f8f57c 100644 --- a/src/hb-ot-shape-normalize.cc +++ b/src/hb-ot-shape-normalize.cc @@ -209,7 +209,14 @@ decompose_current_character (const hb_ot_shape_normalize_context_t *c, bool shor else if (decompose_compatibility (c, buffer->cur().codepoint)) skip_char (buffer); else + { + /* Not found, not decomposible; If codepoint is invalid Unicode and + * font supports U+FFFD REPLACEMENT CHARACTER, use that instead. */ + hb_codepoint_t FFFD_glyph; + if (buffer->cur().codepoint > 0x10FFFF && c->font->get_glyph (0xFFFD, 0, &FFFD_glyph)) + glyph = FFFD_glyph; next_char (buffer, glyph); /* glyph is initialized in earlier branches. */ + } } static inline void