summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/mupdf/fitz/font.h1
-rw-r--r--source/fitz/font.c14
2 files changed, 10 insertions, 5 deletions
diff --git a/include/mupdf/fitz/font.h b/include/mupdf/fitz/font.h
index b0392db0..484273a5 100644
--- a/include/mupdf/fitz/font.h
+++ b/include/mupdf/fitz/font.h
@@ -56,6 +56,7 @@ struct fz_font_s
void (*t3run)(fz_context *ctx, void *doc, void *resources, fz_buffer *contents, struct fz_device_s *dev, const fz_matrix *ctm, void *gstate, int nestedDepth);
void (*t3freeres)(fz_context *ctx, void *doc, void *resources);
+ char invalid_bbox;
fz_rect bbox; /* font bbox is used only for t3 fonts */
int glyph_count;
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;
}