From: ellson Date: Sun, 30 Jul 2006 02:18:43 +0000 (+0000) Subject: - invis style was getting stuck in -Tps X-Git-Tag: LAST_LIBGRAPH~32^2~6018 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ea8a9a53139ed527ee632e305eefd932c84ca3ff;p=graphviz - invis style was getting stuck in -Tps - pagesize now includes margins, so -Gpage="8.5,11" is good --- diff --git a/lib/common/emit.c b/lib/common/emit.c index ce5c08745..d5c6d851f 100644 --- a/lib/common/emit.c +++ b/lib/common/emit.c @@ -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; diff --git a/lib/gvc/gvcjob.h b/lib/gvc/gvcjob.h index a2f6f51fe..3f7f029d6 100644 --- a/lib/gvc/gvcjob.h +++ b/lib/gvc/gvcjob.h @@ -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 */ diff --git a/lib/gvc/gvrender.c b/lib/gvc/gvrender.c index 9c6581796..d8d15038a 100644 --- a/lib/gvc/gvrender.c +++ b/lib/gvc/gvrender.c @@ -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")) diff --git a/plugin/core/gvrender_core_ps.c b/plugin/core/gvrender_core_ps.c index e24da6817..cae5794fa 100644 --- a/plugin/core/gvrender_core_ps.c +++ b/plugin/core/gvrender_core_ps.c @@ -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);