diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2017-08-21 17:00:04 +0200 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2017-08-21 17:20:10 +0200 |
commit | fdec171ce5b182914fa2f0a8a6e1fbb578ed21b3 (patch) | |
tree | d386ee452528949b02f88248206f0f455235c35f /source | |
parent | bf67596f71774d9b854b0c988f3e1f9e66731717 (diff) | |
download | mupdf-fdec171ce5b182914fa2f0a8a6e1fbb578ed21b3.tar.xz |
Fix 698374: Compute line and block bounding boxes when device closes.
Diffstat (limited to 'source')
-rw-r--r-- | source/fitz/stext-device.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/source/fitz/stext-device.c b/source/fitz/stext-device.c index b4532d8b..ba609228 100644 --- a/source/fitz/stext-device.c +++ b/source/fitz/stext-device.c @@ -178,16 +178,6 @@ add_char_to_line(fz_context *ctx, fz_stext_page *page, fz_stext_line *line, cons ch->bbox.y0 = min4(p->y + a.y, q->y + a.y, p->y + d.y, q->y + d.y); ch->bbox.y1 = max4(p->y + a.y, q->y + a.y, p->y + d.y, q->y + d.y); - if (fz_is_empty_rect(&line->bbox)) - line->bbox = ch->bbox; - else - { - line->bbox.x0 = fz_min(line->bbox.x0, ch->bbox.x0); - line->bbox.y0 = fz_min(line->bbox.y0, ch->bbox.y0); - line->bbox.x1 = fz_min(line->bbox.x1, ch->bbox.x1); - line->bbox.y1 = fz_min(line->bbox.y1, ch->bbox.y1); - } - return ch; } @@ -720,11 +710,20 @@ fz_stext_close_device(fz_context *ctx, fz_device *dev) fz_stext_page *page = tdev->page; fz_stext_block *block; fz_stext_line *line; + fz_stext_char *ch; for (block = page->first_block; block; block = block->next) + { if (block->type == FZ_STEXT_BLOCK_TEXT) + { for (line = block->u.t.first_line; line; line = line->next) + { + for (ch = line->first_char; ch; ch = ch->next) + fz_union_rect(&line->bbox, &ch->bbox); fz_union_rect(&block->bbox, &line->bbox); + } + } + } /* TODO: smart sorting of blocks and lines in reading order */ /* TODO: unicode NFC normalization */ |