From b08617e17bfbc8504dc00cba724817ddf88b0203 Mon Sep 17 00:00:00 2001 From: Robin Watts Date: Mon, 1 Aug 2016 12:17:25 +0100 Subject: Bug 696984: Badly rendered characters. The type3 font(s) in the file have an invalid (0 sized) bbox, hence the clipping of the chars goes wrong. We now spot the invalid bbox, and suppress the clipping. --- source/fitz/font.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'source/fitz') diff --git a/source/fitz/font.c b/source/fitz/font.c index 79cd050a..a291eab8 100644 --- a/source/fitz/font.c +++ b/source/fitz/font.c @@ -176,6 +176,7 @@ fz_set_font_bbox(fz_context *ctx, fz_font *font, float xmin, float ymin, float x font->bbox.y0 = -1; font->bbox.x1 = 2; font->bbox.y1 = 2; + font->invalid_bbox = 1; } else { @@ -1203,11 +1204,14 @@ fz_bound_t3_glyph(fz_context *ctx, fz_font *font, int gid, fz_rect *bounds) fz_rethrow(ctx); } - /* clip the bbox size to a reasonable maximum for degenerate glyphs */ - big = font->bbox; - m = fz_max(fz_abs(big.x1 - big.x0), fz_abs(big.y1 - big.y0)); - fz_expand_rect(&big, fz_max(fz_matrix_expansion(&font->t3matrix) * 2, m)); - fz_intersect_rect(bounds, &big); + if (!font->invalid_bbox) + { + /* clip the bbox size to a reasonable maximum for degenerate glyphs */ + big = font->bbox; + m = fz_max(fz_abs(big.x1 - big.x0), fz_abs(big.y1 - big.y0)); + fz_expand_rect(&big, fz_max(fz_matrix_expansion(&font->t3matrix) * 2, m)); + fz_intersect_rect(bounds, &big); + } return bounds; } -- cgit v1.2.3