]> granicus.if.org Git - graphviz/commitdiff
Fix nojustify bug
authorerg <devnull@localhost>
Fri, 25 Mar 2011 18:03:04 +0000 (18:03 +0000)
committererg <devnull@localhost>
Fri, 25 Mar 2011 18:03:04 +0000 (18:03 +0000)
lib/common/shapes.c

index 1c0789440ed089c63a5610e2d84ca466fcfbcffb..7369ce46bfebe8b2d97ab1e158e33d961b109a7c 100644 (file)
@@ -888,15 +888,19 @@ static void poly_init(node_t * n)
     }
 
     /* Compute space available for label.  Provides the justification borders */
-    if (!mapbool(late_string(n, N_nojustify, "false")) && (dimen.y < bb.y)) {
-       if (isBox)
-           temp = bb.x;
-       else
+    if (!mapbool(late_string(n, N_nojustify, "false"))) {
+       if (isBox) {
+           ND_label(n)->space.x = MAX(dimen.x,bb.x) - spacex;
+       }
+       else if (dimen.y < bb.y) {
            temp = bb.x * sqrt(1.0 - SQR(dimen.y) / SQR(bb.y));
+           ND_label(n)->space.x = MAX(dimen.x,temp) - spacex;
+        }
+       else
+           ND_label(n)->space.x = dimen.x - spacex;
     } else {
-       temp = dimen.x;
+       ND_label(n)->space.x = dimen.x - spacex;
     }
-    ND_label(n)->space.x = temp - spacex;
 
 
     temp = bb.y - min_bb.y;