diff --git a/Makefile b/Makefile index 62fbc07da..6cdff35fd 100644 --- a/Makefile +++ b/Makefile @@ -188,7 +188,7 @@ lfs.o: $(LFSDIR)/src/lfs.c fetchthirdparty: rm -rf mupdf/thirdparty - test -d mupdf && (cd mupdf; git checkout .) || echo warn: mupdf folder not found + test -d mupdf && (cd mupdf; git checkout .; cd thirdparty; git submodule init; git submodule update) || echo warn: mupdf folder not found test -d $(LUADIR) && (cd $(LUADIR); git checkout .) || echo warn: $(LUADIR) folder not found git submodule init git submodule update diff --git a/mupdf b/mupdf index bdb6b688a..dd4f6ffd4 160000 --- a/mupdf +++ b/mupdf @@ -1 +1 @@ -Subproject commit bdb6b688a238df56b2cf47fa17a08a4dd4b7a122 +Subproject commit dd4f6ffd475b0e769ba6231cf24b050bcdc97814 diff --git a/mupdf.patch b/mupdf.patch index 348190f95..e6bf72bb1 100644 --- a/mupdf.patch +++ b/mupdf.patch @@ -1,62 +1,60 @@ diff --git a/pdf/pdf_font.c b/pdf/pdf_font.c -index 5e54e0b..38bd1d8 100644 +index 33a1a65..c2fdee3 100644 --- a/pdf/pdf_font.c +++ b/pdf/pdf_font.c -@@ -182,8 +182,13 @@ pdf_load_builtin_font(fz_context *ctx, pdf_font_desc *fontdesc, char *fontname) +@@ -185,7 +185,12 @@ pdf_load_builtin_font(fz_context *ctx, pdf_font_desc *fontdesc, char *fontname) if (!data) fz_throw(ctx, "cannot find builtin font: '%s'", fontname); - + +#ifndef NOBUILTINFONT - fontdesc->font = fz_new_font_from_memory(ctx, data, len, 0, 1); - /* RJW: "cannot load freetype font from memory" */ + fontdesc->font = fz_new_font_from_memory(ctx, fontname, data, len, 0, 1); +#else -+ fontdesc->font = fz_new_font_from_file(ctx, data, 0, 1); ++ fontdesc->font = fz_new_font_from_file(ctx, fontname, data, 0, 1); + free(data); +#endif - + if (!strcmp(fontname, "Symbol") || !strcmp(fontname, "ZapfDingbats")) fontdesc->flags |= PDF_FD_SYMBOLIC; -@@ -199,8 +204,13 @@ pdf_load_substitute_font(fz_context *ctx, pdf_font_desc *fontdesc, int mono, int +@@ -201,7 +206,12 @@ pdf_load_substitute_font(fz_context *ctx, pdf_font_desc *fontdesc, char *fontnam if (!data) fz_throw(ctx, "cannot find substitute font"); - + +#ifndef NOBUILTINFONT - fontdesc->font = fz_new_font_from_memory(ctx, data, len, 0, 1); - /* RJW: "cannot load freetype font from memory" */ + fontdesc->font = fz_new_font_from_memory(ctx, fontname, data, len, 0, 1); +#else -+ fontdesc->font = fz_new_font_from_file(ctx, data, 0, 1); ++ fontdesc->font = fz_new_font_from_file(ctx, fontname, data, 0, 1); + free(data); +#endif - + fontdesc->font->ft_substitute = 1; fontdesc->font->ft_bold = bold && !ft_is_bold(fontdesc->font->ft_face); -@@ -218,7 +228,12 @@ pdf_load_substitute_cjk_font(fz_context *ctx, pdf_font_desc *fontdesc, int ros, +@@ -219,7 +229,12 @@ pdf_load_substitute_cjk_font(fz_context *ctx, pdf_font_desc *fontdesc, char *fon fz_throw(ctx, "cannot find builtin CJK font"); - + /* a glyph bbox cache is too big for droid sans fallback (51k glyphs!) */ +#ifndef NOBUILTINFONT - fontdesc->font = fz_new_font_from_memory(ctx, data, len, 0, 0); + fontdesc->font = fz_new_font_from_memory(ctx, fontname, data, len, 0, 0); +#else -+ fontdesc->font = fz_new_font_from_file(ctx, data, 0, 0); ++ fontdesc->font = fz_new_font_from_file(ctx, fontname, data, 0, 1); + free(data); +#endif - /* RJW: "cannot load builtin CJK font" */ - + fontdesc->font->ft_substitute = 1; + } diff --git a/pdf/pdf_fontfile.c b/pdf/pdf_fontfile.c -index 543ce76..a076033 100644 +index 99565da..a91380f 100644 --- a/pdf/pdf_fontfile.c +++ b/pdf/pdf_fontfile.c -@@ -1,6 +1,8 @@ - #include "fitz.h" - #include "mupdf.h" - +@@ -15,6 +15,8 @@ + Set NODROIDFONT to use the base 14 fonts as substitute fonts. + */ + +#ifndef NOBUILTINFONT + #ifdef NOCJK #define NOCJKFONT #endif -@@ -129,3 +131,112 @@ pdf_find_substitute_cjk_font(int ros, int serif, unsigned int *len) +@@ -152,3 +154,112 @@ pdf_lookup_substitute_cjk_font(int ros, int serif, unsigned int *len) return NULL; #endif }