diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2012-07-04 17:46:55 +0200 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2012-07-09 17:52:45 +0200 |
commit | 2b857ab9878d5ca8acd862ae58dafa8d269bc502 (patch) | |
tree | c988eb36ea82944745317db863f65ee3f94dcefd | |
parent | cc853795ac090d13adc44926e19d1964f1bcfb09 (diff) | |
download | mupdf-2b857ab9878d5ca8acd862ae58dafa8d269bc502.tar.xz |
Make synthetic font styles match XPS spec more closely.
Shear by 20 degrees for italic. Use 2% wider metrics for bold.
-rw-r--r-- | fitz/res_font.c | 11 | ||||
-rw-r--r-- | xps/xps_glyphs.c | 3 |
2 files changed, 10 insertions, 4 deletions
diff --git a/fitz/res_font.c b/fitz/res_font.c index 0852c56b..e8af6643 100644 --- a/fitz/res_font.c +++ b/fitz/res_font.c @@ -6,6 +6,9 @@ #define MAX_BBOX_TABLE_SIZE 4096 +/* 20 degrees */ +#define SHEAR 0.36397f + static void fz_drop_freetype(fz_context *ctx); static fz_font * @@ -398,7 +401,7 @@ fz_render_ft_glyph(fz_context *ctx, fz_font *font, int gid, fz_matrix trm, int a trm = fz_adjust_ft_glyph_width(ctx, font, gid, trm); if (font->ft_italic) - trm = fz_concat(fz_shear(0.3f, 0), trm); + trm = fz_concat(fz_shear(SHEAR, 0), trm); /* Freetype mutilates complex glyphs if they are loaded @@ -471,7 +474,7 @@ retry_unhinted: if (font->ft_bold) { - float strength = fz_matrix_expansion(trm) * 0.04f; + float strength = fz_matrix_expansion(trm) * 0.02f; FT_Outline_Embolden(&face->glyph->outline, strength * 64); FT_Outline_Translate(&face->glyph->outline, -strength * 32, -strength * 32); } @@ -507,7 +510,7 @@ fz_render_ft_stroked_glyph(fz_context *ctx, fz_font *font, int gid, fz_matrix tr trm = fz_adjust_ft_glyph_width(ctx, font, gid, trm); if (font->ft_italic) - trm = fz_concat(fz_shear(0.3f, 0), trm); + trm = fz_concat(fz_shear(SHEAR, 0), trm); m.xx = trm.a * 64; /* should be 65536 */ m.yx = trm.b * 64; @@ -614,7 +617,7 @@ fz_bound_ft_glyph(fz_context *ctx, fz_font *font, int gid, fz_matrix trm) trm = fz_adjust_ft_glyph_width(ctx, font, gid, trm); if (font->ft_italic) - trm = fz_concat(fz_shear(0.3f, 0), trm); + trm = fz_concat(fz_shear(SHEAR, 0), trm); m.xx = trm.a * 64; /* should be 65536 */ m.yx = trm.b * 64; diff --git a/xps/xps_glyphs.c b/xps/xps_glyphs.c index f75815f0..64dac465 100644 --- a/xps/xps_glyphs.c +++ b/xps/xps_glyphs.c @@ -332,6 +332,9 @@ xps_parse_glyphs_imp(xps_document *doc, fz_matrix ctm, else advance = mtx.hadv * 100; + if (font->ft_bold) + advance *= 1.02f; + if (is && *is) { is = xps_parse_glyph_metrics(is, &advance, &u_offset, &v_offset); |