diff --git a/coders/caption.c b/coders/caption.c index 58b0a1c78a..4f8aa5e4c6 100644 --- a/coders/caption.c +++ b/coders/caption.c @@ -284,14 +284,14 @@ static Image *ReadCAPTIONImage(const ImageInfo *image_info, draw_info->interline_spacing+draw_info->stroke_width+0.5); if ((image->columns != 0) && (image->rows != 0)) { - if ((width > image->columns) || (height > image->rows)) + if ((width >= image->columns) && (height >= image->rows)) break; - if ((width <= image->columns) && (height <= image->rows)) + if ((width < image->columns) && (height < image->rows)) low=draw_info->pointsize; } else - if (((image->columns != 0) && (width > image->columns)) || - ((image->rows != 0) && (height > image->rows))) + if (((image->columns != 0) && (width >= image->columns)) || + ((image->rows != 0) && (height >= image->rows))) break; } high=draw_info->pointsize; @@ -317,14 +317,14 @@ static Image *ReadCAPTIONImage(const ImageInfo *image_info, draw_info->interline_spacing+draw_info->stroke_width+0.5); if ((image->columns != 0) && (image->rows != 0)) { - if ((width <= image->columns) && (height <= image->rows)) + if ((width < image->columns) && (height < image->rows)) low=draw_info->pointsize+0.5; else high=draw_info->pointsize-0.5; } else - if (((image->columns != 0) && (width <= image->columns)) || - ((image->rows != 0) && (height <= image->rows))) + if (((image->columns != 0) && (width < image->columns)) || + ((image->rows != 0) && (height < image->rows))) low=draw_info->pointsize+0.5; else high=draw_info->pointsize-0.5; diff --git a/coders/label.c b/coders/label.c index 024038f135..815b4d3fd4 100644 --- a/coders/label.c +++ b/coders/label.c @@ -221,14 +221,14 @@ static Image *ReadLABELImage(const ImageInfo *image_info, draw_info->stroke_width+0.5); if ((image->columns != 0) && (image->rows != 0)) { - if ((width > image->columns) || (height > image->rows)) + if ((width >= image->columns) && (height >= image->rows)) break; - if ((width <= image->columns) && (height <= image->rows)) + if ((width < image->columns) && (height < image->rows)) low=draw_info->pointsize; } else - if (((image->columns != 0) && (width > image->columns)) || - ((image->rows != 0) && (height > image->rows))) + if (((image->columns != 0) && (width >= image->columns)) || + ((image->rows != 0) && (height >= image->rows))) break; } if (status == MagickFalse) @@ -240,7 +240,7 @@ static Image *ReadLABELImage(const ImageInfo *image_info, } high=draw_info->pointsize; } - while((high-low) > 0.5) + while ((high-low) > 0.5) { draw_info->pointsize=(low+high)/2.0; (void) FormatLocaleString(geometry,MagickPathExtent,"%+g%+g", @@ -256,14 +256,14 @@ static Image *ReadLABELImage(const ImageInfo *image_info, draw_info->stroke_width+0.5); if ((image->columns != 0) && (image->rows != 0)) { - if ((width <= image->columns) && (height <= image->rows)) + if ((width < image->columns) && (height < image->rows)) low=draw_info->pointsize+0.5; else high=draw_info->pointsize-0.5; } else - if (((image->columns != 0) && (width <= image->columns)) || - ((image->rows != 0) && (height <= image->rows))) + if (((image->columns != 0) && (width < image->columns)) || + ((image->rows != 0) && (height < image->rows))) low=draw_info->pointsize+0.5; else high=draw_info->pointsize-0.5;