summaryrefslogtreecommitdiff
path: root/source/fitz/font.c
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2015-09-29 12:05:09 +0200
committerRobin Watts <robin.watts@artifex.com>2015-10-02 16:36:34 +0100
commit903a9154f80ccf8d4badb7102d60a3c543896c5c (patch)
tree428d574a6f49c31de13678493f4180f32817db86 /source/fitz/font.c
parentf0f90683d3ae5d8655eb1e02c2412fd35bc96257 (diff)
downloadmupdf-903a9154f80ccf8d4badb7102d60a3c543896c5c.tar.xz
Fix 696148: Always create a glyph width table.
Respect default widths when creating the glyph width table.
Diffstat (limited to 'source/fitz/font.c')
-rw-r--r--source/fitz/font.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/source/fitz/font.c b/source/fitz/font.c
index 6d703659..387e3617 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 /* && font->wmode == 0 */)
+ if (font->ft_substitute && font->width_table /* && font->wmode == 0 */)
{
FT_Error fterr;
int subw;
@@ -430,7 +430,10 @@ fz_adjust_ft_glyph_width(fz_context *ctx, fz_font *font, int gid, fz_matrix *trm
realw = ((FT_Face)font->ft_face)->glyph->metrics.horiAdvance;
fz_unlock(ctx, FZ_LOCK_FREETYPE);
- subw = font->width_table[gid];
+ if (gid < font->width_count)
+ subw = font->width_table[gid];
+ else
+ subw = font->width_default;
if (realw)
scale = (float) subw / realw;
else
@@ -1300,8 +1303,12 @@ fz_advance_ft_glyph(fz_context *ctx, fz_font *font, int gid)
FT_Fixed adv;
int mask;
- if (font->ft_substitute && font->width_table && gid < font->width_count)
- return font->width_table[gid];
+ 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;
/* if (font->wmode)