diff options
Diffstat (limited to 'src/drv/cdpicture.c')
-rw-r--r-- | src/drv/cdpicture.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/drv/cdpicture.c b/src/drv/cdpicture.c index 3f5598e..ff4f532 100644 --- a/src/drv/cdpicture.c +++ b/src/drv/cdpicture.c @@ -569,32 +569,32 @@ static void cdfchord(cdCtxCanvas *ctxcanvas, double xc, double yc, double w, dou picUpdateBBox(ctxcanvas, xmax, ymax, 0); } -static void cdtext(cdCtxCanvas *ctxcanvas, int x, int y, const char *text) +static void cdtext(cdCtxCanvas *ctxcanvas, int x, int y, const char *text, int len) { int xmin, xmax, ymin, ymax; tPrimNode *prim = primCreate(CDPIC_TEXT); primAddAttrib_Text(prim, ctxcanvas->canvas); prim->param.text.x = x; prim->param.text.y = y; - prim->param.text.s = cdStrDup(text); + prim->param.text.s = cdStrDupN(text, len); prim->param_buffer = prim->param.text.s; picAddPrim(ctxcanvas, prim); - cdCanvasGetTextBox(ctxcanvas->canvas, x, y, text, &xmin, &xmax, &ymin, &ymax); + cdCanvasGetTextBox(ctxcanvas->canvas, x, y, prim->param.text.s, &xmin, &xmax, &ymin, &ymax); picUpdateBBox(ctxcanvas, xmin, ymin, 0); picUpdateBBox(ctxcanvas, xmax, ymax, 0); } -static void cdftext(cdCtxCanvas *ctxcanvas, double x, double y, const char *text) +static void cdftext(cdCtxCanvas *ctxcanvas, double x, double y, const char *text, int len) { int xmin, xmax, ymin, ymax; tPrimNode *prim = primCreate(CDPIC_FTEXT); primAddAttrib_Text(prim, ctxcanvas->canvas); prim->param.textf.x = x; prim->param.textf.y = y; - prim->param.textf.s = cdStrDup(text); + prim->param.textf.s = cdStrDupN(text, len); prim->param_buffer = prim->param.textf.s; picAddPrim(ctxcanvas, prim); - cdCanvasGetTextBox(ctxcanvas->canvas, _cdRound(x), _cdRound(y), text, &xmin, &xmax, &ymin, &ymax); + cdCanvasGetTextBox(ctxcanvas->canvas, _cdRound(x), _cdRound(y), prim->param.text.s, &xmin, &xmax, &ymin, &ymax); picUpdateBBox(ctxcanvas, xmin, ymin, 0); picUpdateBBox(ctxcanvas, xmax, ymax, 0); } |