]> granicus.if.org Git - imagemagick/commitdiff
(no commit message)
authorcristy <urban-warrior@git.imagemagick.org>
Tue, 20 Sep 2011 19:37:21 +0000 (19:37 +0000)
committercristy <urban-warrior@git.imagemagick.org>
Tue, 20 Sep 2011 19:37:21 +0000 (19:37 +0000)
MagickCore/annotate.c

index 63b0b849d1af959222311ecc1e5a79a67e810b96..89ae11b19b9854011efca97ef769c1ceadfc4fa1 100644 (file)
@@ -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')