From 08d0586bd140a5bf7519c20371e80d316f75ac9c Mon Sep 17 00:00:00 2001 From: Emden Gansner Date: Wed, 8 Aug 2012 16:08:22 -0400 Subject: [PATCH] Fix bug in HR if cells are not defined across the entire row with the horizontal rule beneath it. --- lib/common/htmltable.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/common/htmltable.c b/lib/common/htmltable.c index 4c5566ab9..1b5663922 100644 --- a/lib/common/htmltable.c +++ b/lib/common/htmltable.c @@ -404,7 +404,7 @@ static void emit_html_cell(GVJ_t * job, htmlcell_t * cp, htmlenv_t * env); * extend the lines to intersect the rounded table boundary */ static void -emit_html_rules(GVJ_t * job, htmlcell_t * cp, htmlenv_t * env, char *color) +emit_html_rules(GVJ_t * job, htmlcell_t * cp, htmlenv_t * env, char *color, htmlcell_t* nextc) { pointf rule_pt; double rule_length; @@ -449,6 +449,10 @@ emit_html_rules(GVJ_t * job, htmlcell_t * cp, htmlenv_t * env, char *color) rule_pt.x = pts.LL.x - base - cp->parent->data.space / 2; if (cp->col + cp->cspan == cp->parent->cc) // also last column base *= 2; + /* incomplete row of cells; extend line to end */ + else if (nextc && (nextc->row != cp->row)) { + base += (cp->parent->data.box.UR.x + pos.x) - (pts.UR.x + cp->parent->data.space / 2); + } } else if (cp->col + cp->cspan == cp->parent->cc) { // last column // extend to center of table border and add half cell spacing base = cp->parent->data.border + cp->parent->data.space / 2; @@ -456,6 +460,10 @@ emit_html_rules(GVJ_t * job, htmlcell_t * cp, htmlenv_t * env, char *color) } else { base = 0; rule_pt.x = pts.LL.x - cp->parent->data.space / 2; + /* incomplete row of cells; extend line to end */ + if (nextc && (nextc->row != cp->row)) { + base += (cp->parent->data.box.UR.x + pos.x) - (pts.UR.x + cp->parent->data.space / 2); + } } rule_pt.y = pts.LL.y - cp->parent->data.space / 2; rule_length = base + pts.UR.x - pts.LL.x + cp->parent->data.space; @@ -518,7 +526,7 @@ static void emit_html_tbl(GVJ_t * job, htmltbl_t * tbl, htmlenv_t * env) gvrender_set_penwidth(job, 1.0); while ((cp = *cells++)) { if (cp->ruled) - emit_html_rules(job, cp, env, tbl->data.pencolor); + emit_html_rules(job, cp, env, tbl->data.pencolor, *cells); } if (tbl->data.border) -- 2.50.1