summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2015-10-02 14:19:52 +0200
committerRobin Watts <robin.watts@artifex.com>2015-10-02 16:36:35 +0100
commit8114f2b816e15d0cf98811fd37e80d24d00962a0 (patch)
tree35f4330cd5090daf2c6ea05f75bd124744a16061
parent903a9154f80ccf8d4badb7102d60a3c543896c5c (diff)
downloadmupdf-8114f2b816e15d0cf98811fd37e80d24d00962a0.tar.xz
Don't stretch CJK substitute fonts.
-rw-r--r--include/mupdf/fitz/font.h1
-rw-r--r--source/fitz/font.c2
-rw-r--r--source/pdf/pdf-font.c2
3 files changed, 4 insertions, 1 deletions
diff --git a/include/mupdf/fitz/font.h b/include/mupdf/fitz/font.h
index 32d76110..e912eb75 100644
--- a/include/mupdf/fitz/font.h
+++ b/include/mupdf/fitz/font.h
@@ -31,6 +31,7 @@ struct fz_font_s
void *ft_face; /* has an FT_Face if used */
int ft_substitute; /* ... substitute metrics */
+ int ft_stretch; /* ... and stretch to match PDF metrics */
int ft_bold; /* ... synthesize bold */
int ft_italic; /* ... synthesize italic */
int ft_hint; /* ... force hinting for DynaLab fonts */
diff --git a/source/fitz/font.c b/source/fitz/font.c
index 387e3617..e705c229 100644
--- a/source/fitz/font.c
+++ b/source/fitz/font.c
@@ -410,7 +410,7 @@ static fz_matrix *
fz_adjust_ft_glyph_width(fz_context *ctx, fz_font *font, int gid, fz_matrix *trm)
{
/* Fudge the font matrix to stretch the glyph if we've substituted the font. */
- if (font->ft_substitute && font->width_table /* && font->wmode == 0 */)
+ if (font->ft_stretch && font->width_table /* && font->wmode == 0 */)
{
FT_Error fterr;
int subw;
diff --git a/source/pdf/pdf-font.c b/source/pdf/pdf-font.c
index 38dd2b58..2f3fa13f 100644
--- a/source/pdf/pdf-font.c
+++ b/source/pdf/pdf-font.c
@@ -218,6 +218,7 @@ pdf_load_substitute_font(fz_context *ctx, pdf_font_desc *fontdesc, char *fontnam
}
fontdesc->font->ft_substitute = 1;
+ fontdesc->font->ft_stretch = 1;
}
static void
@@ -239,6 +240,7 @@ pdf_load_substitute_cjk_font(fz_context *ctx, pdf_font_desc *fontdesc, char *fon
}
fontdesc->font->ft_substitute = 1;
+ fontdesc->font->ft_stretch = 0;
}
static void