diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2018-11-13 21:26:53 +0100 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2018-11-13 22:29:33 +0100 |
commit | 6109ce81c66aeb2db8c30f73b4a027916d2f79a6 (patch) | |
tree | e9ca302549a4dfdd69f2b4a6d4e95371a9c17007 | |
parent | b1d79007f3558ae66ec7f33ec615e812350b857f (diff) | |
download | mupdf-6109ce81c66aeb2db8c30f73b4a027916d2f79a6.tar.xz |
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.
-rw-r--r-- | source/fitz/stext-device.c | 8 |
1 files changed, 7 insertions, 1 deletions
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); } } |