summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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)
{