/* forward declaration */
static void emit_html_cell(GVJ_t * job, htmlcell_t * cp, htmlenv_t * env);
+static void emit_html_rules(GVJ_t * job, htmlcell_t * cp, htmlenv_t * env, char *fillc);
static void
emit_html_tbl(GVJ_t * job, htmltbl_t * tbl, htmlenv_t * env)
if (tbl->data.border)
doBorder(job, tbl->data.pencolor, tbl->data.border, pts);
}
+ //render table rules
+ while (*cells){
+ emit_html_rules(job, *cells, env, tbl->data.bgcolor);
+ cells++;
+ }
+ cells = tbl->u.n.cells;
while (*cells) {
emit_html_cell(job, *cells, env);
}
}
+/* emit_html_rules:
+ * place vertical and horizontal lines between adjacent cells and
+ * 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)
+{
+ pointf rule_pt;
+ double rule_length;
+ unsigned char base;
+ boxf pts = cp->data.box;
+ pointf pos = env->pos;
+
+ if (!color)
+ color = DEFAULT_COLOR;
+ gvrender_set_fillcolor(job, color);
+ gvrender_set_pencolor(job, color);
+
+ pts = cp->data.box;
+ pts.LL.x += pos.x;
+ pts.UR.x += pos.x;
+ pts.LL.y += pos.y;
+ pts.UR.y += pos.y;
+
+ //Determine vertical line coordinate and length
+ if (cp->col + cp->cspan < cp->parent->cc){
+ if(cp->row == 0) { //first row
+ //extend to table border and add half cell spacing
+ base = cp->parent->data.border + cp->parent->data.space/2;
+ rule_pt.y = pts.LL.y - cp->parent->data.space/2;
+ }
+ else if(cp->row + cp->rspan == cp->parent->rc){ //bottom row
+ //extend to table border and add half cell spacing
+ base = cp->parent->data.border + cp->parent->data.space/2;
+ rule_pt.y = pts.LL.y - cp->parent->data.space/2 - base;
+ }
+ else{
+ base = 0;
+ rule_pt.y = pts.LL.y - cp->parent->data.space/2;
+ }
+ rule_pt.x = pts.UR.x + cp->parent->data.space/2;
+ rule_length = base + pts.UR.y - pts.LL.y + cp->parent->data.space;
+ doSide(job,rule_pt,0,rule_length);
+ }
+//Determine the horizontal coordinate and length
+ if(cp->row + cp->rspan < cp->parent->rc){
+ if(cp->col == 0) { //first column
+ //extend to table border and add half cell spacing
+ base = cp->parent->data.border + cp->parent->data.space/2;
+ rule_pt.x = pts.LL.x - base - cp->parent->data.space/2;
+ }
+ else if(cp->col + cp->cspan == cp->parent->cc){ //last column
+ //extend to table border and add half cell spacing
+ base = cp->parent->data.border + cp->parent->data.space/2;
+ rule_pt.x = pts.LL.x - cp->parent->data.space/2;
+ }
+ else{
+ base = 0;
+ rule_pt.x = pts.LL.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;
+ doSide(job,rule_pt,rule_length,0);
+ }
+
+}
+
/* allocObj:
* Push new obj on stack to be used in common by all
* html elements with anchors.
--- /dev/null
+digraph G {
+ subgraph cluster_base{
+ label = "table border:10,cellspacing:10,cellpadding:0,cell border:0";
+ node [shape=plaintext]
+ tbl1100 [label=<
+ <TABLE border="10" cellspacing="10" cellpadding="0" style="rounded">
+ <TR><TD border="0">00</TD><TD border="0">01</TD><TD border="0">02</TD><TD border="0">03</TD></TR>
+ <TR><TD border="0">10</TD><TD border="0" rowspan="2">11</TD><TD border="0">12</TD><TD border="0">13</TD></TR>
+ <TR><TD border="0">20</TD><TD border="0" colspan="2">22</TD></TR>
+ <TR><TD border="0">30</TD><TD border="0">31</TD><TD border="0">32</TD><TD border="0">33</TD></TR>
+</TABLE>>];
+}
+
+ subgraph cluster_table_border {
+ label="table border:10,cellspacing:0,cellpadding:10,cell border:0";
+ node [shape=plaintext]
+ tbl1010 [label=<
+ <TABLE border="10" cellspacing="0" cellpadding="10" style="rounded">
+ <TR><TD border="0">00</TD><TD border="0">01</TD><TD border="0">02</TD><TD border="0">03</TD></TR>
+ <TR><TD border="0">10</TD><TD border="0" rowspan="2">11</TD><TD border="0">12</TD><TD border="0">13</TD></TR>
+ <TR><TD border="0">20</TD><TD border="0" colspan="2">22</TD></TR>
+ <TR><TD border="0">30</TD><TD border="0">31</TD><TD border="0">32</TD><TD border="0">33</TD></TR>
+</TABLE>>];
+}
+
+ subgraph cluster_cellspacing {
+ label="table border:10,cellspacing:10,cellpadding:10,cell border:0";
+ node [shape=plaintext]
+ tbl1110 [label=<
+ <TABLE border="10" cellspacing="10" cellpadding="10" style="rounded">
+ <TR><TD border="0">00</TD><TD border="0">01</TD><TD border="0">02</TD><TD border="0">03</TD></TR>
+ <TR><TD border="0">10</TD><TD border="0" rowspan="2">11</TD><TD border="0">12</TD><TD border="0">13</TD></TR>
+ <TR><TD border="0">20</TD><TD border="0" colspan="2">22</TD></TR>
+ <TR><TD border="0">30</TD><TD border="0">31</TD><TD border="0">32</TD><TD border="0">33</TD></TR>
+</TABLE>>];
+}
+
+ subgraph cluster_cellpadding {
+ label="table border:10,cellspacing:10,cellpadding:10,cell border:3";
+ node [shape=plaintext]
+ tbl1111 [label=<
+ <TABLE border="10" cellspacing="10" cellpadding="10" style="rounded">
+ <TR><TD border="3">00</TD><TD border="3">01</TD><TD border="3">02</TD><TD border="3">03</TD></TR>
+ <TR><TD border="3">10</TD><TD border="3" rowspan="2">11</TD><TD border="3">12</TD><TD border="3">13</TD></TR>
+ <TR><TD border="3">20</TD><TD border="3" colspan="2">22</TD></TR>
+ <TR><TD border="3">30</TD><TD border="3">31</TD><TD border="3">32</TD><TD border="3">33</TD></TR>
+</TABLE>>];
+}
+
+}
--- /dev/null
+digraph G {
+ subgraph cluster_base{
+ label = "table border:0,cellspacing:0,cellpadding:0,cell border:0";
+ node [shape=plaintext,rank=min]
+ tbl0000 [label=<
+ <TABLE border="0" cellspacing="0" cellpadding="0" style="rounded">
+ <TR><TD border="0">00</TD><TD border="0">01</TD><TD border="0">02</TD><TD border="0">03</TD></TR>
+ <TR><TD border="0">10</TD><TD border="0" rowspan="2">11</TD><TD border="1">12</TD><TD border="0">13</TD></TR>
+ <TR><TD border="0">20</TD><TD border="0" colspan="2">22</TD></TR>
+ <TR><TD border="0">30</TD><TD border="0">31</TD><TD border="0">32</TD><TD border="0">33</TD></TR>
+</TABLE>>];
+}
+
+ subgraph cluster_table_border {
+ label="table border:10,cellspacing:0,cellpadding:0,cell border:0";
+ node [shape=plaintext]
+ tbl1000 [label=<
+ <TABLE border="10" cellspacing="0" cellpadding="0" style="rounded">
+ <TR><TD border="0">00</TD><TD border="0">01</TD><TD border="0">02</TD><TD border="0">03</TD></TR>
+ <TR><TD border="0">10</TD><TD border="0" rowspan="2">11</TD><TD border="0">12</TD><TD border="0">13</TD></TR>
+ <TR><TD border="0">20</TD><TD border="0" colspan="2">22</TD></TR>
+ <TR><TD border="0">30</TD><TD border="0">31</TD><TD border="0">32</TD><TD border="0">33</TD></TR>
+</TABLE>>];
+}
+
+ subgraph cluster_cellspacing {
+ label="table border:0,cellspacing:10,cellpadding:0,cell border:0";
+ node [shape=plaintext]
+ tbl0100 [label=<
+ <TABLE border="0" cellspacing="10" cellpadding="0" style="rounded">
+ <TR><TD border="0">00</TD><TD border="0">01</TD><TD border="0">02</TD><TD border="0">03</TD></TR>
+ <TR><TD border="0">10</TD><TD border="0" rowspan="2">11</TD><TD border="0">12</TD><TD border="0">13</TD></TR>
+ <TR><TD border="0">20</TD><TD border="0" colspan="2">22</TD></TR>
+ <TR><TD border="0">30</TD><TD border="0">31</TD><TD border="0">32</TD><TD border="0">33</TD></TR>
+</TABLE>>];
+}
+
+ subgraph cluster_cellpadding {
+ label="table border:0,cellspacing:0,cellpadding:10,cell border:0";
+ node [shape=plaintext]
+ tbl0010 [label=<
+ <TABLE border="0" cellspacing="0" cellpadding="10" style="rounded">
+ <TR><TD border="0">00</TD><TD border="0">01</TD><TD border="0">02</TD><TD border="0">03</TD></TR>
+ <TR><TD border="0">10</TD><TD border="0" rowspan="2">11</TD><TD border="0">12</TD><TD border="0">13</TD></TR>
+ <TR><TD border="0">20</TD><TD border="0" colspan="2">22</TD></TR>
+ <TR><TD border="0">30</TD><TD border="0">31</TD><TD border="0">32</TD><TD border="0">33</TD></TR>
+</TABLE>>];
+}
+
+}
--- /dev/null
+digraph G {
+ subgraph cluster_base{
+ label = "table border:0,cellspacing:0,cellpadding:0,cell border:3";
+ node [shape=plaintext]
+ tbl0001 [label=<
+ <TABLE border="0" cellspacing="0" cellpadding="0" style="rounded">
+ <TR><TD border="3">00</TD><TD border="3">01</TD><TD border="3">02</TD><TD border="3">03</TD></TR>
+ <TR><TD border="3">10</TD><TD border="3" rowspan="2">11</TD><TD border="3">12</TD><TD border="3">13</TD></TR>
+ <TR><TD border="3">20</TD><TD border="3" colspan="2">22</TD></TR>
+ <TR><TD border="3">30</TD><TD border="3">31</TD><TD border="3">32</TD><TD border="3">33</TD></TR>
+</TABLE>>];
+}
+
+ subgraph cluster_table_border {
+ label="table border:10,cellspacing:0,cellpadding:0,cell border:3";
+ node [shape=plaintext]
+ tbl1001 [label=<
+ <TABLE border="10" cellspacing="0" cellpadding="0" style="rounded">
+ <TR><TD border="3">00</TD><TD border="3">01</TD><TD border="3">02</TD><TD border="3">03</TD></TR>
+ <TR><TD border="3">10</TD><TD border="3" rowspan="2">11</TD><TD border="3">12</TD><TD border="3">13</TD></TR>
+ <TR><TD border="3">20</TD><TD border="3" colspan="2">22</TD></TR>
+ <TR><TD border="3">30</TD><TD border="3">31</TD><TD border="3">32</TD><TD border="3">33</TD></TR>
+</TABLE>>];
+}
+
+ subgraph cluster_cellspacing {
+ label="table border:0,cellspacing:10,cellpadding:0,cell border:3";
+ node [shape=plaintext]
+ tbl0101 [label=<
+ <TABLE border="0" cellspacing="10" cellpadding="0" style="rounded">
+ <TR><TD border="3">00</TD><TD border="3">01</TD><TD border="3">02</TD><TD border="3">03</TD></TR>
+ <TR><TD border="3">10</TD><TD border="3" rowspan="2">11</TD><TD border="3">12</TD><TD border="3">13</TD></TR>
+ <TR><TD border="3">20</TD><TD border="3" colspan="2">22</TD></TR>
+ <TR><TD border="3">30</TD><TD border="3">31</TD><TD border="3">32</TD><TD border="3">33</TD></TR>
+</TABLE>>];
+}
+
+ subgraph cluster_cellpadding {
+ label="table border:0,cellspacing:0,cellpadding:10,cell border:3";
+ node [shape=plaintext]
+ tbl0011 [label=<
+ <TABLE border="0" cellspacing="0" cellpadding="10" style="rounded">
+ <TR><TD border="3">00</TD><TD border="3">01</TD><TD border="3">02</TD><TD border="3">03</TD></TR>
+ <TR><TD border="3">10</TD><TD border="3" rowspan="2">11</TD><TD border="3">12</TD><TD border="3">13</TD></TR>
+ <TR><TD border="3">20</TD><TD border="3" colspan="2">22</TD></TR>
+ <TR><TD border="3">30</TD><TD border="3">31</TD><TD border="3">32</TD><TD border="3">33</TD></TR>
+</TABLE>>];
+}
+
+}
--- /dev/null
+digraph G {
+ subgraph cluster_base{
+ label = "table border:10,cellspacing:10,cellpadding:0,cell border:0";
+ node [shape=plaintext]
+ tbl1100 [label=<
+ <TABLE border="10" cellspacing="10" cellpadding="0">
+ <TR><TD border="0">00</TD><TD border="0">01</TD><TD border="0">02</TD><TD border="0">03</TD></TR>
+ <TR><TD border="0">10</TD><TD border="0" rowspan="2">11</TD><TD border="0">12</TD><TD border="0">13</TD></TR>
+ <TR><TD border="0">20</TD><TD border="0" colspan="2">22</TD></TR>
+ <TR><TD border="0">30</TD><TD border="0">31</TD><TD border="0">32</TD><TD border="0">33</TD></TR>
+</TABLE>>];
+}
+
+ subgraph cluster_table_border {
+ label="table border:10,cellspacing:0,cellpadding:10,cell border:0";
+ node [shape=plaintext]
+ tbl1010 [label=<
+ <TABLE border="10" cellspacing="0" cellpadding="10">
+ <TR><TD border="0">00</TD><TD border="0">01</TD><TD border="0">02</TD><TD border="0">03</TD></TR>
+ <TR><TD border="0">10</TD><TD border="0" rowspan="2">11</TD><TD border="0">12</TD><TD border="0">13</TD></TR>
+ <TR><TD border="0">20</TD><TD border="0" colspan="2">22</TD></TR>
+ <TR><TD border="0">30</TD><TD border="0">31</TD><TD border="0">32</TD><TD border="0">33</TD></TR>
+</TABLE>>];
+}
+
+ subgraph cluster_cellspacing {
+ label="table border:10,cellspacing:10,cellpadding:10,cell border:0";
+ node [shape=plaintext]
+ tbl1110 [label=<
+ <TABLE border="10" cellspacing="10" cellpadding="10">
+ <TR><TD border="0">00</TD><TD border="0">01</TD><TD border="0">02</TD><TD border="0">03</TD></TR>
+ <TR><TD border="0">10</TD><TD border="0" rowspan="2">11</TD><TD border="0">12</TD><TD border="0">13</TD></TR>
+ <TR><TD border="0">20</TD><TD border="0" colspan="2">22</TD></TR>
+ <TR><TD border="0">30</TD><TD border="0">31</TD><TD border="0">32</TD><TD border="0">33</TD></TR>
+</TABLE>>];
+}
+
+ subgraph cluster_cellpadding {
+ label="table border:10,cellspacing:10,cellpadding:10,cell border:3";
+ node [shape=plaintext]
+ tbl1111 [label=<
+ <TABLE border="10" cellspacing="10" cellpadding="10">
+ <TR><TD border="3">00</TD><TD border="3">01</TD><TD border="3">02</TD><TD border="3">03</TD></TR>
+ <TR><TD border="3">10</TD><TD border="3" rowspan="2">11</TD><TD border="3">12</TD><TD border="3">13</TD></TR>
+ <TR><TD border="3">20</TD><TD border="3" colspan="2">22</TD></TR>
+ <TR><TD border="3">30</TD><TD border="3">31</TD><TD border="3">32</TD><TD border="3">33</TD></TR>
+</TABLE>>];
+}
+
+}
--- /dev/null
+digraph G {
+ subgraph cluster_base{
+ label = "table border:0,cellspacing:0,cellpadding:0,cell border:0";
+ node [shape=plaintext,rank=min]
+ tbl0000 [label=<
+ <TABLE border="0" cellspacing="0" cellpadding="0">
+ <TR><TD border="0">00</TD><TD border="0">01</TD><TD border="0">02</TD><TD border="0">03</TD></TR>
+ <TR><TD border="0">10</TD><TD border="0" rowspan="2">11</TD><TD border="1">12</TD><TD border="0">13</TD></TR>
+ <TR><TD border="0">20</TD><TD border="0" colspan="2">22</TD></TR>
+ <TR><TD border="0">30</TD><TD border="0">31</TD><TD border="0">32</TD><TD border="0">33</TD></TR>
+</TABLE>>];
+}
+
+ subgraph cluster_table_border {
+ label="table border:1,cellspacing:0,cellpadding:0,cell border:0";
+ node [shape=plaintext]
+ tbl1000 [label=<
+ <TABLE border="1" cellspacing="0" cellpadding="0">
+ <TR><TD border="0">00</TD><TD border="0">01</TD><TD border="0">02</TD><TD border="0">03</TD></TR>
+ <TR><TD border="0">10</TD><TD border="0" rowspan="2">11</TD><TD border="0">12</TD><TD border="0">13</TD></TR>
+ <TR><TD border="0">20</TD><TD border="0" colspan="2">22</TD></TR>
+ <TR><TD border="0">30</TD><TD border="0">31</TD><TD border="0">32</TD><TD border="0">33</TD></TR>
+</TABLE>>];
+}
+
+ subgraph cluster_cellspacing {
+ label="table border:1,cellspacing:10,cellpadding:0,cell border:0";
+ node [shape=plaintext]
+ tbl1100 [label=<
+ <TABLE border="1" cellspacing="10" cellpadding="0">
+ <TR><TD border="0">00</TD><TD border="0">01</TD><TD border="0">02</TD><TD border="0">03</TD></TR>
+ <TR><TD border="0">10</TD><TD border="0" rowspan="2">11</TD><TD border="0">12</TD><TD border="0">13</TD></TR>
+ <TR><TD border="0">20</TD><TD border="0" colspan="2">22</TD></TR>
+ <TR><TD border="0">30</TD><TD border="0">31</TD><TD border="0">32</TD><TD border="0">33</TD></TR>
+</TABLE>>];
+}
+
+ subgraph cluster_cellpadding {
+ label="table border:1,cellspacing:0,cellpadding:10,cell border:0";
+ node [shape=plaintext]
+ tbl1010 [label=<
+ <TABLE border="1" cellspacing="0" cellpadding="10">
+ <TR><TD border="0">00</TD><TD border="0">01</TD><TD border="0">02</TD><TD border="0">03</TD></TR>
+ <TR><TD border="0">10</TD><TD border="0" rowspan="2">11</TD><TD border="0">12</TD><TD border="0">13</TD></TR>
+ <TR><TD border="0">20</TD><TD border="0" colspan="2">22</TD></TR>
+ <TR><TD border="0">30</TD><TD border="0">31</TD><TD border="0">32</TD><TD border="0">33</TD></TR>
+</TABLE>>];
+}
+
+}
--- /dev/null
+digraph G {
+ subgraph cluster_base{
+ label = "table border:0,cellspacing:0,cellpadding:0,cell border:3";
+ node [shape=plaintext]
+ tbl0001 [label=<
+ <TABLE border="0" cellspacing="0" cellpadding="0">
+ <TR><TD border="3">00</TD><TD border="3">01</TD><TD border="3">02</TD><TD border="3">03</TD></TR>
+ <TR><TD border="3">10</TD><TD border="3" rowspan="2">11</TD><TD border="3">12</TD><TD border="3">13</TD></TR>
+ <TR><TD border="3">20</TD><TD border="3" colspan="2">22</TD></TR>
+ <TR><TD border="3">30</TD><TD border="3">31</TD><TD border="3">32</TD><TD border="3">33</TD></TR>
+</TABLE>>];
+}
+
+ subgraph cluster_table_border {
+ label="table border:10,cellspacing:0,cellpadding:0,cell border:3";
+ node [shape=plaintext]
+ tbl1001 [label=<
+ <TABLE border="10" cellspacing="0" cellpadding="0">
+ <TR><TD border="3">00</TD><TD border="3">01</TD><TD border="3">02</TD><TD border="3">03</TD></TR>
+ <TR><TD border="3">10</TD><TD border="3" rowspan="2">11</TD><TD border="3">12</TD><TD border="3">13</TD></TR>
+ <TR><TD border="3">20</TD><TD border="3" colspan="2">22</TD></TR>
+ <TR><TD border="3">30</TD><TD border="3">31</TD><TD border="3">32</TD><TD border="3">33</TD></TR>
+</TABLE>>];
+}
+
+ subgraph cluster_cellspacing {
+ label="table border:1,cellspacing:10,cellpadding:0,cell border:3";
+ node [shape=plaintext]
+ tbl1101 [label=<
+ <TABLE border="1" cellspacing="10" cellpadding="0">
+ <TR><TD border="3">00</TD><TD border="3">01</TD><TD border="3">02</TD><TD border="3">03</TD></TR>
+ <TR><TD border="3">10</TD><TD border="3" rowspan="2">11</TD><TD border="3">12</TD><TD border="3">13</TD></TR>
+ <TR><TD border="3">20</TD><TD border="3" colspan="2">22</TD></TR>
+ <TR><TD border="3">30</TD><TD border="3">31</TD><TD border="3">32</TD><TD border="3">33</TD></TR>
+</TABLE>>];
+}
+
+ subgraph cluster_cellpadding {
+ label="table border:1,cellspacing:0,cellpadding:10,cell border:3";
+ node [shape=plaintext]
+ tbl1011 [label=<
+ <TABLE border="1" cellspacing="0" cellpadding="10">
+ <TR><TD border="3">00</TD><TD border="3">01</TD><TD border="3">02</TD><TD border="3">03</TD></TR>
+ <TR><TD border="3">10</TD><TD border="3" rowspan="2">11</TD><TD border="3">12</TD><TD border="3">13</TD></TR>
+ <TR><TD border="3">20</TD><TD border="3" colspan="2">22</TD></TR>
+ <TR><TD border="3">30</TD><TD border="3">31</TD><TD border="3">32</TD><TD border="3">33</TD></TR>
+</TABLE>>];
+}
+
+}
--- /dev/null
+# Graphviz test suite
+# Tests are separated by blank or comment lines.
+# Tests have the following syntax:
+# testname
+# Test input (one-line graph or name of .gv file or =)
+# In the last case, the input file is taken as testname.gv
+# One or more subtests of the form:
+# layout_alg output_format additional_flags
+#
+# For example, the test
+# Shapes
+# shapes.gv
+# dot ps
+# neato png "-Gsize=3,3 -Ncolor=red"
+# specifies the "shapes" test, using shapes.gv as input, and
+# run "dot -Tps" and "neato -Tpng -Gsize=3,3 -Ncolor=red" on the input.
+
+rd_tbl_basic
+=
+dot png
+
+rd_tbl_border
+=
+dot png
+
+rd_tbl_all
+=
+dot png
+
+sq_tbl_basic
+=
+dot png
+
+sq_tbl_border
+=
+dot png
+
+sq_tbl_all
+=
+dot png
+
+
+
+