From 74966dbfe99011d1f7bea577e97a3d9a7b9836c7 Mon Sep 17 00:00:00 2001 From: cristy Date: Tue, 20 Sep 2011 19:37:21 +0000 Subject: [PATCH] --- MagickCore/annotate.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/MagickCore/annotate.c b/MagickCore/annotate.c index 63b0b849d..89ae11b19 100644 --- a/MagickCore/annotate.c +++ b/MagickCore/annotate.c @@ -549,6 +549,9 @@ MagickExport ssize_t FormatMagickCaption(Image *image,DrawInfo *draw_info, const MagickBooleanType split,TypeMetric *metrics,char **caption, ExceptionInfo *exception) { + char + *text; + MagickBooleanType status; @@ -566,6 +569,7 @@ MagickExport ssize_t FormatMagickCaption(Image *image,DrawInfo *draw_info, ssize_t n; + text=AcquireString(draw_info->text); q=draw_info->text; s=(char *) NULL; for (p=(*caption); GetUTFCode(p) != 0; p+=GetUTFOctets(p)) @@ -581,8 +585,9 @@ MagickExport ssize_t FormatMagickCaption(Image *image,DrawInfo *draw_info, if (status == MagickFalse) break; width=(size_t) floor(metrics->width+0.5); - if (width <= image->columns) + if ((width <= image->columns) || (strcmp(text,draw_info->text) == 0)) continue; + (void) strcpy(text,draw_info->text); if ((s != (char *) NULL) && (GetUTFOctets(s) == 1)) { *s='\n'; @@ -609,6 +614,7 @@ MagickExport ssize_t FormatMagickCaption(Image *image,DrawInfo *draw_info, q=draw_info->text; s=(char *) NULL; } + text=DestroyString(text); n=0; for (p=(*caption); GetUTFCode(p) != 0; p+=GetUTFOctets(p)) if (GetUTFCode(p) == '\n') -- 2.40.0