]> granicus.if.org Git - graphviz/commitdiff
Fix bug 2040
authorerg <devnull@localhost>
Tue, 28 Sep 2010 20:17:55 +0000 (20:17 +0000)
committererg <devnull@localhost>
Tue, 28 Sep 2010 20:17:55 +0000 (20:17 +0000)
lib/common/htmltable.c

index 9420daec202294b0286363994c4d426864ac311a..73e52e06323bc47a3cd4819fa440f2ec6d5b24b8 100644 (file)
@@ -1350,6 +1350,31 @@ static void pos_html_cell(htmlcell_t * cp, boxf pos, int sides)
     if (cp->child.kind == HTML_TBL) {
        pos_html_tbl(cp->child.u.tbl, cbox, sides);
     } else if (cp->child.kind == HTML_IMAGE) {
+       /* Note that alignment trumps scaling */
+       oldsz = cp->child.u.img->box.UR;
+       delx = (cbox.UR.x - cbox.LL.x) - oldsz.x;
+       if (delx > 0) {
+           switch (cp->data.flags & HALIGN_MASK) {
+           case HALIGN_LEFT:
+               cbox.UR.x -= delx;
+               break;
+           case HALIGN_RIGHT:
+               cbox.LL.x += delx;
+               break;
+           }
+       }
+
+       dely = (cbox.UR.y - cbox.LL.y) - oldsz.y;
+       if (dely > 0) {
+           switch (cp->data.flags & VALIGN_MASK) {
+           case VALIGN_BOTTOM:
+               cbox.UR.y -= dely;
+               break;
+           case VALIGN_TOP:
+               cbox.LL.y += dely;
+               break;
+           }
+       }
        pos_html_img(cp->child.u.img, cbox);
     } else {
        char dfltalign;