diff options
-rw-r--r-- | include/mupdf/html.h | 1 | ||||
-rw-r--r-- | source/html/layout.c | 8 |
2 files changed, 6 insertions, 3 deletions
diff --git a/include/mupdf/html.h b/include/mupdf/html.h index 53e021ce..fb0fdf2b 100644 --- a/include/mupdf/html.h +++ b/include/mupdf/html.h @@ -156,6 +156,7 @@ struct box fz_xml *node; struct flow *flow_head, **flow_tail; struct computed_style style; + int is_first_flow; /* for text-indent */ }; enum diff --git a/source/html/layout.c b/source/html/layout.c index c948e02b..bb653cf9 100644 --- a/source/html/layout.c +++ b/source/html/layout.c @@ -22,13 +22,14 @@ static const char *default_css = "sub{vertical-align:sub}" "sup{vertical-align:super}" "s,strike,del{text-decoration:line-through}" -"hr{border:1px inset}" +"hr{border-width:1px;border-color:black}" "ol,ul,dir,menu,dd{margin-left:40px}" "ol{list-style-type:decimal}" "ol ul,ul ol,ul ul,ol ol{margin-top:0;margin-bottom:0}" "u,ins{text-decoration:underline}" "center{text-align:center}" -"svg{display:none}"; +"svg{display:none}" +; static int iswhite(int c) { @@ -168,6 +169,7 @@ static void insert_inline_box(fz_context *ctx, struct box *box, struct box *top) else { struct box *flow = new_box(ctx, NULL); + flow->is_first_flow = !top->last; insert_box(ctx, flow, BOX_FLOW, top); insert_box(ctx, box, BOX_INLINE, flow); } @@ -345,7 +347,7 @@ static void layout_flow(fz_context *ctx, struct box *box, struct box *top, float int align; em = from_number(box->style.font_size, em, em); - indent = from_number(top->style.text_indent, em, top->w); + indent = box->is_first_flow ? from_number(top->style.text_indent, em, top->w) : 0; align = top->style.text_align; box->x = top->x; |