summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2012-06-28 14:56:57 +0200
committerTor Andersson <tor.andersson@artifex.com>2012-06-28 15:29:04 +0200
commit293c530bfd409cc2db927bb64d4a3bf48cf76563 (patch)
tree398fd8ad342fe8783350e3167fd27140e72dacef
parent8c7278a14fb76140ba0a79f00f1f40aea6f2d568 (diff)
downloadmupdf-293c530bfd409cc2db927bb64d4a3bf48cf76563.tar.xz
Allow for windows style synthetic font selectors of built-in fonts.
For example "Symbol,Italic" can be handled as an artificially obliqued "Symbol". Fixes an issue in test file normal_161.pdf
-rw-r--r--pdf/pdf_font.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/pdf/pdf_font.c b/pdf/pdf_font.c
index 9e4e60ea..7ebb8ed6 100644
--- a/pdf/pdf_font.c
+++ b/pdf/pdf_font.c
@@ -175,9 +175,19 @@ static int lookup_mre_code(char *name)
static void
pdf_load_builtin_font(fz_context *ctx, pdf_font_desc *fontdesc, char *fontname)
{
+ char buf[256], *comma = NULL;
unsigned char *data;
unsigned int len;
+ if (strchr(fontname, ','))
+ {
+ fz_strlcpy(buf, fontname, sizeof buf);
+ comma = strchr(buf, ',');
+ if (comma)
+ *comma++ = 0;
+ fontname = buf;
+ }
+
data = pdf_lookup_builtin_font(fontname, &len);
if (!data)
fz_throw(ctx, "cannot find builtin font: '%s'", fontname);
@@ -187,6 +197,14 @@ pdf_load_builtin_font(fz_context *ctx, pdf_font_desc *fontdesc, char *fontname)
if (!strcmp(fontname, "Symbol") || !strcmp(fontname, "ZapfDingbats"))
fontdesc->flags |= PDF_FD_SYMBOLIC;
+
+ if (comma)
+ {
+ if (strstr(comma, "Italic"))
+ fontdesc->font->ft_italic = 1;
+ if (strstr(comma, "Bold"))
+ fontdesc->font->ft_bold = 1;
+ }
}
static void