summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2016-03-31 15:32:38 +0200
committerTor Andersson <tor.andersson@artifex.com>2016-04-04 16:52:03 +0200
commit9dc58cc827521b11d4eb8e2dd14e7e26bef74edb (patch)
treead52c29f6cab9c515552101084488a97f2424345 /source
parent86595de62c24b453913fcf4e63202276bc708a57 (diff)
downloadmupdf-9dc58cc827521b11d4eb8e2dd14e7e26bef74edb.tar.xz
epub: Add stripped Charis SIL font to use as the default font for EPUB.
Diffstat (limited to 'source')
-rw-r--r--source/fitz/noto.c12
-rw-r--r--source/html/html-font.c5
2 files changed, 16 insertions, 1 deletions
diff --git a/source/fitz/noto.c b/source/fitz/noto.c
index 1ac6e6c6..c428c324 100644
--- a/source/fitz/noto.c
+++ b/source/fitz/noto.c
@@ -4,6 +4,7 @@
Base 14 PDF fonts from URW.
Noto fonts from Google.
DroidSansFallback from Android for CJK.
+ Charis SIL from SIL.
Define TOFU to skip all the Noto fonts except CJK.
@@ -13,6 +14,7 @@
Define TOFU_EMOJI to skip emoji font.
Define TOFU_HISTORIC to skip ancient/historic scripts.
Define TOFU_SYMBOL to skip symbol font.
+ Define TOFU_SIL to skip the SIL fonts.
*/
#ifdef NOTO_SMALL
@@ -20,6 +22,7 @@
#define TOFU_EMOJI
#define TOFU_HISTORIC
#define TOFU_SYMBOL
+#define TOFU_SIL
#endif
#ifdef NOCJK
@@ -30,6 +33,7 @@
#define TOFU_EMOJI
#define TOFU_HISTORIC
#define TOFU_SYMBOL
+#define TOFU_SIL
#endif
#define RETURN(NAME) \
@@ -85,6 +89,14 @@ fz_lookup_builtin_font(fz_context *ctx, const char *name, int is_bold, int is_it
NimbusRomNo9L_Med_cff,
NimbusRomNo9L_MedIta_cff)
}
+#ifndef TOFU_SIL
+ if (!strcmp(name, "Charis SIL")) {
+ FAMILY(CharisSIL_R_cff,
+ CharisSIL_I_cff,
+ CharisSIL_B_cff,
+ CharisSIL_BI_cff)
+ }
+#endif
#ifndef TOFU
if (!strcmp(name, "Noto Serif")) {
RETURN(NotoSerif_Regular_ttf);
diff --git a/source/html/html-font.c b/source/html/html-font.c
index 389ddb34..3b8f7c72 100644
--- a/source/html/html-font.c
+++ b/source/html/html-font.c
@@ -5,7 +5,8 @@ fz_load_html_default_font(fz_context *ctx, fz_html_font_set *set, const char *fa
{
int is_mono = !strcmp(family, "monospace");
int is_sans = !strcmp(family, "sans-serif");
- const char *real_family = is_mono ? "Courier" : is_sans ? "Helvetica" : "Times";
+ const char *real_family = is_mono ? "Courier" : is_sans ? "Helvetica" : "Charis SIL";
+ const char *backup_family = is_mono ? "Courier" : is_sans ? "Helvetica" : "Times";
int idx = (is_mono ? 8 : is_sans ? 4 : 0) + is_bold * 2 + is_italic;
if (!set->fonts[idx])
{
@@ -14,6 +15,8 @@ fz_load_html_default_font(fz_context *ctx, fz_html_font_set *set, const char *fa
data = fz_lookup_builtin_font(ctx, real_family, is_bold, is_italic, &size);
if (!data)
+ data = fz_lookup_builtin_font(ctx, backup_family, is_bold, is_italic, &size);
+ if (!data)
fz_throw(ctx, FZ_ERROR_GENERIC, "cannot load html font: %s", real_family);
set->fonts[idx] = fz_new_font_from_memory(ctx, NULL, data, size, 0, 1);
set->fonts[idx]->is_serif = !is_sans;