diff options
author | Tor Andersson <tor@ghostscript.com> | 2011-02-23 11:37:02 +0000 |
---|---|---|
committer | Tor Andersson <tor@ghostscript.com> | 2011-02-23 11:37:02 +0000 |
commit | c889fcd06f1256571342368d40d375e44045dcd3 (patch) | |
tree | 1ed779534cdaaf84e6c3577d214bb227e0e210c4 | |
parent | ff02027edf3aa04dbf9d57a3778025be2640b09d (diff) | |
download | mupdf-c889fcd06f1256571342368d40d375e44045dcd3.tar.xz |
Remove fthint workaround for DynaLab fonts, since that is now a part of freetype.
-rw-r--r-- | fitz/dev_text.c | 21 | ||||
-rw-r--r-- | fitz/fitz.h | 1 | ||||
-rw-r--r-- | fitz/res_font.c | 58 | ||||
-rw-r--r-- | mupdf/pdf_font.c | 4 |
4 files changed, 23 insertions, 61 deletions
diff --git a/fitz/dev_text.c b/fitz/dev_text.c index efd4a2ed..c59a36f7 100644 --- a/fitz/dev_text.c +++ b/fitz/dev_text.c @@ -5,28 +5,7 @@ #include <ft2build.h> #include FT_FREETYPE_H - -#if ((FREETYPE_MAJOR == 2) && (FREETYPE_MINOR == 1)) || \ - ((FREETYPE_MAJOR == 2) && (FREETYPE_MINOR == 2)) || \ - ((FREETYPE_MAJOR == 2) && (FREETYPE_MINOR == 3) && (FREETYPE_PATCH < 8)) - -int -FT_Get_Advance(FT_Face face, int gid, int masks, FT_Fixed *out) -{ - int err; - err = FT_Load_Glyph(face, gid, masks); - if (err) - return err; - if (masks & FT_LOAD_VERTICAL_LAYOUT) - *out = face->glyph->metrics.vertAdvance << 10; - else - *out = face->glyph->metrics.horiAdvance << 10; - return 0; -} - -#else #include FT_ADVANCES_H -#endif typedef struct fz_textdevice_s fz_textdevice; diff --git a/fitz/fitz.h b/fitz/fitz.h index 685a75f3..d8b1e401 100644 --- a/fitz/fitz.h +++ b/fitz/fitz.h @@ -681,7 +681,6 @@ struct fz_font_s void *ftface; /* has an FT_Face if used */ int ftsubstitute; /* ... substitute metrics */ - int fthint; /* ... force hinting for DynaLab fonts */ /* origin of font data */ char *ftfile; diff --git a/fitz/res_font.c b/fitz/res_font.c index 1df8b2e6..4efdd0e4 100644 --- a/fitz/res_font.c +++ b/fitz/res_font.c @@ -17,7 +17,6 @@ fz_newfont(void) font->ftface = nil; font->ftsubstitute = 0; - font->fthint = 0; font->ftfile = nil; font->ftdata = nil; @@ -287,43 +286,32 @@ 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); -#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 + /* 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) { - 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; - } + 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) diff --git a/mupdf/pdf_font.c b/mupdf/pdf_font.c index 03b02096..cd080ee6 100644 --- a/mupdf/pdf_font.c +++ b/mupdf/pdf_font.c @@ -602,10 +602,6 @@ loadcidfont(pdf_fontdesc **fontdescp, pdf_xref *xref, fz_obj *dict, fz_obj *enco else fz_setfontbbox(fontdesc->font, bbox.x0, bbox.y0, bbox.x1, bbox.y1); - /* Check for DynaLab fonts */ - if (FT_IS_TRICKY(face)) - fontdesc->font->fthint = 1; - /* Encoding */ error = fz_okay; |