From: ellson Date: Mon, 3 Mar 2008 19:23:44 +0000 (+0000) Subject: Fix # 1300 - add support for labelloc=[t|c|b] in nodes X-Git-Tag: LAST_LIBGRAPH~32^2~4599 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7a787b3b3244c58be15a24d0b170538a41681702;p=graphviz Fix # 1300 - add support for labelloc=[t|c|b] in nodes --- diff --git a/lib/common/labels.c b/lib/common/labels.c index a87142c9b..caa58443f 100644 --- a/lib/common/labels.c +++ b/lib/common/labels.c @@ -203,7 +203,7 @@ void emit_label(GVJ_t * job, emit_state_t emit_state, textlabel_t * lp) right_x = center_x + halfwidth_x; /* position for first para */ - p.y += lp->dimen.y / 2. - lp->fontsize; + p.y += (lp->dimen.y + lp->d.y) / 2.0 - lp->fontsize; gvrender_begin_context(job); gvrender_set_pencolor(job, lp->fontcolor); diff --git a/lib/common/shapes.c b/lib/common/shapes.c index 021ef3f67..59a84167a 100644 --- a/lib/common/shapes.c +++ b/lib/common/shapes.c @@ -855,9 +855,16 @@ static void poly_init(node_t * n) /* adjust text justification */ if (!mapbool(late_string(n, N_nojustify, "false"))) { if (width > bb.x) - ND_label(n)->d.x = width - bb.x; - if (height > bb.y) + ND_label(n)->d.x = width - bb.x; + if (height > bb.y) { + p = agget(n, "labelloc"); + if (p && (p[0] == 'b')) + ND_label(n)->d.y = -(height - bb.y); + else if (p && (p[0] == 't')) ND_label(n)->d.y = height - bb.y; + else + ND_label(n)->d.y = 0; + } } /* increase node size to width/height if needed */