summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2014-07-16 17:07:19 +0200
committerTor Andersson <tor.andersson@artifex.com>2014-07-17 16:17:51 +0200
commit2a1a79c623636c8cf47a96ca8424174a9283aa10 (patch)
treee7f0266154c0481f754240a5906b3b8b7ee79d58
parentc10b594931c53b9989184b44a12d9acc1f28deb6 (diff)
downloadmupdf-2a1a79c623636c8cf47a96ca8424174a9283aa10.tar.xz
Improve callback for loading substitute CJK fonts to return TTC index.
-rw-r--r--include/mupdf/pdf/font.h2
-rw-r--r--source/pdf/pdf-font.c8
-rw-r--r--source/pdf/pdf-fontfile.c4
3 files changed, 8 insertions, 6 deletions
diff --git a/include/mupdf/pdf/font.h b/include/mupdf/pdf/font.h
index 73075a7c..c1576483 100644
--- a/include/mupdf/pdf/font.h
+++ b/include/mupdf/pdf/font.h
@@ -105,7 +105,7 @@ int pdf_font_cid_to_gid(fz_context *ctx, pdf_font_desc *fontdesc, int cid);
unsigned char *pdf_lookup_builtin_font(const char *name, unsigned int *len);
unsigned char *pdf_lookup_substitute_font(int mono, int serif, int bold, int italic, unsigned int *len);
-unsigned char *pdf_lookup_substitute_cjk_font(int ros, int serif, unsigned int *len);
+unsigned char *pdf_lookup_substitute_cjk_font(int ros, int serif, int wmode, unsigned int *len, int *index);
pdf_font_desc *pdf_load_type3_font(pdf_document *doc, pdf_obj *rdb, pdf_obj *obj);
void pdf_load_type3_glyphs(pdf_document *doc, pdf_font_desc *fontdesc, int nestedDepth);
diff --git a/source/pdf/pdf-font.c b/source/pdf/pdf-font.c
index c6dc7123..5ac722f0 100644
--- a/source/pdf/pdf-font.c
+++ b/source/pdf/pdf-font.c
@@ -228,14 +228,14 @@ pdf_load_substitute_cjk_font(fz_context *ctx, pdf_font_desc *fontdesc, char *fon
{
unsigned char *data;
unsigned int len;
+ int index;
- data = pdf_lookup_substitute_cjk_font(ros, serif, &len);
+ data = pdf_lookup_substitute_cjk_font(ros, serif, fontdesc->wmode, &len, &index);
if (!data)
fz_throw(ctx, FZ_ERROR_GENERIC, "cannot find builtin CJK font");
- /* The DroidSansFallback fonts have both H and V variants in the TTC */
- /* A glyph bbox cache is too big for DroidSansFallback (51k glyphs!) */
- fontdesc->font = fz_new_font_from_memory(ctx, fontname, data, len, fontdesc->wmode, 0);
+ /* A glyph bbox cache is too big for CJK fonts. */
+ fontdesc->font = fz_new_font_from_memory(ctx, fontname, data, len, index, 0);
}
fontdesc->font->ft_substitute = 1;
diff --git a/source/pdf/pdf-fontfile.c b/source/pdf/pdf-fontfile.c
index 2e33768d..f0787bc6 100644
--- a/source/pdf/pdf-fontfile.c
+++ b/source/pdf/pdf-fontfile.c
@@ -136,13 +136,15 @@ pdf_lookup_substitute_font(int mono, int serif, int bold, int italic, unsigned i
}
unsigned char *
-pdf_lookup_substitute_cjk_font(int ros, int serif, unsigned int *len)
+pdf_lookup_substitute_cjk_font(int ros, int serif, int wmode, unsigned int *len, int *index)
{
#ifndef NOCJKFONT
#ifndef NOCJKFULL
+ *index = wmode;
*len = sizeof pdf_font_DroidSansFallbackFull;
return (unsigned char*) pdf_font_DroidSansFallbackFull;
#else
+ *index = wmode;
*len = sizeof pdf_font_DroidSansFallback;
return (unsigned char*) pdf_font_DroidSansFallback;
#endif