summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2018-04-18 13:53:15 +0200
committerTor Andersson <tor.andersson@artifex.com>2018-04-25 12:26:33 +0200
commit868aaca9ccbfa4b3014959c04854d0451768a92f (patch)
treec17b73faedfbb1716395d872983fb89f4bdd622d /source
parent26697653468e91d609896eadfe95bb3027eadd5b (diff)
downloadmupdf-868aaca9ccbfa4b3014959c04854d0451768a92f.tar.xz
Try other CJK languages to find missing characters.
Diffstat (limited to 'source')
-rw-r--r--source/fitz/font.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/source/fitz/font.c b/source/fitz/font.c
index de69ff9c..6e7e0063 100644
--- a/source/fitz/font.c
+++ b/source/fitz/font.c
@@ -1644,6 +1644,40 @@ fz_encode_character_with_fallback(fz_context *ctx, fz_font *user_font, int unico
return *out_font = font, gid;
}
+#ifndef TOFU_CJK_LANG
+ if (script == UCDN_SCRIPT_HAN)
+ {
+ font = fz_load_fallback_font(ctx, script, FZ_LANG_ja, user_font->flags.is_serif, user_font->flags.is_bold, user_font->flags.is_italic);
+ if (font)
+ {
+ gid = fz_encode_character(ctx, font, unicode);
+ if (gid > 0)
+ return *out_font = font, gid;
+ }
+ font = fz_load_fallback_font(ctx, script, FZ_LANG_ko, user_font->flags.is_serif, user_font->flags.is_bold, user_font->flags.is_italic);
+ if (font)
+ {
+ gid = fz_encode_character(ctx, font, unicode);
+ if (gid > 0)
+ return *out_font = font, gid;
+ }
+ font = fz_load_fallback_font(ctx, script, FZ_LANG_zh_Hant, user_font->flags.is_serif, user_font->flags.is_bold, user_font->flags.is_italic);
+ if (font)
+ {
+ gid = fz_encode_character(ctx, font, unicode);
+ if (gid > 0)
+ return *out_font = font, gid;
+ }
+ font = fz_load_fallback_font(ctx, script, FZ_LANG_zh_Hans, user_font->flags.is_serif, user_font->flags.is_bold, user_font->flags.is_italic);
+ if (font)
+ {
+ gid = fz_encode_character(ctx, font, unicode);
+ if (gid > 0)
+ return *out_font = font, gid;
+ }
+ }
+#endif
+
font = fz_load_fallback_symbol_font(ctx);
if (font)
{