summaryrefslogtreecommitdiff
path: root/src/drv/cdps.c
diff options
context:
space:
mode:
authorscuri <scuri>2009-06-23 20:55:28 +0000
committerscuri <scuri>2009-06-23 20:55:28 +0000
commitf658209d25477c490bf1892e68a0fd1384c1dded (patch)
tree1d4a2a1088db5ad62acaa3f97f13ccc8906c33b1 /src/drv/cdps.c
parent0610dd4f3064220a2e8fb1d8dc120044eb6c64a8 (diff)
*** empty log message ***
Diffstat (limited to 'src/drv/cdps.c')
-rw-r--r--src/drv/cdps.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/drv/cdps.c b/src/drv/cdps.c
index 0d23608..d5d62fe 100644
--- a/src/drv/cdps.c
+++ b/src/drv/cdps.c
@@ -871,9 +871,9 @@ static void cdfchord(cdCtxCanvas *ctxcanvas, double xc, double yc, double w, dou
static void cdtransform(cdCtxCanvas *ctxcanvas, const double* matrix);
-static void cdtext(cdCtxCanvas *ctxcanvas, int x, int y, const char *s)
+static void cdtext(cdCtxCanvas *ctxcanvas, int x, int y, const char *s, int len)
{
- int i, length;
+ int i;
int ascent, height, baseline;
update_fill(ctxcanvas, 0);
@@ -889,7 +889,7 @@ static void cdtext(cdCtxCanvas *ctxcanvas, int x, int y, const char *s)
fprintf(ctxcanvas->file, "N 0 0 M\n");
putc('(', ctxcanvas->file);
- for (length = (int)strlen(s), i=0; i<length; i++)
+ for (i=0; i<len; i++)
{
if (s[i]=='(' || s[i]==')')
putc('\\', ctxcanvas->file);
@@ -975,7 +975,9 @@ static void cdtext(cdCtxCanvas *ctxcanvas, int x, int y, const char *s)
if (ctxcanvas->eps)
{
int xmin, xmax, ymin, ymax;
+ s = cdStrDupN(s, len);
cdCanvasGetTextBox(ctxcanvas->canvas, x, y, s, &xmin, &xmax, &ymin, &ymax);
+ free((char*)s);
bbox(ctxcanvas, xmin, ymin);
bbox(ctxcanvas, xmax, ymax);
}