summaryrefslogtreecommitdiff
path: root/fitz/dev_text.c
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2012-03-19 17:49:33 +0100
committerTor Andersson <tor.andersson@artifex.com>2012-03-19 17:54:43 +0100
commit51cdfc4b174b6175c8dd1827998224ca680f3ca7 (patch)
treed2e2bd8ce63938723f7e55b570a16444f99cc5c9 /fitz/dev_text.c
parentd853e201d409baf3ae9c8f1e59477337e2935ace (diff)
downloadmupdf-51cdfc4b174b6175c8dd1827998224ca680f3ca7.tar.xz
Don't create empty spans and lines in the text device.
Diffstat (limited to 'fitz/dev_text.c')
-rw-r--r--fitz/dev_text.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/fitz/dev_text.c b/fitz/dev_text.c
index edf45fe2..fb6ebdc6 100644
--- a/fitz/dev_text.c
+++ b/fitz/dev_text.c
@@ -150,6 +150,8 @@ init_span(fz_context *ctx, fz_text_span *span, fz_text_style *style)
static void
append_span(fz_context *ctx, fz_text_line *line, fz_text_span *span)
{
+ if (span->len == 0)
+ return;
if (line->len == line->cap)
{
line->cap = MAX(8, line->cap * 2);
@@ -212,6 +214,8 @@ lookup_block_for_line(fz_context *ctx, fz_text_page *page, fz_text_line *line)
static void
insert_line(fz_context *ctx, fz_text_page *page, fz_text_line *line)
{
+ if (line->len == 0)
+ return;
append_line(ctx, lookup_block_for_line(ctx, page, line), line);
}
@@ -638,7 +642,7 @@ fz_print_text_page_html(fz_context *ctx, FILE *out, fz_text_page *page)
span = &line->spans[span_n];
if (style != span->style)
{
- if (style != NULL)
+ if (style)
fz_print_style_end(out, style);
fz_print_style_begin(out, span->style);
style = span->style;
@@ -659,7 +663,7 @@ fz_print_text_page_html(fz_context *ctx, FILE *out, fz_text_page *page)
fprintf(out, "&#x%x;", ch->c);
}
}
- if (style != NULL)
+ if (style)
fz_print_style_end(out, style);
fprintf(out, "</p>\n");
}