diff options
-rw-r--r-- | include/mupdf/html.h | 2 | ||||
-rw-r--r-- | source/html/handler.c | 7 | ||||
-rw-r--r-- | source/html/layout.c | 6 |
3 files changed, 9 insertions, 6 deletions
diff --git a/include/mupdf/html.h b/include/mupdf/html.h index edeb51d6..86d82fb6 100644 --- a/include/mupdf/html.h +++ b/include/mupdf/html.h @@ -20,7 +20,7 @@ struct html_document_s html_document *html_open_document(fz_context *ctx, const char *filename); html_document *html_open_document_with_stream(fz_context *ctx, fz_stream *file); -void html_layout_document(html_document *doc, float w, float h); +void html_layout_document(html_document *doc, float w, float h, float em); void html_run_box(fz_context *ctx, struct box *box, float page_top, float page_bot, fz_device *dev, const fz_matrix *ctm); enum diff --git a/source/html/handler.c b/source/html/handler.c index fda21f5c..c89e82ae 100644 --- a/source/html/handler.c +++ b/source/html/handler.c @@ -15,7 +15,7 @@ html_count_pages(html_document *doc) { int count; - if (!doc->box) html_layout_document(doc, DEFW, DEFH); + if (!doc->box) html_layout_document(doc, DEFW, DEFH, 12); count = ceilf(doc->box->h / doc->page_h); printf("count pages! %g / %g = %d\n", doc->box->h, doc->page_h, count); @@ -26,7 +26,7 @@ html_page * html_load_page(html_document *doc, int number) { printf("load page %d\n", number); - if (!doc->box) html_layout_document(doc, DEFW, DEFH); + if (!doc->box) html_layout_document(doc, DEFW, DEFH, 12); return (void*)((intptr_t)number + 1); } @@ -38,7 +38,7 @@ html_free_page(html_document *doc, html_page *page) fz_rect * html_bound_page(html_document *doc, html_page *page, fz_rect *bbox) { - if (!doc->box) html_layout_document(doc, DEFW, DEFH); + if (!doc->box) html_layout_document(doc, DEFW, DEFH, 12); printf("html: bound page\n"); bbox->x0 = bbox->y0 = 0; bbox->x1 = doc->page_w; @@ -73,6 +73,7 @@ printf("html: parsing XHTML.\n"); doc->dirname = NULL; doc->super.close = (void*)html_close_document; + doc->super.layout = (void*)html_layout_document; doc->super.count_pages = (void*)html_count_pages; doc->super.load_page = (void*)html_load_page; doc->super.bound_page = (void*)html_bound_page; diff --git a/source/html/layout.c b/source/html/layout.c index acc3d71b..822e2937 100644 --- a/source/html/layout.c +++ b/source/html/layout.c @@ -875,7 +875,7 @@ static struct rule *load_css(html_document *doc, struct rule *css, fz_xml *root) } void -html_layout_document(html_document *doc, float page_w, float page_h) +html_layout_document(html_document *doc, float page_w, float page_h, float em) { struct rule *css = NULL; struct box *root_box; @@ -900,10 +900,12 @@ printf("html: parsing style sheets.\n"); page_box->w = page_w; page_box->h = 0; + // TODO: split generate and layout + printf("html: applying styles and generating boxes.\n"); generate_boxes(doc, doc->xml, root_box, css, &style); printf("html: laying out text.\n"); - layout_block(doc->ctx, root_box, page_box, 12, 0, page_h); + layout_block(doc->ctx, root_box, page_box, em, 0, page_h); printf("html: finished.\n"); // print_box(doc->ctx, root_box, 0); |