summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2017-01-23 14:58:20 +0100
committerTor Andersson <tor.andersson@artifex.com>2017-01-23 14:58:25 +0100
commit35b2aeef91fdd062f54beba302726c9ea279114e (patch)
treecb2aef64a601fdbb09f96a2e7f283a0681553a77
parent13788c56859fcd8a8e4999d7553a0864c0176a10 (diff)
downloadmupdf-35b2aeef91fdd062f54beba302726c9ea279114e.tar.xz
Fix fallback system callback for serif fonts.
-rw-r--r--source/fitz/font.c32
1 files changed, 12 insertions, 20 deletions
diff --git a/source/fitz/font.c b/source/fitz/font.c
index cdab6081..9a594cff 100644
--- a/source/fitz/font.c
+++ b/source/fitz/font.c
@@ -310,7 +310,7 @@ fz_font *fz_load_system_fallback_font(fz_context *ctx, int script, int language,
fz_font *fz_load_fallback_font(fz_context *ctx, int script, int language, int serif, int bold, int italic)
{
- fz_font *font;
+ fz_font **fontp;
const char *data;
int index;
int size;
@@ -338,30 +338,22 @@ fz_font *fz_load_fallback_font(fz_context *ctx, int script, int language, int se
}
if (serif)
+ fontp = &ctx->font->fallback[index].serif;
+ else
+ fontp = &ctx->font->fallback[index].sans;
+
+ if (!*fontp)
{
- if (ctx->font->fallback[index].serif)
- return ctx->font->fallback[index].serif;
- data = fz_lookup_noto_font(ctx, script, language, 1, &size);
- if (data)
+ *fontp = fz_load_system_fallback_font(ctx, script, language, serif, bold, italic);
+ if (!*fontp)
{
- ctx->font->fallback[index].serif = fz_new_font_from_memory(ctx, NULL, data, size, 0, 0);
- return ctx->font->fallback[index].serif;
+ data = fz_lookup_noto_font(ctx, script, language, 0, &size);
+ if (data)
+ *fontp = fz_new_font_from_memory(ctx, NULL, data, size, 0, 0);
}
}
- if (ctx->font->fallback[index].sans)
- return ctx->font->fallback[index].sans;
-
- font = fz_load_system_fallback_font(ctx, script, language, serif, bold, italic);
- if (!font)
- {
- data = fz_lookup_noto_font(ctx, script, language, 0, &size);
- if (data)
- font = fz_new_font_from_memory(ctx, NULL, data, size, 0, 0);
- }
- if (font)
- ctx->font->fallback[index].sans = font;
- return font;
+ return *fontp;
}
fz_font *fz_load_fallback_symbol_font(fz_context *ctx)