From: ellson Date: Tue, 18 Oct 2005 21:09:28 +0000 (+0000) Subject: Fix shape code so that user shapes not using a file don't produce a X-Git-Tag: LAST_LIBGRAPH~32^2~7087 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1f86fe07ff3d47ae938e4d473a46c279f8f3f4b5;p=graphviz Fix shape code so that user shapes not using a file don't produce a warning message; relax PDF limits based on the standard. --- diff --git a/lib/common/psgen.c b/lib/common/psgen.c index 9bd4f6b12..0b91d9b94 100644 --- a/lib/common/psgen.c +++ b/lib/common/psgen.c @@ -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" diff --git a/lib/common/shapes.c b/lib/common/shapes.c index eca9ec997..508b55f5f 100644 --- a/lib/common/shapes.c +++ b/lib/common/shapes.c @@ -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 : ""), 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); } diff --git a/lib/gvc/gvusershape.c b/lib/gvc/gvusershape.c index 81376b9ef..d333ad4c1 100644 --- a/lib/gvc/gvusershape.c +++ b/lib/gvc/gvusershape.c @@ -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 */