From 0dc2cbf8fedd5615898b09314d0c899c6e911baa Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Tue, 19 May 2015 17:22:01 +0200 Subject: epub: User stylesheets. Add -U option to mupdf and mudraw to set a user stylesheet. Uses a context to store user the stylesheet, just like the AA level. --- source/html/epub-doc.c | 2 +- source/html/html-doc.c | 4 ++-- source/html/html-layout.c | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) (limited to 'source/html') diff --git a/source/html/epub-doc.c b/source/html/epub-doc.c index 712d5804..a2871889 100644 --- a/source/html/epub-doc.c +++ b/source/html/epub-doc.c @@ -195,7 +195,7 @@ epub_parse_chapter(fz_context *ctx, epub_document *doc, const char *path) fz_write_buffer_byte(ctx, buf, 0); ch = fz_malloc_struct(ctx, epub_chapter); - ch->box = fz_parse_html(ctx, doc->set, zip, base_uri, buf, NULL); + ch->box = fz_parse_html(ctx, doc->set, zip, base_uri, buf, fz_user_css(ctx)); ch->next = NULL; fz_drop_buffer(ctx, buf); diff --git a/source/html/html-doc.c b/source/html/html-doc.c index 04286f7c..366a7378 100644 --- a/source/html/html-doc.c +++ b/source/html/html-doc.c @@ -120,7 +120,7 @@ htdoc_open_document_with_stream(fz_context *ctx, fz_stream *file) buf = fz_read_all(ctx, file, 0); fz_write_buffer_byte(ctx, buf, 0); - doc->box = fz_parse_html(ctx, doc->set, doc->zip, ".", buf, NULL); + doc->box = fz_parse_html(ctx, doc->set, doc->zip, ".", buf, fz_user_css(ctx)); fz_drop_buffer(ctx, buf); return (fz_document*)doc; @@ -146,7 +146,7 @@ htdoc_open_document(fz_context *ctx, const char *filename) buf = fz_read_file(ctx, filename); fz_write_buffer_byte(ctx, buf, 0); - doc->box = fz_parse_html(ctx, doc->set, doc->zip, ".", buf, NULL); + doc->box = fz_parse_html(ctx, doc->set, doc->zip, ".", buf, fz_user_css(ctx)); fz_drop_buffer(ctx, buf); return (fz_document*)doc; diff --git a/source/html/html-layout.c b/source/html/html-layout.c index dd48485b..3bb1789c 100644 --- a/source/html/html-layout.c +++ b/source/html/html-layout.c @@ -1241,9 +1241,9 @@ fz_parse_html(fz_context *ctx, fz_html_font_set *set, fz_archive *zip, const cha xml = fz_parse_xml(ctx, buf->data, buf->len, 1); css = fz_parse_css(ctx, NULL, default_css, ""); - if (user_css) - css = fz_parse_css(ctx, NULL, user_css, ""); css = html_load_css(ctx, zip, base_uri, css, xml); + if (user_css) + css = fz_parse_css(ctx, css, user_css, ""); // print_rules(css); -- cgit v1.2.3