]> granicus.if.org Git - graphviz/commitdiff
provide default page width/height from renderer to fix problem
authorellson <devnull@localhost>
Fri, 11 Aug 2006 13:18:51 +0000 (13:18 +0000)
committerellson <devnull@localhost>
Fri, 11 Aug 2006 13:18:51 +0000 (13:18 +0000)
  exhibited by graphs/directed/switch.dot
  when -Gcenter -Tpng

lib/common/const.h
lib/common/emit.c
lib/gvc/gvcjob.h
plugin/core/gvrender_core_dot.c
plugin/core/gvrender_core_fig.c
plugin/core/gvrender_core_map.c
plugin/core/gvrender_core_ps.c
plugin/core/gvrender_core_svg.c
plugin/gd/gvrender_gd.c
plugin/gd/gvrender_gd_vrml.c
plugin/pango/gvrender_pango.c

index c0cb40b10029712b2f068196eda9e91571dd6e5c..019e6800cd91ee8c2e24d413e3139be91d97a032 100644 (file)
@@ -86,9 +86,6 @@
 #define                DEFAULT_RANKSEP 0.5
 #define                MIN_RANKSEP             0.02
 
-/* default page size in points - including margins = 8.5in x 11in */
-#define                DEFAULT_PAGEWD  612
-#define                DEFAULT_PAGEHT  792
 /* default margin for paged formats such as PostScript - in points  = 0.5in */
 #define                DEFAULT_PRINT_MARGIN 36
 /* default margin for embedded formats such as PNG - in points */
index be5afd36c7b32e5b84c7afe32719574ea337bb2b..8aefe7d0d6abb420734f5a34d842f3110f3c781e 100644 (file)
@@ -610,10 +610,17 @@ static void init_job_pagination(GVJ_t * job, graph_t *g)
        imageSize.x = MIN(imageSize.x, pageSize.x);
        imageSize.y = MIN(imageSize.y, pageSize.y);
     } else {
-       /* page not set by user, assume default when centering,
-          but allow infinite page for any other interpretation */
-       pageSize.x = DEFAULT_PAGEWD - 2 * margin.x;
-       pageSize.y = DEFAULT_PAGEHT - 2 * margin.y;
+       /* page not set by user, use default from renderer */
+       if (job->render.features) {
+           pageSize.x = job->render.features->default_pagesize.x - 2*margin.x;
+           if (pageSize.x < 0.)
+               pageSize.x = 0.;
+           pageSize.y = job->render.features->default_pagesize.y - 2*margin.y;
+           if (pageSize.y < 0.)
+               pageSize.y = 0.;
+       }
+       else
+           pageSize.x = pageSize.y = 0.;
        job->pagesArraySize.x = job->pagesArraySize.y = job->numPages = 1;
     }
 
index 1cd30963a09592b766a4b466402130c43955919d..2748c076583477226a5859cb7208516b574f150b 100644 (file)
@@ -68,7 +68,7 @@ extern "C" {
        int flags;
        double default_margin;  /* points */
        double default_pad;     /* graph units */
-       point  default_size;    /* default height, width - device units */
+       pointf default_pagesize;/* default page width, height - points */
        pointf default_dpi;
        char **knowncolors;
        int sz_knowncolors;
index f96395b7abe49e0c19f16fc2c3d1c5530d0c106e..478398d2987c5a5d6f0ea24201150c77c3acdc61 100644 (file)
@@ -328,7 +328,7 @@ gvrender_features_t dot_features = {
     0,                         /* flags */
     0.,                                /* default margin - points */
     0.,                         /* default pad - graph units */
-    {0,0},                      /* default height, width - device units */
+    {0.,0.},                   /* default page width, height - points */
     {72.,72.},                 /* default dpi */
     NULL,                      /* knowncolors */
     0,                         /* sizeof knowncolors */
index aa9e2a408646566cdd9f999b9162867aa60c2b38..faad2979399027cb2a877985da8fafb7b8999a35 100644 (file)
@@ -516,7 +516,7 @@ gvrender_features_t fig_features = {
        | GVRENDER_Y_GOES_DOWN, /* flags */
     DEFAULT_EMBED_MARGIN,      /* default margin - points */
     4.,                         /* default pad - graph units */
-    {0,0},                      /* default height, width - device units */
+    {0.,0.},                    /* default page width, height - points */
     {1440.,1440.},             /* default dpi */
         /* FIXME - this default dpi is a very strange number!!!
          * It was picked to make .png usershapes the right size on my screen.
index b496a61aa3287f34d51cc37d0a0ef896cdb948e4..4ea7ac057a13c91776a78005744153dcc1199944 100644 (file)
@@ -286,7 +286,7 @@ static gvrender_features_t map_features = {
        | GVRENDER_DOES_MAP_POLYGON,
     0,                         /* default margin - points */
     4.,                         /* default pad - graph units */
-    {0,0},                      /* default height, width - device units */
+    {0.,0.},                    /* default page width, height - points */
     {96.,96.},                 /* default dpi */
     NULL,                      /* knowncolors */
     0,                         /* sizeof knowncolors */
@@ -304,7 +304,7 @@ static gvrender_features_t map_features_nopoly = {
        | GVRENDER_DOES_MAP_RECTANGLE,
     0,                         /* default margin - points */
     4.,                         /* default pad - graph units */
-    {0,0},                      /* default height, width - device units */
+    {0.,0.},                    /* default page width, height - points */
     {96.,96.},                 /* default dpi */
     NULL,                      /* knowncolors */
     0,                         /* sizeof knowncolors */
index 38a9ddb5a33f3a521e969ed67cfd27dc98b55182..231cca7b0111f9f489793ae22733108dba21cfe7 100644 (file)
@@ -497,7 +497,7 @@ static gvrender_features_t psgen_features = {
        | GVRENDER_DOES_MAP_RECTANGLE,
     36,                                /* default margin - points */
     4.,                         /* default pad - graph units */
-    {0,0},                      /* default height, width - device units */
+    {612.,792.},                /* default page width, height - points */
     {72.,72.},                 /* default dpi */
     NULL,                      /* knowncolors */
     0,                         /* sizeof knowncolors */
index 5cd584499577cf784e40ac398e219e13c411050d..b4fb04cd3810007e6240b7f152a7d5ab973d2e27 100644 (file)
@@ -447,7 +447,7 @@ gvrender_features_t svg_features = {
        | GVRENDER_DOES_TOOLTIPS, /* flags */
     DEFAULT_EMBED_MARGIN,      /* default margin - points */
     4.,                         /* default pad - graph units */
-    {0,0},                      /* default height, width - device units */
+    {0.,0.},                    /* default page width, height - points */
     {96.,96.},                 /* default dpi */
     svg_knowncolors,           /* knowncolors */
     sizeof(svg_knowncolors) / sizeof(char *),  /* sizeof knowncolors */
index 0bd05afb740509696aec7a8b18e29026df6e25c2..7363c6ee43c6a79792bdb180821ed5dd8f518ba2 100644 (file)
@@ -571,7 +571,7 @@ static gvrender_features_t gdgen_features_tc = {
        | GVRENDER_Y_GOES_DOWN, /* flags */
     0,                         /* default margin - points */
     4.,                         /* default pad - graph units */
-    {0,0},                      /* default height, width - device units */
+    {0.,0.},                    /* default page width, height - points */
     {96.,96.},                 /* default dpi */
     NULL,                      /* knowncolors */
     0,                         /* sizeof knowncolors */
@@ -584,7 +584,7 @@ static gvrender_features_t gdgen_features = {
     GVRENDER_Y_GOES_DOWN,      /* flags */
     0,                         /* default margin - points */
     4.,                         /* default pad - graph units */
-    {0,0},                      /* default height, width - device units */
+    {0.,0.},                    /* default page width, height - points */
     {96.,96.},                 /* default dpi */
     NULL,                      /* knowncolors */
     0,                         /* sizeof knowncolors */
index 6977c3a7ae24e76a89ce181985b26bf99643ed33..a879af53a5b6c4126d32c53b262c1729af83f0f0 100644 (file)
@@ -834,7 +834,7 @@ static gvrender_features_t vrml_features = {
     GVRENDER_DOES_Z,           /* flags */
     0,                          /* default margin - points */
     4.,                         /* default pad - graph units */
-    {0,0},                      /* default height, width - device units */
+    {0.,0.},                    /* default page width, height - points */
     {72.,72.},                  /* default dpi */
     NULL,                       /* knowncolors */
     0,                          /* sizeof knowncolors */
index 18bbdb2cf64b340a04db13ee564c44d2994e4145..a05fbeffc929e2c0de451053e7458f35c3477bb7 100644 (file)
@@ -408,7 +408,7 @@ static gvrender_features_t cairogen_features = {
        | GVRENDER_DOES_TRANSFORM, /* flags */
     0,                         /* default margin - points */
     4.,                         /* default pad - graph units */
-    {0,0},                      /* default height, width - device units */
+    {0.,0.},                    /* default page width, height - points */
     {96.,96.},                 /* default dpi */
     0,                         /* knowncolors */
     0,                         /* sizeof knowncolors */
@@ -423,7 +423,7 @@ static gvrender_features_t cairogen_features_ps = {
        | GVRENDER_DOES_TRANSFORM, /* flags */
     36,                                /* default margin - points */
     4.,                         /* default pad - graph units */
-    {0,0},                      /* default height, width - device units */
+    {0.,0.},                    /* default page width, height - points */
     {72.,72.},                 /* postscript 72 dpi */
     0,                         /* knowncolors */
     0,                         /* sizeof knowncolors */
@@ -439,7 +439,7 @@ static gvrender_features_t cairogen_features_x = {
        | GVRENDER_X11_EVENTS,  /* flags */
     0,                         /* default margin - points */
     4.,                         /* default pad - graph units */
-    {0,0},                      /* default height, width - device units */
+    {0.,0.},                    /* default page width, height - points */
     {72.,72.},                 /* default dpi */
     0,                         /* knowncolors */
     0,                         /* sizeof knowncolors */
@@ -455,7 +455,7 @@ static gvrender_features_t cairogen_features_gtk = {
        | GVRENDER_X11_EVENTS,  /* flags */
     0,                         /* default margin - points */
     4.,                         /* default pad - graph units */
-    {0,0},                      /* default height, width - device units */
+    {0.,0.},                    /* default page width, height - points */
     {72.,72.},                 /* default dpi */
     0,                         /* knowncolors */
     0,                         /* sizeof knowncolors */