diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2016-04-05 22:28:16 +0200 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2016-04-06 00:58:04 +0200 |
commit | 0c7b4e5feef2bf95c291010b0ffc5619f2610ffd (patch) | |
tree | 9530088e0f8333585e09d73586164d2cb0260b58 | |
parent | 5f4ca48f9b46098af709642b283496ff37880c21 (diff) | |
download | mupdf-0c7b4e5feef2bf95c291010b0ffc5619f2610ffd.tar.xz |
epub: Skip root box during layout so we don't apply page margins twice.
-rw-r--r-- | source/html/html-layout.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/source/html/html-layout.c b/source/html/html-layout.c index 435d1767..56f5528a 100644 --- a/source/html/html-layout.c +++ b/source/html/html-layout.c @@ -9,7 +9,7 @@ enum { T, R, B, L }; static const char *default_css = -"@page{margin:1em 0}" +"@page{margin:2em 1em}" "a{color:#06C;text-decoration:underline}" "address{display:block;font-style:italic}" "b{font-weight:bold}" @@ -1866,7 +1866,6 @@ fz_print_html(fz_context *ctx, fz_html *box, int pstyle, int level) void fz_layout_html(fz_context *ctx, fz_html *box, float w, float h, float em) { - fz_html page_box; hb_buffer_t *hb_buf = NULL; int unlocked = 0; @@ -1880,11 +1879,15 @@ fz_layout_html(fz_context *ctx, fz_html *box, float w, float h, float em) hb_buf = hb_buffer_create(); unlocked = 1; hb_unlock(ctx); - init_box(ctx, &page_box, DEFAULT_DIR); - page_box.w = w; - page_box.h = 0; - layout_block(ctx, box, &page_box, em, h, 0, hb_buf); + box->w = w; + box->h = 0; + + if (box->down) + { + layout_block(ctx, box->down, box, em, h, 0, hb_buf); + box->h = box->down->h; + } } fz_always(ctx) { @@ -2090,6 +2093,7 @@ fz_parse_html(fz_context *ctx, fz_html_font_set *set, fz_archive *zip, const cha match.count = 0; fz_match_css_at_page(ctx, &match, g.css); fz_apply_css_style(ctx, g.set, &box->style, &match); + // TODO: transfer page margins out of this hacky box generate_boxes(ctx, xml, box, &match, 0, DEFAULT_DIR, &g); |