summaryrefslogtreecommitdiff
path: root/source/tools
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2017-08-01 18:15:23 +0200
committerTor Andersson <tor.andersson@artifex.com>2017-08-17 13:38:48 +0200
commit626ea2ea771735492c9a4350ae02b26ea09d1423 (patch)
treec92241b181a51719cbb47402bad98bb1984bf963 /source/tools
parente349ba5984fe837d3eec9649d718efe16169ca44 (diff)
downloadmupdf-626ea2ea771735492c9a4350ae02b26ea09d1423.tar.xz
Simplify stext structure and device.
* Use pool allocator and linked lists for all levels. * Remove separate fz_stext_sheet struct. * Remove unused 'script' style. * Remove 'span' level items. * Detect visual/logical RTL layouts. * Detect indented paragraphs.
Diffstat (limited to 'source/tools')
-rw-r--r--source/tools/mudraw.c10
-rw-r--r--source/tools/murun.c16
2 files changed, 3 insertions, 23 deletions
diff --git a/source/tools/mudraw.c b/source/tools/mudraw.c
index de05ab65..e1303fb8 100644
--- a/source/tools/mudraw.c
+++ b/source/tools/mudraw.c
@@ -248,7 +248,6 @@ static int band_height = 0;
static int lowmemory = 0;
static int errored = 0;
-static fz_stext_sheet *sheet = NULL;
static fz_colorspace *colorspace;
static int spots = 0;
static int alpha;
@@ -391,9 +390,6 @@ file_level_headers(fz_context *ctx)
if (output_format == OUT_STEXT || output_format == OUT_TRACE)
fz_write_printf(ctx, out, "<?xml version=\"1.0\"?>\n");
- if (output_format == OUT_TEXT || output_format == OUT_HTML || output_format == OUT_XHTML || output_format == OUT_STEXT)
- sheet = fz_new_stext_sheet(ctx);
-
if (output_format == OUT_HTML)
fz_print_stext_header_as_html(ctx, out);
if (output_format == OUT_XHTML)
@@ -422,8 +418,6 @@ file_level_trailers(fz_context *ctx)
if (output_format == OUT_PS)
fz_write_ps_file_trailer(ctx, out, output_pagenum);
-
- fz_drop_stext_sheet(ctx, sheet);
}
static void drawband(fz_context *ctx, fz_page *page, fz_display_list *list, const fz_matrix *ctm, const fz_rect *tbounds, fz_cookie *cookie, int band_start, fz_pixmap *pix, fz_bitmap **bit)
@@ -534,7 +528,7 @@ static void dodrawpage(fz_context *ctx, fz_page *page, fz_display_list *list, in
stext_options.flags = (output_format == OUT_HTML || output_format == OUT_XHTML) ? FZ_STEXT_PRESERVE_IMAGES : 0;
text = fz_new_stext_page(ctx, &mediabox);
- dev = fz_new_stext_device(ctx, sheet, text, &stext_options);
+ dev = fz_new_stext_device(ctx, text, &stext_options);
if (lowmemory)
fz_enable_device_hints(ctx, dev, FZ_NO_CACHE);
if (list)
@@ -550,12 +544,10 @@ static void dodrawpage(fz_context *ctx, fz_page *page, fz_display_list *list, in
}
else if (output_format == OUT_HTML)
{
- fz_analyze_text(ctx, sheet, text);
fz_print_stext_page_as_html(ctx, out, text);
}
else if (output_format == OUT_XHTML)
{
- fz_analyze_text(ctx, sheet, text);
fz_print_stext_page_as_xhtml(ctx, out, text);
}
else if (output_format == OUT_TEXT)
diff --git a/source/tools/murun.c b/source/tools/murun.c
index b7443286..7a713903 100644
--- a/source/tools/murun.c
+++ b/source/tools/murun.c
@@ -1827,19 +1827,13 @@ static void ffi_Page_toStructuredText(js_State *J)
fz_context *ctx = js_getcontext(J);
fz_page *page = ffi_topage(J, 0);
const char *options = js_iscoercible(J, 1) ? js_tostring(J, 1) : NULL;
- fz_stext_sheet *sheet = NULL;
fz_stext_options so;
fz_stext_page *text;
- fz_var(sheet);
-
fz_try(ctx) {
- sheet = fz_new_stext_sheet(ctx);
fz_parse_stext_options(ctx, &so, options);
- text = fz_new_stext_page_from_page(ctx, page, sheet, &so);
+ text = fz_new_stext_page_from_page(ctx, page, &so);
}
- fz_always(ctx)
- fz_drop_stext_sheet(ctx, sheet);
fz_catch(ctx)
rethrow(J);
@@ -2673,19 +2667,13 @@ static void ffi_DisplayList_toStructuredText(js_State *J)
fz_context *ctx = js_getcontext(J);
fz_display_list *list = js_touserdata(J, 0, "fz_display_list");
const char *options = js_iscoercible(J, 1) ? js_tostring(J, 1) : NULL;
- fz_stext_sheet *sheet = NULL;
fz_stext_options so;
fz_stext_page *text;
- fz_var(sheet);
-
fz_try(ctx) {
- sheet = fz_new_stext_sheet(ctx);
fz_parse_stext_options(ctx, &so, options);
- text = fz_new_stext_page_from_display_list(ctx, list, sheet, &so);
+ text = fz_new_stext_page_from_display_list(ctx, list, &so);
}
- fz_always(ctx)
- fz_drop_stext_sheet(ctx, sheet);
fz_catch(ctx)
rethrow(J);