From 0547fc99452256a099fee4f127413eca6c21013f Mon Sep 17 00:00:00 2001 From: Raph Levien Date: Wed, 9 Aug 2006 17:48:58 +0000 Subject: Fix: Change pdfwrite pattern bbox to use PDF compliant syntax for float bbox coordinates, rather than sprintf %g. Fixes (reopened) bug #688167. git-svn-id: http://svn.ghostscript.com/ghostscript/trunk@6981 a1074d23-0009-0410-80fe-cf8c14f379e6 --- gs/src/gdevpdfv.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/gs/src/gdevpdfv.c b/gs/src/gdevpdfv.c index 33877b003..683ff6ac2 100644 --- a/gs/src/gdevpdfv.c +++ b/gs/src/gdevpdfv.c @@ -200,14 +200,16 @@ pdf_store_pattern1_params(gx_device_pdf *pdev, pdf_resource_t *pres, double scale_y = pdev->HWResolution[1] / 72.0; cos_dict_t *pcd = cos_stream_dict((cos_stream_t *)pres->object); cos_dict_t *pcd_Resources = cos_dict_alloc(pdev, "pdf_pattern(Resources)"); - char buf[60]; + float bbox[4]; int code; if (pcd == NULL || pcd_Resources == NULL) return_error(gs_error_VMerror); pdev->substream_Resources = pcd_Resources; - sprintf(buf, "[%g %g %g %g]", t->BBox.p.x, t->BBox.p.y, - t->BBox.q.x, t->BBox.q.y); + bbox[0] = t->BBox.p.x; + bbox[1] = t->BBox.p.y; + bbox[2] = t->BBox.q.x; + bbox[3] = t->BBox.q.y; /* The graphics library assumes a shifted origin to provide positive bitmap pixel indices. Compensate it now. */ smat.tx += pinst->step_matrix.tx; @@ -230,7 +232,7 @@ pdf_store_pattern1_params(gx_device_pdf *pdev, pdf_resource_t *pres, if (code >= 0) code = cos_dict_put_c_key_int(pcd, "/TilingType", t->TilingType); if (code >= 0) - code = cos_dict_put_string(pcd, (byte *)"/BBox", 5, (byte *)buf, strlen(buf)); + code = cos_dict_put_c_key_floats(pcd, "/BBox", bbox, 4); if (code >= 0) code = cos_dict_put_matrix(pcd, "/Matrix", &smat); if (code >= 0) -- cgit v1.2.3