]> granicus.if.org Git - graphviz/commitdiff
Fix shape code so that user shapes not using a file don't produce a
authorellson <devnull@localhost>
Tue, 18 Oct 2005 21:09:28 +0000 (21:09 +0000)
committerellson <devnull@localhost>
Tue, 18 Oct 2005 21:09:28 +0000 (21:09 +0000)
warning message; relax PDF limits based on the standard.

lib/common/psgen.c
lib/common/shapes.c
lib/gvc/gvusershape.c

index 9bd4f6b1264f1fe9cce327bbe86be3717ce40ec3..0b91d9b944c6cd7aa48d31a9fb239b046ba9a6b5 100644 (file)
@@ -19,7 +19,7 @@
         dot files with URL attributes will get active PDF links
         from Adobe's Distiller.
  */
-#define        PDFMAX  3240            /*  Maximum size of Distiller's PDF canvas  */
+#define        PDFMAX  14400           /*  Maximum size of PDF page  */
 
 #include "render.h"
 #include "ps.h"
index eca9ec9972600f33a6ce153b910c06cbc1601b1b..508b55f5fcb1d5e07fa2bc812949011526c2c21e 100644 (file)
@@ -542,15 +542,24 @@ static void poly_init(node_t * n)
     } else {
        if (ND_shape(n)->usershape) {
            point imagesize;
-           char *sfile = agget(n, "shapefile");
 
-           imagesize = image_size(n->graph, sfile);
-           if ((imagesize.x == -1) && (imagesize.y == -1)) {
-               agerr(AGERR,
+               /* custom requires a shapefile
+                 * not custom is an adaptable user shape such as a postscript
+                 * function.
+                 */
+           if (strcmp(ND_shape(n)->name, "custom")) {
+               imagesize.x = imagesize.y = 0;
+           }
+           else {
+               char *sfile = agget(n, "shapefile");
+               imagesize = image_size(n->graph, sfile);
+               if ((imagesize.x == -1) && (imagesize.y == -1)) {
+                   agerr(AGERR,
                      "No or improper shapefile=\"%s\" for node \"%s\"\n",
                      (sfile ? sfile : "<nil>"), n->name);
-           } else
-               GD_has_images(n->graph) = 1;
+               } else
+                   GD_has_images(n->graph) = 1;
+           }
            dimen.x = MAX(dimen.x, imagesize.x);
            dimen.y = MAX(dimen.y, imagesize.y);
        }
index 81376b9ef702def3610630075309743701878755..d333ad4c18ca979888dd6304434cf81b611a7b3d 100644 (file)
@@ -67,8 +67,6 @@ int gvusershape_select(GVC_t * gvc, char *usershape)
  * this file type
  * Returns the size required for the shape in points;
  * returns (-1,-1) on error;
- * returns (0,0) to indicate "don't care". For example, in
- * postscript, a node can have a user-defined shape but no shapefile.
  */
 point image_size(graph_t * g, char *shapefile)
 {
@@ -76,14 +74,10 @@ point image_size(graph_t * g, char *shapefile)
     point rv;
 
     /* no shape file, no shape size */
-    if (!shapefile) {
+    if (!shapefile || (*shapefile == '\0')) {
         rv.x = rv.y = -1;
         return rv;
     }
-    if (*shapefile == '\0') {
-        rv.x = rv.y = 0;
-        return rv;              /* no shapefile; probably postscript custom */
-    }
     if (!strncasecmp(shapefile, "http://", 7)) {
         rv.x = rv.y = 0;
         return rv;              /* punt on obvious web addresses */