From a86f8b774b7c622f1a2011b139b5d4c352535b0f Mon Sep 17 00:00:00 2001 From: "Emden R. Gansner" Date: Wed, 31 Jul 2013 13:29:22 -0400 Subject: [PATCH] Provide some decimal precision to xdot coordinates and sizes. --- lib/common/output.c | 2 +- plugin/core/gvrender_core_dot.c | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/common/output.c b/lib/common/output.c index 88508a2f1..a9f393878 100644 --- a/lib/common/output.c +++ b/lib/common/output.c @@ -481,7 +481,7 @@ void attach_attrs(graph_t * g) void output_point(agxbuf *xbuf, pointf p) { char buf[BUFSIZ]; - sprintf(buf, "%d %d ", ROUND(p.x), ROUND(YDIR(p.y))); + sprintf(buf, "%.02f %.02f ", (p.x), (YDIR(p.y))); agxbput(xbuf, buf); } diff --git a/plugin/core/gvrender_core_dot.c b/plugin/core/gvrender_core_dot.c index 42b05717b..ded8a45fd 100644 --- a/plugin/core/gvrender_core_dot.c +++ b/plugin/core/gvrender_core_dot.c @@ -55,7 +55,7 @@ typedef enum { // #pragma comment( lib, "ingraphs.lib" ) #endif -#define XDOTVERSION "1.2" +#define XDOTVERSION "1.3" #define NUMXBUFS (EMIT_HLABEL+1) /* There are as many xbufs as there are values of emit_state_t. @@ -510,7 +510,7 @@ static void xdot_textpara(GVJ_t * job, pointf p, textpara_t * para) char buf[BUFSIZ]; int j; - sprintf(buf, "F %f ", para->fontsize); + sprintf(buf, "F %.01f ", para->fontsize); agxbput(xbufs[emit_state], buf); xdot_str (job, "", para->fontname); xdot_pencolor(job); @@ -529,7 +529,7 @@ static void xdot_textpara(GVJ_t * job, pointf p, textpara_t * para) } agxbput(xbufs[emit_state], "T "); output_point(xbufs[emit_state], p); - sprintf(buf, "%d %d ", j, (int) para->width); + sprintf(buf, "%d %.02f ", j, para->width); agxbput(xbufs[emit_state], buf); xdot_str (job, "", para->str); } @@ -549,7 +549,7 @@ static void xdot_ellipse(GVJ_t * job, pointf * A, int filled) else agxbput(xbufs[emit_state], "e "); output_point(xbufs[emit_state], A[0]); - sprintf(buf, "%d %d ", ROUND(A[1].x - A[0].x), ROUND(A[1].y - A[0].y)); + sprintf(buf, "%.02f %.02f ", (A[1].x - A[0].x), (A[1].y - A[0].y)); agxbput(xbufs[emit_state], buf); } @@ -591,7 +591,7 @@ void core_loadimage_xdot(GVJ_t * job, usershape_t *us, boxf b, boolean filled) agxbput(xbufs[emit_state], "I "); output_point(xbufs[emit_state], b.LL); - sprintf(buf, "%d %d ", ROUND(b.UR.x - b.LL.x), ROUND(b.UR.y - b.LL.y)); + sprintf(buf, "%.02f %.02f ", (b.UR.x - b.LL.x), (b.UR.y - b.LL.y)); agxbput(xbufs[emit_state], buf); xdot_str (job, "", (char*)(us->name)); } -- 2.40.0