diff -ru mupdf-1.18.0-source-orig/include/mupdf/fitz/config.h mupdf-1.18.0-source/include/mupdf/fitz/config.h --- mupdf-1.18.0-source-orig/include/mupdf/fitz/config.h 2020-10-07 18:35:03.000000000 +0800 +++ mupdf-1.18.0-source/include/mupdf/fitz/config.h 2020-10-13 00:08:32.729025714 +0800 @@ -35,7 +35,7 @@ /** Choose whether to enable ICC color profiles. */ -/* #define FZ_ENABLE_ICC 1 */ +#define FZ_ENABLE_ICC 1 /** Choose whether to enable JPEG2000 decoding. @@ -61,7 +61,7 @@ unwanted fonts. */ /* To avoid all noto fonts except CJK, enable: */ -/* #define TOFU */ +#define TOFU // <=== PyMuPDF: not the complete NOTO! /* To skip the CJK font, enable: (this implicitly enables TOFU_CJK_EXT * and TOFU_CJK_LANG) */ @@ -69,22 +69,22 @@ /* To skip CJK Extension A, enable: (this implicitly enables * TOFU_CJK_LANG) */ -/* #define TOFU_CJK_EXT */ +#define TOFU_CJK_EXT // <=== PyMuPDF: causes 1.5 MB extra size /* To skip CJK language specific fonts, enable: */ -/* #define TOFU_CJK_LANG */ +#define TOFU_CJK_LANG // <=== PyMuPDF /* To skip the Emoji font, enable: */ -/* #define TOFU_EMOJI */ +#define TOFU_EMOJI // <=== PyMuPDF /* To skip the ancient/historic scripts, enable: */ -/* #define TOFU_HISTORIC */ +#define TOFU_HISTORIC // <=== PyMuPDF /* To skip the symbol font, enable: */ -/* #define TOFU_SYMBOL */ +#define TOFU_SYMBOL // <=== PyMuPDF /* To skip the SIL fonts, enable: */ -/* #define TOFU_SIL */ +// #define TOFU_SIL // <=== PyMuPDF: ok to have it, only small fonts /* To skip the Base14 fonts, enable: */ /* #define TOFU_BASE14 */ diff -ru mupdf-1.18.0-source-orig/source/pdf/pdf-font-add.c mupdf-1.18.0-source/source/pdf/pdf-font-add.c --- mupdf-1.18.0-source-orig/source/pdf/pdf-font-add.c 2020-10-07 18:35:03.000000000 +0800 +++ mupdf-1.18.0-source/source/pdf/pdf-font-add.c 2020-10-13 00:08:32.729025714 +0800 @@ -778,3 +778,20 @@ return fref; } +void jm_valid_chars(fz_context *ctx, fz_font *font, void *arr) +{ + FT_Face face = font->ft_face; + FT_ULong ucs; + FT_UInt gid; + long *table = (long *)arr; + fz_lock(ctx, FZ_LOCK_FREETYPE); + ucs = FT_Get_First_Char(face, &gid); + while (gid > 0) + { + if (gid < (FT_ULong)face->num_glyphs && face->num_glyphs > 0) + table[gid] = (long)ucs; + ucs = FT_Get_Next_Char(face, ucs, &gid); + } + fz_unlock(ctx, FZ_LOCK_FREETYPE); + return; +}