summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2018-11-06 16:09:05 +0100
committerTor Andersson <tor.andersson@artifex.com>2018-11-07 14:54:22 +0100
commit2c766bcf417f68bfbd688d10f0dd8065507d7225 (patch)
treed4e2b7f4f92331e296a6a5bb33c4025f7b0095a6 /source
parentc4f6ee0e5edfa95a5b9030356f683c12226d91d4 (diff)
downloadmupdf-2c766bcf417f68bfbd688d10f0dd8065507d7225.tar.xz
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.
Diffstat (limited to 'source')
-rw-r--r--source/fitz/font.c13
1 files changed, 8 insertions, 5 deletions
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;