From 6109ce81c66aeb2db8c30f73b4a027916d2f79a6 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Tue, 13 Nov 2018 21:26:53 +0100 Subject: Use first character's bbox even if it is empty. Otherwise we get unsightly [0 0 0 0] bounding boxes for lines with a single zero area character. --- source/fitz/stext-device.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/source/fitz/stext-device.c b/source/fitz/stext-device.c index 0040e976..330ac7e2 100644 --- a/source/fitz/stext-device.c +++ b/source/fitz/stext-device.c @@ -659,7 +659,13 @@ fz_stext_close_device(fz_context *ctx, fz_device *dev) for (line = block->u.t.first_line; line; line = line->next) { for (ch = line->first_char; ch; ch = ch->next) - line->bbox = fz_union_rect(line->bbox, fz_rect_from_quad(ch->quad)); + { + fz_rect ch_box = fz_rect_from_quad(ch->quad); + if (ch == line->first_char) + line->bbox = ch_box; + else + line->bbox = fz_union_rect(line->bbox, ch_box); + } block->bbox = fz_union_rect(block->bbox, line->bbox); } } -- cgit v1.2.3