From d47fae804572cd0a6cc78e60020e65334a088c0b Mon Sep 17 00:00:00 2001 From: Robin Watts Date: Mon, 6 Apr 2015 15:54:30 +0100 Subject: Use fz_advance_glyph rather than direct FT calls during PDF layout. --- source/fitz/font.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'source/fitz/font.c') diff --git a/source/fitz/font.c b/source/fitz/font.c index 64cea107..6d703659 100644 --- a/source/fitz/font.c +++ b/source/fitz/font.c @@ -410,7 +410,7 @@ static fz_matrix * fz_adjust_ft_glyph_width(fz_context *ctx, fz_font *font, int gid, fz_matrix *trm) { /* Fudge the font matrix to stretch the glyph if we've substituted the font. */ - if (font->ft_substitute && font->width_table && gid < font->width_count) + if (font->ft_substitute && font->width_table && gid < font->width_count /* && font->wmode == 0 */) { FT_Error fterr; int subw; @@ -1298,12 +1298,17 @@ static float fz_advance_ft_glyph(fz_context *ctx, fz_font *font, int gid) { FT_Fixed adv; - int mask = FT_LOAD_NO_SCALE | FT_LOAD_IGNORE_TRANSFORM; + int mask; if (font->ft_substitute && font->width_table && gid < font->width_count) return font->width_table[gid]; + mask = FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING | FT_LOAD_IGNORE_TRANSFORM; + /* if (font->wmode) + mask |= FT_LOAD_VERTICAL_LAYOUT; */ + fz_lock(ctx, FZ_LOCK_FREETYPE); FT_Get_Advance(font->ft_face, gid, mask, &adv); + fz_unlock(ctx, FZ_LOCK_FREETYPE); return (float) adv / ((FT_Face)font->ft_face)->units_per_EM; } -- cgit v1.2.3