]> granicus.if.org Git - graphviz/commitdiff
- invis style was getting stuck in -Tps
authorellson <devnull@localhost>
Sun, 30 Jul 2006 02:18:43 +0000 (02:18 +0000)
committerellson <devnull@localhost>
Sun, 30 Jul 2006 02:18:43 +0000 (02:18 +0000)
- pagesize now includes margins, so -Gpage="8.5,11" is good

lib/common/emit.c
lib/gvc/gvcjob.h
lib/gvc/gvrender.c
plugin/core/gvrender_core_ps.c

index ce5c087451d4745e948fbe3c9d349360c6eac8f0..d5c6d851f2b8bb2d123498cd28683c1f95205af3 100644 (file)
@@ -178,6 +178,8 @@ static void init_job_pagination(GVJ_t * job, graph_t *g)
     pointf imageSize;  /* image size on one page of the graph - points */
     pointf margin;     /* margin for a page of the graph - points */
 
+    margin = job->margin;
+
     /* unpaginated image size in device units */
     imageSize = job->view;
     if (job->rotation)
@@ -186,7 +188,8 @@ static void init_job_pagination(GVJ_t * job, graph_t *g)
     /* determine pagination */
     if (gvc->graph_sets_pageSize) {
        /* page was set by user */
-       pageSize = gvc->pageSize;
+       pageSize.x = gvc->pageSize.x - 2 * margin.x;
+       pageSize.y = gvc->pageSize.y - 2 * margin.y;
 
        /* we don't want graph page to exceed its bounding box */
        pageSize.x = MIN(pageSize.x, imageSize.x);
@@ -208,23 +211,17 @@ static void init_job_pagination(GVJ_t * job, graph_t *g)
        }
        job->numPages = job->pagesArraySize.x * job->pagesArraySize.y;
 
-       /* find the drawable size in device coords */
+       /* find the drawable size in points */
        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;
-       pageSize.y = DEFAULT_PAGEHT;
+       pageSize.x = DEFAULT_PAGEWD - 2 * margin.x;
+       pageSize.y = DEFAULT_PAGEHT - 2 * margin.y;
        job->pagesArraySize.x = job->pagesArraySize.y = job->numPages = 1;
     }
 
-    /* size of one page in graph units */
-    job->pageSize.x = imageSize.x / job->zoom;
-    job->pageSize.y = imageSize.y / job->zoom;
-
-    PF2P(job->margin, margin);
-
     /* determine page box including centering */
     if (GD_drawing(g)->centered) {
        if (pageSize.x > imageSize.x)
@@ -233,11 +230,16 @@ static void init_job_pagination(GVJ_t * job, graph_t *g)
            margin.y += (pageSize.y - imageSize.y) / 2;
     }
 
+    /* canvas area, centered if necessary */
     job->canvasBox.LL.x = margin.x;
     job->canvasBox.LL.y = margin.y;
     job->canvasBox.UR.x = margin.x + imageSize.x;
     job->canvasBox.UR.y = margin.y + imageSize.y;
 
+    /* size of one page in graph units */
+    job->pageSize.x = imageSize.x / job->zoom;
+    job->pageSize.y = imageSize.y / job->zoom;
+
     /* set up pagedir */
     job->pagesArrayMajor.x = job->pagesArrayMajor.y 
                = job->pagesArrayMinor.x = job->pagesArrayMinor.y = 0;
index a2f6f51fe47b25a6d9adf72c3dabde9dd8cccb82..3f7f029d6da4243aa589aa3fc82de07bb3572be2 100644 (file)
@@ -45,6 +45,7 @@ extern "C" {
        pen_type pen;
        fill_type fill;
        double penwidth;
+       char **rawstyle;
     } gvstyle_t;
 
 #define EMIT_SORTED (1<<0)
@@ -226,7 +227,6 @@ extern "C" {
        bool external_surface;  /* surface belongs to caller */
 
        gvstyle_t *style;       /* active style from gvc->styles[] */
-       char **rawstyle;
 
         int flags;             /* emit_graph flags */
 
@@ -253,7 +253,7 @@ extern "C" {
        int     rotation;       /* viewport rotation (degrees)  0=portrait, 90=landscape */
 
        pointf  view;           /* viewport size - points */
-       box     canvasBox;      /* drawing area - points */
+       boxf    canvasBox;      /* drawing area - points */
         pointf  margin;                /* job-specific margin - points */
 
        pointf  dpi;            /* device resolution device-units-per-inch */
index 9c6581796f3ce756d94f7dc5b8ed69eda1ed5614..d8d15038ad1628bb7efb1301c3d513beabfd88a9 100644 (file)
@@ -423,9 +423,12 @@ void gvrender_begin_graph(GVJ_t * job, graph_t * g)
 #ifdef WITH_CODEGENS
     else {
        codegen_t *cg = job->codegen;
+       box canvas;
+
+       BF2B(job->canvasBox, canvas);
 
        if (cg && cg->begin_graph)
-           cg->begin_graph(gvc, g, job->canvasBox, gvc->pb);
+           cg->begin_graph(gvc, g, canvas, gvc->pb);
     }
 #endif
 }
@@ -1587,7 +1590,7 @@ void gvrender_set_style(GVJ_t * job, char **s)
     char *line, *p;
     gvstyle_t *style = job->style;
 
-    job->rawstyle = s;
+    job->style->rawstyle = s;
     if (gvre) {
        while ((p = line = *s++)) {
            if (streq(line, "solid"))
index e24da6817c4b17c81fe7b307f3340c7a3c6d1481..cae5794fa830a4114e42522c7074bafa88a7bb75 100644 (file)
@@ -259,7 +259,7 @@ static void
 ps_set_pen_style(GVJ_t *job)
 {
     double penwidth = job->style->penwidth * job->zoom;
-    char *p, *line, **s = job->rawstyle;
+    char *p, *line, **s = job->style->rawstyle;
     FILE *out = job->output_file;
 
     fprintf(out,"%g setlinewidth\n", penwidth);