From 6b1d05e71aed91c7f85ff155dfad281e24d16fe5 Mon Sep 17 00:00:00 2001 From: cristy Date: Wed, 22 Sep 2010 19:17:27 +0000 Subject: [PATCH] --- ChangeLog | 4 ++++ coders/caption.c | 6 +++--- magick/annotate.c | 45 ++++++++++++++++++++++++--------------------- magick/fx.c | 3 ++- 4 files changed, 33 insertions(+), 25 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7e3f43df8..dd68a290d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2010-09-12 6.6.4-6 Cristy + * Do not break words if caption size is absolute (reference + http://www.imagemagick.org/discourse-server/viewtopic.php?f=1&t=17123). + 2010-09-20 6.6.4-5 Nicolas Robidoux * Modified "magick/resize.c" so that MagickPIL is a MagickRealType number. Some computations were needlessly done in long double precision because diff --git a/coders/caption.c b/coders/caption.c index 3100cf7dc..ff89b775c 100644 --- a/coders/caption.c +++ b/coders/caption.c @@ -154,7 +154,7 @@ static Image *ReadCAPTIONImage(const ImageInfo *image_info, for ( ; ; ) { text=AcquireString(caption); - i=FormatMagickCaption(image,draw_info,&metrics,&text); + i=FormatMagickCaption(image,draw_info,MagickFalse,&metrics,&text); (void) CloneString(&draw_info->text,text); text=DestroyString(text); (void) FormatMagickString(geometry,MaxTextExtent,"%+g%+g", @@ -173,7 +173,7 @@ static Image *ReadCAPTIONImage(const ImageInfo *image_info, for ( ; ; ) { text=AcquireString(caption); - i=FormatMagickCaption(image,draw_info,&metrics,&text); + i=FormatMagickCaption(image,draw_info,MagickFalse,&metrics,&text); (void) CloneString(&draw_info->text,text); text=DestroyString(text); (void) FormatMagickString(geometry,MaxTextExtent,"%+g%+g", @@ -190,7 +190,7 @@ static Image *ReadCAPTIONImage(const ImageInfo *image_info, } draw_info->pointsize--; } - i=FormatMagickCaption(image,draw_info,&metrics,&caption); + i=FormatMagickCaption(image,draw_info,MagickTrue,&metrics,&caption); if (image->rows == 0) image->rows=(size_t) ((i+1)*(metrics.ascent-metrics.descent+ draw_info->stroke_width)+0.5); diff --git a/magick/annotate.c b/magick/annotate.c index 07251c7d1..8ce9becad 100644 --- a/magick/annotate.c +++ b/magick/annotate.c @@ -461,21 +461,23 @@ MagickExport MagickBooleanType AnnotateImage(Image *image, % The format of the FormatMagickCaption method is: % % ssize_t FormatMagickCaption(Image *image,DrawInfo *draw_info, -% TypeMetric *metrics,char **caption) +% const MagickBooleanType split,TypeMetric *metrics,char **caption) % % A description of each parameter follows. % % o image: The image. % -% o caption: the caption. -% % o draw_info: the draw info. % +% o split: when no convenient line breaks-- insert newline. +% % o metrics: Return the font metrics in this structure. % +% o caption: the caption. +% */ MagickExport ssize_t FormatMagickCaption(Image *image,DrawInfo *draw_info, - TypeMetric *metrics,char **caption) + const MagickBooleanType split,TypeMetric *metrics,char **caption) { MagickBooleanType status; @@ -520,25 +522,26 @@ MagickExport ssize_t FormatMagickCaption(Image *image,DrawInfo *draw_info, p=s; } else - { - char - *target; + if (split != MagickFalse) + { + char + *target; - ssize_t - n; + ssize_t + n; - /* - No convenient line breaks-- insert newline. - */ - target=AcquireString(*caption); - n=p-(*caption); - CopyMagickString(target,*caption,n+1); - ConcatenateMagickString(target,"\n",strlen(*caption)+1); - ConcatenateMagickString(target,p,strlen(*caption)+2); - (void) DestroyString(*caption); - *caption=target; - p=(*caption)+n; - } + /* + No convenient line breaks-- insert newline. + */ + target=AcquireString(*caption); + n=p-(*caption); + CopyMagickString(target,*caption,n+1); + ConcatenateMagickString(target,"\n",strlen(*caption)+1); + ConcatenateMagickString(target,p,strlen(*caption)+2); + (void) DestroyString(*caption); + *caption=target; + p=(*caption)+n; + } s=(char *) NULL; q=draw_info->text; } diff --git a/magick/fx.c b/magick/fx.c index 8009e3224..a47060656 100644 --- a/magick/fx.c +++ b/magick/fx.c @@ -3833,7 +3833,8 @@ MagickExport Image *PolaroidImage(const Image *image,const DrawInfo *draw_info, caption=InterpretImageProperties((ImageInfo *) NULL,(Image *) image, value); (void) CloneString(&annotate_info->text,caption); - count=FormatMagickCaption(caption_image,annotate_info,&metrics,&caption); + count=FormatMagickCaption(caption_image,annotate_info,MagickTrue,&metrics, + &caption); status=SetImageExtent(caption_image,image->columns,(size_t) ((count+1)*(metrics.ascent-metrics.descent)+0.5)); if (status == MagickFalse) -- 2.50.1