summaryrefslogtreecommitdiff
path: root/source/pdf
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2016-02-10 18:08:23 +0100
committerTor Andersson <tor.andersson@artifex.com>2016-02-10 18:08:23 +0100
commita94ecea1aa6d3ce994782a7dd1d531728463186e (patch)
tree5e79e0ec68729fe7849cedb13ad277d97cc4b524 /source/pdf
parent0e91218ff89aee9a24d7cd577de37b0f1bb8331a (diff)
downloadmupdf-a94ecea1aa6d3ce994782a7dd1d531728463186e.tar.xz
Add bold/italic/monospaced/serif flags to fz_font.
Use the flags when selecting a fallback font.
Diffstat (limited to 'source/pdf')
-rw-r--r--source/pdf/pdf-font.c22
1 files changed, 9 insertions, 13 deletions
diff --git a/source/pdf/pdf-font.c b/source/pdf/pdf-font.c
index 41a4c279..2d8cf0bb 100644
--- a/source/pdf/pdf-font.c
+++ b/source/pdf/pdf-font.c
@@ -129,16 +129,6 @@ static int ft_kind(FT_Face face)
return UNKNOWN;
}
-static int ft_is_bold(FT_Face face)
-{
- return face->style_flags & FT_STYLE_FLAG_BOLD;
-}
-
-static int ft_is_italic(FT_Face face)
-{
- return face->style_flags & FT_STYLE_FLAG_ITALIC;
-}
-
static int ft_char_index(FT_Face face, int cid)
{
int gid = FT_Get_Char_Index(face, cid);
@@ -219,6 +209,7 @@ pdf_load_builtin_font(fz_context *ctx, pdf_font_desc *fontdesc, char *fontname,
fz_throw(ctx, FZ_ERROR_GENERIC, "cannot find builtin font: '%s'", fontname);
fontdesc->font = fz_new_font_from_memory(ctx, fontname, data, len, 0, 1);
+ fontdesc->font->is_serif = !!strstr(clean_name, "Times");
}
if (!strcmp(clean_name, "Symbol") || !strcmp(clean_name, "ZapfDingbats"))
@@ -243,8 +234,13 @@ pdf_load_substitute_font(fz_context *ctx, pdf_font_desc *fontdesc, char *fontnam
fz_throw(ctx, FZ_ERROR_GENERIC, "cannot find substitute font");
fontdesc->font = fz_new_font_from_memory(ctx, fontname, data, len, 0, 1);
- fontdesc->font->ft_bold = bold && !ft_is_bold(fontdesc->font->ft_face);
- fontdesc->font->ft_italic = italic && !ft_is_italic(fontdesc->font->ft_face);
+ fontdesc->font->fake_bold = bold && !fontdesc->font->is_bold;
+ fontdesc->font->fake_italic = italic && !fontdesc->font->is_italic;
+
+ fontdesc->font->is_mono = mono;
+ fontdesc->font->is_serif = serif;
+ fontdesc->font->is_bold = bold;
+ fontdesc->font->is_italic = italic;
}
fontdesc->font->ft_substitute = 1;
@@ -1189,7 +1185,7 @@ pdf_load_font_descriptor(fz_context *ctx, pdf_document *doc, pdf_font_desc *font
if (ft_kind(face) == TRUETYPE)
{
if (FT_IS_TRICKY(face) || is_dynalab(fontdesc->font->name))
- fontdesc->font->ft_hint = 1;
+ fontdesc->font->force_hinting = 1;
if (fontdesc->ascent == 0.0f)
fontdesc->ascent = 1000.0f * face->ascender / face->units_per_EM;