diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2013-04-30 12:39:26 +0200 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2013-05-06 12:04:47 +0100 |
commit | 4048032f4a2226f3b54a68840dac39440c5428aa (patch) | |
tree | 2111c7360fa3b185e8a8ae22b772479437fb9890 /apps | |
parent | 2234da7e8f30720467e05b14b578c8f3a082b75a (diff) | |
download | mupdf-4048032f4a2226f3b54a68840dac39440c5428aa.tar.xz |
Use linked list for text spans.
Diffstat (limited to 'apps')
-rw-r--r-- | apps/pdfapp.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/apps/pdfapp.c b/apps/pdfapp.c index ff23c4b2..4320ba6a 100644 --- a/apps/pdfapp.c +++ b/apps/pdfapp.c @@ -768,16 +768,15 @@ static int textlen(fz_text_page *page) { fz_text_line *line; fz_text_block *block; + fz_text_span *span; if (page->blocks[block_num].type != FZ_PAGE_BLOCK_TEXT) continue; block = page->blocks[block_num].u.text; for (line = block->lines; line < block->lines + block->len; line++) { - int span_num; - for (span_num = 0; span_num < line->len; span_num++) + for (span = line->first_span; span; span = span->next) { - fz_text_span *span = line->spans[span_num]; len += span->len; } len++; /* pseudo-newline */ @@ -1616,6 +1615,7 @@ void pdfapp_oncopy(pdfapp_t *app, unsigned short *ucsbuf, int ucslen) { fz_text_line *line; fz_text_block *block; + fz_text_span *span; if (page->blocks[block_num].type != FZ_PAGE_BLOCK_TEXT) continue; @@ -1623,10 +1623,8 @@ void pdfapp_oncopy(pdfapp_t *app, unsigned short *ucsbuf, int ucslen) for (line = block->lines; line < block->lines + block->len; line++) { - int span_num; - for (span_num = 0; span_num < line->len; span_num++) + for (span = line->first_span; span; span = span->next) { - fz_text_span *span = line->spans[span_num]; if (seen) { #ifdef _WIN32 @@ -1654,7 +1652,7 @@ void pdfapp_oncopy(pdfapp_t *app, unsigned short *ucsbuf, int ucslen) } } - seen = (seen && span_num + 1 == line->len); + seen = (seen && span == line->last_span); } } } |