summaryrefslogtreecommitdiff
path: root/include/mupdf/fitz/font.h
diff options
context:
space:
mode:
authorSimon Bünzli <zeniko@gmail.com>2013-12-20 00:21:53 +0100
committerRobin Watts <robin.watts@artifex.com>2014-01-13 17:22:03 +0000
commit056a8de560419eedaf097703893c798284ebb0a2 (patch)
tree8313aee783ea9aaa55baa8eaac147ff061a5191e /include/mupdf/fitz/font.h
parent51d9a5673e367f03677d9ec684ec0e79fe445dd1 (diff)
downloadmupdf-056a8de560419eedaf097703893c798284ebb0a2.tar.xz
Bug 694851: enhance fz_load_system_font
For SumatraPDF, the following changes are required: * fz_load_system_font is called from pdf_load_builtin_font as well so that Arial, Courier New, etc. can be loaded from the system instead of their Nimbus replacements. In order to distinguish between calls from pdf_load_builtin_font and pdf_load_substitute_font, an is_substitute argument is added. * fz_load_system_cjk_font is added and called from pdf_load_substitute_cjk_font so that a better replacement font can be loaded instead of DroidSansFallback. * Both fz_load_system_font and fz_load_system_cjk_font return fz_font* instead of fz_buffer* so that implementers aren't required to load fonts into memory (SumatraPDF uses fz_new_font_from_file for system fonts). In addition to that, fz_load_system_font_func is renamed to fz_load_system_font_funcs since it now accepts two functions, and the PDF_ROS_* constants are renamed to FZ_ADOBE_* (collection names aren't passed as const char* so that implementers know which collections to expect). For convenience, fz_load_*_font also never throws since currently all callers have further fallbacks available.
Diffstat (limited to 'include/mupdf/fitz/font.h')
-rw-r--r--include/mupdf/fitz/font.h12
1 files changed, 9 insertions, 3 deletions
diff --git a/include/mupdf/fitz/font.h b/include/mupdf/fitz/font.h
index ffba996c..c5e72f05 100644
--- a/include/mupdf/fitz/font.h
+++ b/include/mupdf/fitz/font.h
@@ -61,13 +61,19 @@ struct fz_font_s
int *width_table; /* in 1000 units */
};
+/* common CJK font collections */
+enum { FZ_ADOBE_CNS_1, FZ_ADOBE_GB_1, FZ_ADOBE_JAPAN_1, FZ_ADOBE_KOREA_1 };
+
void fz_new_font_context(fz_context *ctx);
fz_font_context *fz_keep_font_context(fz_context *ctx);
void fz_drop_font_context(fz_context *ctx);
-typedef fz_buffer *(*fz_load_system_font_func)(fz_context *ctx, const char *name);
-void fz_install_load_system_font_func(fz_context *ctx, fz_load_system_font_func f);
-fz_buffer *fz_load_system_font(fz_context *ctx, const char *name);
+typedef fz_font *(*fz_load_system_font_func)(fz_context *ctx, const char *name, int is_substitute);
+typedef fz_font *(*fz_load_system_cjk_font_func)(fz_context *ctx, const char *name, int ros, int serif);
+void fz_install_load_system_font_funcs(fz_context *ctx, fz_load_system_font_func f, fz_load_system_cjk_font_func f_cjk);
+/* fz_load_*_font returns NULL if no font could be loaded (also on error) */
+fz_font *fz_load_system_font(fz_context *ctx, const char *name, int is_substitute);
+fz_font *fz_load_system_cjk_font(fz_context *ctx, const char *name, int ros, int serif);
fz_font *fz_new_type3_font(fz_context *ctx, const char *name, const fz_matrix *matrix);