From: erg Date: Tue, 13 Oct 2009 20:16:54 +0000 (+0000) Subject: Allow a single value for size and page attributes. X-Git-Tag: LAST_LIBGRAPH~32^2~1658 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3e4fa873494469c599458c13d8414811e6681ab3;p=graphviz Allow a single value for size and page attributes. --- diff --git a/doc/info/attrs.html b/doc/info/attrs.html index d788762e9..b68e4f190 100644 --- a/doc/info/attrs.html +++ b/doc/info/attrs.html @@ -328,7 +328,7 @@ This field indicates which graph component uses the attribute. Gdouble
pointf 0.0555 (4 points) page -Gpointf +Gdouble
pointf pagedir Gpagedir @@ -402,7 +402,7 @@ This field indicates which graph component uses the attribute. sides Nint40 size -Gpointf +Gdouble
pointf skew Ndouble0.0-100.0 @@ -1272,7 +1272,10 @@ This field indicates which graph component uses the attribute. the boundary of the drawn region.
page -
Width and height of output pages, in inches. If this is set and is +
Width and height of output pages, in inches. If only a single value + is given, this is used for both the width and height. +

+ If this is set and is smaller than the size of the layout, a rectangular array of pages of the specified page size is overlaid on the layout, with origins aligned in the lower-left corner, thereby partitioning the layout @@ -1528,7 +1531,11 @@ This field indicates which graph component uses the attribute.

size
Maximum width and height of drawing, in inches. - If defined and the drawing is too large, the drawing is uniformly + If only a single number is given, this is used for both the width + and the height. +

+ If defined and the drawing is larger than the given size, + the drawing is uniformly scaled down so that it fits within the given size.

If size ends in an exclamation point (!), diff --git a/doc/infosrc/attrs b/doc/infosrc/attrs index a0b032912..901d25be2 100644 --- a/doc/infosrc/attrs +++ b/doc/infosrc/attrs @@ -751,8 +751,11 @@ drawing and will be filled with the background color, if appropriate. Normally, a small pad is used for aesthetic reasons, especially when a background color is used, to avoid having nodes and edges abutting the boundary of the drawn region. -:page:G:pointf; -Width and height of output pages, in inches. If this is set and is +:page:G:double/pointf; +Width and height of output pages, in inches. If only a single value +is given, this is used for both the width and height. +

+If this is set and is smaller than the size of the layout, a rectangular array of pages of the specified page size is overlaid on the layout, with origins aligned in the lower-left corner, thereby partitioning the layout @@ -977,9 +980,13 @@ Print guide boxes in PostScript at the beginning of routesplines if 1, or at the end if 2. (Debugging) :sides:N:int:4:0; Number of sides if shape=polygon. -:size:G:pointf; +:size:G:double/pointf; Maximum width and height of drawing, in inches. -If defined and the drawing is too large, the drawing is uniformly +If only a single number is given, this is used for both the width +and the height. +

+If defined and the drawing is larger than the given size, +the drawing is uniformly scaled down so that it fits within the given size.

If size ends in an exclamation point (!), diff --git a/lib/common/input.c b/lib/common/input.c index e4794add2..53a47ac9a 100644 --- a/lib/common/input.c +++ b/lib/common/input.c @@ -433,7 +433,8 @@ void dotneato_args_initialize(GVC_t * gvc, int argc, char **argv) } /* getdoubles2ptf: - * converts a graph attribute to floating graph units (POINTS). + * converts a graph attribute in inches to a pointf in points. + * If only one number is given, it is used for both x and y. * Returns true if the attribute ends in '!'. */ static boolean getdoubles2ptf(graph_t * g, char *name, pointf * result) @@ -452,6 +453,14 @@ static boolean getdoubles2ptf(graph_t * g, char *name, pointf * result) if (c == '!') rv = TRUE; } + else { + c = '\0'; + i = sscanf(p, "%lf%c", &xf, &c); + if ((i > 0) && (xf > 0)) { + `result->y = result->x = POINTS(xf); + if (c == '!') rv = TRUE; + } + } } return rv; }