Skip to content

Commit

Permalink
label not centered with gravity (ImageMagick/ImageMagick#5834)
Browse files Browse the repository at this point in the history
  • Loading branch information
Cristy committed Dec 1, 2022
1 parent 7860ceb commit 2a2a6c3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions coders/caption.c
Original file line number Diff line number Diff line change
Expand Up @@ -316,8 +316,10 @@ static Image *ReadCAPTIONImage(const ImageInfo *image_info,
caption=DestroyString(caption);
(void) FormatLocaleString(geometry,MagickPathExtent,"%+g%+g",
(draw_info->direction == RightToLeftDirection ? (double) image->columns-
metrics.bounds.x2 : metrics.bounds.x1),(draw_info->gravity ==
UndefinedGravity ? MagickMax(metrics.ascent,metrics.bounds.y2) : 0.0));
(draw_info->gravity == UndefinedGravity ? metrics.bounds.x2 : 0.0) :
(draw_info->gravity == UndefinedGravity ? metrics.bounds.x1 : 0.0)),
(draw_info->gravity == UndefinedGravity ?
MagickMax(metrics.ascent,metrics.bounds.y2) : 0.0));
(void) CloneString(&draw_info->geometry,geometry);
status=AnnotateImage(image,draw_info);
if (image_info->pointsize == 0.0)
Expand Down
6 changes: 4 additions & 2 deletions coders/label.c
Original file line number Diff line number Diff line change
Expand Up @@ -280,8 +280,10 @@ static Image *ReadLABELImage(const ImageInfo *image_info,
*/
(void) FormatLocaleString(geometry,MagickPathExtent,"%+g%+g",
(draw_info->direction == RightToLeftDirection ? (double) image->columns-
metrics.bounds.x2 : metrics.bounds.x1),(draw_info->gravity ==
UndefinedGravity ? MagickMax(metrics.ascent,metrics.bounds.y2) : 0.0));
(draw_info->gravity == UndefinedGravity ? metrics.bounds.x2 : 0.0) :
(draw_info->gravity == UndefinedGravity ? metrics.bounds.x1 : 0.0)),
(draw_info->gravity == UndefinedGravity ?
MagickMax(metrics.ascent,metrics.bounds.y2) : 0.0));
(void) CloneString(&draw_info->geometry,geometry);
status=AnnotateImage(image,draw_info);
if (image_info->pointsize == 0.0)
Expand Down

0 comments on commit 2a2a6c3

Please sign in to comment.