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 /fitz | |
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.
Diffstat (limited to 'fitz')
-rw-r--r-- | fitz/res_font.c | 11 |
1 files changed, 7 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; |