From afaf3dc8801e863fdfafdda35192973fa635cb0e Mon Sep 17 00:00:00 2001 From: Robin Watts Date: Mon, 24 Oct 2016 13:13:53 +0100 Subject: Fix cluster timeouts with test file. tests_private/pdf/sumatra/1297_-_interpolate_at_lower_resolutions.pdf times out in the cluster. This is due to us having empty t3 glyphs defined that define d1 rectangles that are wildly different to the default font bbox. Add code to spot that t3 glyphs are empty, and to use a tiny font bbox for them. (It might be nicer to drop the empty display lists, but then this produces knock on problems further on, where non-existent display lists lead to NULL pixmaps, which lead to us think that renders failed etc). --- source/fitz/font.c | 11 ++++++++++- source/fitz/list-device.c | 5 +++++ 2 files changed, 15 insertions(+), 1 deletion(-) (limited to 'source/fitz') diff --git a/source/fitz/font.c b/source/fitz/font.c index 92642ec0..14c79aa9 100644 --- a/source/fitz/font.c +++ b/source/fitz/font.c @@ -1190,7 +1190,16 @@ fz_prepare_t3_glyph(fz_context *ctx, fz_font *font, int gid, int nested_depth) d1_rect = dev->d1_rect; fz_drop_device(ctx, dev); dev = NULL; - if (font->t3flags[gid] & FZ_DEVFLAG_BBOX_DEFINED) + if (fz_display_list_is_empty(ctx, font->t3lists[gid])) + { + /* If empty, no need for a huge bbox, especially as the logic + * in the 'else if' can make it huge. */ + font->bbox_table[gid].x0 = font->bbox.x0; + font->bbox_table[gid].y0 = font->bbox.y0; + font->bbox_table[gid].x1 = font->bbox.x0 + .00001; + font->bbox_table[gid].y1 = font->bbox.y0 + .00001; + } + else if (font->t3flags[gid] & FZ_DEVFLAG_BBOX_DEFINED) { assert(font->bbox_table != NULL); assert(font->glyph_count > gid); diff --git a/source/fitz/list-device.c b/source/fitz/list-device.c index c8b2ced5..ee722126 100644 --- a/source/fitz/list-device.c +++ b/source/fitz/list-device.c @@ -1380,6 +1380,11 @@ fz_bound_display_list(fz_context *ctx, fz_display_list *list, fz_rect *bounds) return bounds; } +int fz_display_list_is_empty(fz_context *ctx, const fz_display_list *list) +{ + return !list || list->len == 0; +} + void fz_run_display_list(fz_context *ctx, fz_display_list *list, fz_device *dev, const fz_matrix *top_ctm, const fz_rect *scissor, fz_cookie *cookie) { -- cgit v1.2.3