summaryrefslogtreecommitdiff
path: root/fitz/res_font.c
diff options
context:
space:
mode:
authorTor Andersson <tor@ghostscript.com>2011-02-23 14:29:22 +0000
committerTor Andersson <tor@ghostscript.com>2011-02-23 14:29:22 +0000
commit448fcbab4658f24b6067d82162b88c0631567387 (patch)
tree4cc95dd532cbf90d8e91998a4930318a8b1df8ea /fitz/res_font.c
parentc889fcd06f1256571342368d40d375e44045dcd3 (diff)
downloadmupdf-448fcbab4658f24b6067d82162b88c0631567387.tar.xz
Revert to using fthint since we cannot rely on FreeType's trickyness detection on some subset fonts.
Diffstat (limited to 'fitz/res_font.c')
-rw-r--r--fitz/res_font.c58
1 files changed, 35 insertions, 23 deletions
diff --git a/fitz/res_font.c b/fitz/res_font.c
index 4efdd0e4..1df8b2e6 100644
--- a/fitz/res_font.c
+++ b/fitz/res_font.c
@@ -17,6 +17,7 @@ fz_newfont(void)
font->ftface = nil;
font->ftsubstitute = 0;
+ font->fthint = 0;
font->ftfile = nil;
font->ftdata = nil;
@@ -286,32 +287,43 @@ fz_renderftglyph(fz_font *font, int gid, fz_matrix trm)
fz_warn("freetype setting character size: %s", ft_errorstring(fterr));
FT_Set_Transform(face, &m, &v);
+ if (font->fthint)
+ {
+ /*
+ Enable hinting, but keep the huge char size so that
+ it is hinted for a character. This will in effect nullify
+ the effect of grid fitting. This form of hinting should
+ only be used for DynaLab and similar tricky TrueType fonts,
+ so that we get the correct outline shape.
+ */
#ifdef GRIDFIT
- /* If you really want grid fitting, enable this code. */
- float scale = fz_matrixexpansion(trm);
- m.xx = trm.a * 65536 / scale;
- m.xy = trm.b * 65536 / scale;
- m.yx = trm.c * 65536 / scale;
- m.yy = trm.d * 65536 / scale;
- v.x = 0;
- v.y = 0;
-
- fterr = FT_Set_Char_Size(face, 64 * scale, 64 * scale, 72, 72);
- if (fterr)
- fz_warn("freetype setting character size: %s", ft_errorstring(fterr));
- FT_Set_Transform(face, &m, &v);
-
- fterr = FT_Load_Glyph(face, gid, FT_LOAD_NO_BITMAP);
- if (fterr)
- fz_warn("freetype load glyph (gid %d): %s", gid, ft_errorstring(fterr));
-#else
- fterr = FT_Load_Glyph(face, gid, FT_LOAD_NO_BITMAP | FT_LOAD_NO_HINTING);
- if (fterr)
+ /* If you really want grid fitting, enable this code. */
+ float scale = fz_matrixexpansion(trm);
+ m.xx = trm.a * 65536 / scale;
+ m.xy = trm.b * 65536 / scale;
+ m.yx = trm.c * 65536 / scale;
+ m.yy = trm.d * 65536 / scale;
+ v.x = 0;
+ v.y = 0;
+
+ fterr = FT_Set_Char_Size(face, 64 * scale, 64 * scale, 72, 72);
+ if (fterr)
+ fz_warn("freetype setting character size: %s", ft_errorstring(fterr));
+ FT_Set_Transform(face, &m, &v);
+#endif
+ fterr = FT_Load_Glyph(face, gid, FT_LOAD_NO_BITMAP);
+ if (fterr)
+ fz_warn("freetype load glyph (gid %d): %s", gid, ft_errorstring(fterr));
+ }
+ else
{
- fz_warn("freetype load glyph (gid %d): %s", gid, ft_errorstring(fterr));
- return nil;
+ fterr = FT_Load_Glyph(face, gid, FT_LOAD_NO_BITMAP | FT_LOAD_NO_HINTING);
+ if (fterr)
+ {
+ fz_warn("freetype load glyph (gid %d): %s", gid, ft_errorstring(fterr));
+ return nil;
+ }
}
-#endif
fterr = FT_Render_Glyph(face->glyph, ft_render_mode_normal);
if (fterr)