From e8a1504407311ce0269926797671951fa55b4134 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Tue, 25 Oct 2016 13:21:37 +0200 Subject: Fix 697215: Script specific punctuation blocks. Ideographic and full-width punctuation inherit the script from the surroundings, like all other punctuation. This does not play well with our fallback font lookups. Add special cases for ideographic and fullwidth unicode blocks. --- source/fitz/font.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/source/fitz/font.c b/source/fitz/font.c index 14c79aa9..7142414e 100644 --- a/source/fitz/font.c +++ b/source/fitz/font.c @@ -1525,6 +1525,16 @@ fz_encode_character_with_fallback(fz_context *ctx, fz_font *user_font, int unico if (script == 0) script = ucdn_get_script(unicode); + /* Fix for ideographic/halfwidth/fullwidth punctuation forms. */ + if ((unicode >= 0x3000 && unicode <= 0x303F) || (unicode >= 0xFF00 && unicode <= 0xFFEF)) + { + if (script != UCDN_SCRIPT_HANGUL && + script != UCDN_SCRIPT_HIRAGANA && + script != UCDN_SCRIPT_KATAKANA && + script != UCDN_SCRIPT_BOPOMOFO) + script = UCDN_SCRIPT_HAN; + } + font = fz_load_fallback_font(ctx, script, language, user_font->flags.is_serif, user_font->flags.is_bold, user_font->flags.is_italic); if (font) { -- cgit v1.2.3