From 2c766bcf417f68bfbd688d10f0dd8065507d7225 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Tue, 6 Nov 2018 16:09:05 +0100 Subject: Fix 700030: Use actual font glyph widths when extracting text. Only use the PDF character widths when also stretching glyphs to match the PDF metrics. --- source/fitz/font.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'source/fitz') diff --git a/source/fitz/font.c b/source/fitz/font.c index 234d4a69..67dd726c 100644 --- a/source/fitz/font.c +++ b/source/fitz/font.c @@ -1568,12 +1568,15 @@ fz_advance_ft_glyph(fz_context *ctx, fz_font *font, int gid, int wmode) FT_Fixed adv = 0; int mask; - /* Substitute font widths. */ - if (font->width_table) + /* PDF and substitute font widths. */ + if (!font->flags.ft_substitute || font->flags.ft_stretch) { - if (gid < font->width_count) - return font->width_table[gid] / 1000.0f; - return font->width_default / 1000.0f; + if (font->width_table) + { + if (gid < font->width_count) + return font->width_table[gid] / 1000.0f; + return font->width_default / 1000.0f; + } } mask = FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING | FT_LOAD_IGNORE_TRANSFORM; -- cgit v1.2.3