Show U+FFFD REPLACEMENT CHARACTER for invalid Unicode codepoints
Only if the font doesn't support it. Ie, this gives the user to use non-Unicode codepoints as private values and return a meaningful glyph for them. But if it's invalid and font callback doesn't like it, and if font has U+FFFD, show that instead. Font functions that do not want this automatic replacement to happen should return true from get_glyph() if unicode > 0x10FFFF. Replaces https://github.com/behdad/harfbuzz/pull/27
This commit is contained in:
parent
6f13b6d62d
commit
efe74214bb
|
@ -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))
|
else if (decompose_compatibility (c, buffer->cur().codepoint))
|
||||||
skip_char (buffer);
|
skip_char (buffer);
|
||||||
else
|
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. */
|
next_char (buffer, glyph); /* glyph is initialized in earlier branches. */
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
|
|
Loading…
Reference in New Issue