From e3f714ec3b119e10fea068d5202ea573ea01cba9 Mon Sep 17 00:00:00 2001 From: "Emden R. Gansner" Date: Fri, 30 Aug 2013 15:27:07 -0400 Subject: [PATCH] Fix bug 2345 --- lib/common/arrows.c | 5 +++-- lib/common/htmltable.c | 35 ++++++++++++++++++++++++++++++++++- 2 files changed, 37 insertions(+), 3 deletions(-) diff --git a/lib/common/arrows.c b/lib/common/arrows.c index 1667557ac..3532433a2 100644 --- a/lib/common/arrows.c +++ b/lib/common/arrows.c @@ -171,10 +171,11 @@ static void arrow_match_name(char *name, int *flag) int i, f; *flag = 0; - for (i = 0; *rest != '\0' && i < NUMB_OF_ARROW_HEADS; i++) { + for (i = 0; *rest != '\0' && i < NUMB_OF_ARROW_HEADS; ) { f = ARR_TYPE_NONE; rest = arrow_match_shape(rest, &f); - *flag |= (f << (i * BITS_PER_ARROW)); + if (f != ARR_TYPE_NONE) + *flag |= (f << (i++ * BITS_PER_ARROW)); } } diff --git a/lib/common/htmltable.c b/lib/common/htmltable.c index 1d8ac4e7b..f36ae7636 100644 --- a/lib/common/htmltable.c +++ b/lib/common/htmltable.c @@ -677,14 +677,47 @@ static void freeObj(GVJ_t * job) pop_obj_state(job); } +static double +heightOfLbl (htmllabel_t * lp) +{ + double sz; + + switch (lp->kind) { + case HTML_TBL: + sz = lp->u.tbl->data.box.UR.y - lp->u.tbl->data.box.LL.y; + break; + case HTML_IMAGE: + sz = lp->u.img->box.UR.y - lp->u.img->box.LL.y; + break; + case HTML_TEXT: + sz = lp->u.txt->box.UR.y - lp->u.txt->box.LL.y; + break; + } + return sz; +} + /* emit_html_label: */ void emit_html_label(GVJ_t * job, htmllabel_t * lp, textlabel_t * tp) { htmlenv_t env; + pointf p; allocObj(job); - env.pos = tp->pos; + + p = tp->pos; + switch (tp->valign) { + case 't': + p.y = tp->pos.y + (tp->space.y - heightOfLbl(lp))/ 2.0 - 1; + break; + case 'b': + p.y = tp->pos.y - (tp->space.y - heightOfLbl(lp))/ 2.0 - 1; + break; + default: + /* no-op */ + break; + } + env.pos = p; env.finfo.color = tp->fontcolor; env.finfo.name = tp->fontname; env.finfo.size = tp->fontsize; -- 2.40.0