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));
}
}
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;