summaryrefslogtreecommitdiff
path: root/fitz
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2012-03-30 14:08:48 +0200
committerTor Andersson <tor.andersson@artifex.com>2012-04-19 11:01:33 +0200
commit15099174daf3ddebb6c81f9fcafcbc1256f9435e (patch)
tree2edda283fc202547c719baaaa593fc7cbe30e27b /fitz
parentb0049629c86093ce898b4e80f362fb1387262b8b (diff)
downloadmupdf-15099174daf3ddebb6c81f9fcafcbc1256f9435e.tar.xz
Retry loading a hinted glyph without hinting if freetype returns an error.
Allows us to render files with broken font hinting programs when hinting is enabled(whether by no-AA or DynaLab detection). Fix bug 692949.
Diffstat (limited to 'fitz')
-rw-r--r--fitz/res_font.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/fitz/res_font.c b/fitz/res_font.c
index ca76fcfe..a0c2fc2a 100644
--- a/fitz/res_font.c
+++ b/fitz/res_font.c
@@ -423,7 +423,7 @@ fz_render_ft_glyph(fz_context *ctx, fz_font *font, int gid, fz_matrix trm, int a
if (aa == 0)
{
- /* If you really want grid fitting, enable this code. */
+ /* enable grid fitting for non-antialiased rendering */
float scale = fz_matrix_expansion(trm);
m.xx = trm.a * 65536 / scale;
m.xy = trm.b * 65536 / scale;
@@ -437,8 +437,10 @@ fz_render_ft_glyph(fz_context *ctx, fz_font *font, int gid, fz_matrix trm, int a
fz_warn(ctx, "freetype setting character size: %s", ft_error_string(fterr));
FT_Set_Transform(face, &m, &v);
fterr = FT_Load_Glyph(face, gid, FT_LOAD_NO_BITMAP | FT_LOAD_TARGET_MONO);
- if (fterr)
- fz_warn(ctx, "freetype load glyph (gid %d): %s", gid, ft_error_string(fterr));
+ if (fterr) {
+ fz_warn(ctx, "freetype load hinted glyph (gid %d): %s", gid, ft_error_string(fterr));
+ goto retry_unhinted;
+ }
}
else if (font->ft_hint)
{
@@ -450,11 +452,14 @@ fz_render_ft_glyph(fz_context *ctx, fz_font *font, int gid, fz_matrix trm, int a
so that we get the correct outline shape.
*/
fterr = FT_Load_Glyph(face, gid, FT_LOAD_NO_BITMAP);
- if (fterr)
- fz_warn(ctx, "freetype load glyph (gid %d): %s", gid, ft_error_string(fterr));
+ if (fterr) {
+ fz_warn(ctx, "freetype load hinted glyph (gid %d): %s", gid, ft_error_string(fterr));
+ goto retry_unhinted;
+ }
}
else
{
+retry_unhinted:
fterr = FT_Load_Glyph(face, gid, FT_LOAD_NO_BITMAP | FT_LOAD_NO_HINTING);
if (fterr)
{