From 314a3973c5591fb738b829b4d7635879585d0260 Mon Sep 17 00:00:00 2001 From: erg Date: Sat, 3 Mar 2007 21:55:23 +0000 Subject: [PATCH] Add user control over pad values. --- lib/common/emit.c | 33 ++++++++++++++++++++++++++------- lib/gvc/gvcint.h | 3 ++- 2 files changed, 28 insertions(+), 8 deletions(-) diff --git a/lib/common/emit.c b/lib/common/emit.c index a355d55c4..739df17f3 100644 --- a/lib/common/emit.c +++ b/lib/common/emit.c @@ -1724,6 +1724,18 @@ static void init_gvc(GVC_t * gvc, graph_t * g) } } + /* pad */ + gvc->graph_sets_pad = FALSE; + if ((p = agget(g, "pad"))) { + i = sscanf(p, "%lf,%lf", &xf, &yf); + if (i > 0) { + gvc->pad.x = gvc->pad.y = xf * POINTS_PER_INCH; + if (i > 1) + gvc->pad.y = yf * POINTS_PER_INCH; + gvc->graph_sets_pad = TRUE; + } + } + /* pagesize */ gvc->graph_sets_pageSize = FALSE; P2PF(GD_drawing(g)->page, gvc->pageSize); @@ -1767,13 +1779,20 @@ static void init_gvc(GVC_t * gvc, graph_t * g) static void init_job_pad(GVJ_t *job) { - switch (job->output_lang) { - case GVRENDER_PLUGIN: - job->pad.x = job->pad.y = job->render.features->default_pad; - break; - default: - job->pad.x = job->pad.y = DEFAULT_GRAPH_PAD; - break; + GVC_t *gvc = job->gvc; + + if (gvc->graph_sets_pad) { + job->pad = gvc->pad; + } + else { + switch (job->output_lang) { + case GVRENDER_PLUGIN: + job->pad.x = job->pad.y = job->render.features->default_pad; + break; + default: + job->pad.x = job->pad.y = DEFAULT_GRAPH_PAD; + break; + } } } diff --git a/lib/gvc/gvcint.h b/lib/gvc/gvcint.h index 12f00ae2f..a5fef9d3b 100644 --- a/lib/gvc/gvcint.h +++ b/lib/gvc/gvcint.h @@ -111,11 +111,12 @@ extern "C" { /* pagination */ char *pagedir; /* pagination order */ pointf margin; /* margins in graph units */ + pointf pad; /* pad in graph units */ pointf pageSize; /* pageSize in graph units, not including margins */ point pb; /* page size - including margins (inches) */ boxf bb; /* graph bb in graph units, not including margins */ int rotation; /* rotation - 0 = portrait, 90 = landscape */ - boolean graph_sets_margin, graph_sets_pageSize, graph_sets_rotation; + boolean graph_sets_pad, graph_sets_margin, graph_sets_pageSize, graph_sets_rotation; /* layers */ char *layerDelims; /* delimiters in layer names */ -- 2.40.0