From: cristy Date: Fri, 3 Jun 2011 17:52:52 +0000 (+0000) Subject: (no commit message) X-Git-Tag: 7.0.1-0~7463 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=024843f38984cd26602f0b3b28a0768dfa056bb5;p=imagemagick --- diff --git a/ChangeLog b/ChangeLog index 5c28bd343..9548a4f5e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +2011-06-03 6.7.0-3 Cristy + * Support -direction right-to-left for the label: and caption: coders. + 2011-06-03 6.7.0-3 Cristy * New version 6.7.0-3. diff --git a/coders/caption.c b/coders/caption.c index 3d2280e0d..7d6006cca 100644 --- a/coders/caption.c +++ b/coders/caption.c @@ -207,14 +207,19 @@ static Image *ReadCAPTIONImage(const ImageInfo *image_info, */ (void) CloneString(&draw_info->text,caption); status=GetMultilineTypeMetrics(image,draw_info,&metrics); - if (draw_info->gravity != UndefinedGravity) + if ((draw_info->gravity != UndefinedGravity) && + (draw_info->direction != RightToLeftDirection)) image->page.x=(ssize_t) (metrics.bounds.x1-draw_info->stroke_width/2.0); else { (void) FormatLocaleString(geometry,MaxTextExtent,"%+g%+g", -metrics.bounds.x1+draw_info->stroke_width/2.0,metrics.ascent+ draw_info->stroke_width/2.0); - (void) CloneString(&draw_info->geometry,geometry); + if (draw_info->direction == RightToLeftDirection) + (void) FormatLocaleString(geometry,MaxTextExtent,"%+g%+g", + image->columns-(metrics.bounds.x2+draw_info->stroke_width/2.0), + metrics.ascent+draw_info->stroke_width/2.0); + draw_info->geometry=AcquireString(geometry); } (void) AnnotateImage(image,draw_info); draw_info=DestroyDrawInfo(draw_info); diff --git a/coders/label.c b/coders/label.c index 55886aeb6..fed0dda02 100644 --- a/coders/label.c +++ b/coders/label.c @@ -170,13 +170,17 @@ static Image *ReadLABELImage(const ImageInfo *image_info, if (image->columns == 0) image->columns=(size_t) (metrics.width+draw_info->stroke_width+1.5); if (image->columns == 0) - image->columns=(size_t) (draw_info->pointsize+ - draw_info->stroke_width+1.5); - if (draw_info->gravity == UndefinedGravity) + image->columns=(size_t) (draw_info->pointsize+draw_info->stroke_width+1.5); + if ((draw_info->gravity == UndefinedGravity) || + (draw_info->direction == RightToLeftDirection)) { (void) FormatLocaleString(geometry,MaxTextExtent,"%+g%+g", -metrics.bounds.x1+draw_info->stroke_width/2.0,metrics.ascent+ draw_info->stroke_width/2.0); + if (draw_info->direction == RightToLeftDirection) + (void) FormatLocaleString(geometry,MaxTextExtent,"%+g%+g", + image->columns-(metrics.bounds.x2+draw_info->stroke_width/2.0), + metrics.ascent+draw_info->stroke_width/2.0); draw_info->geometry=AcquireString(geometry); } if (image->rows == 0) diff --git a/magick/annotate.c b/magick/annotate.c index cf912da4d..328db5195 100644 --- a/magick/annotate.c +++ b/magick/annotate.c @@ -691,6 +691,7 @@ MagickExport MagickBooleanType GetMultilineTypeMetrics(Image *image, if (textlist == (char **) NULL) return(MagickFalse); annotate_info->render=MagickFalse; + annotate_info->direction=UndefinedDirection; (void) ResetMagickMemory(metrics,0,sizeof(*metrics)); (void) ResetMagickMemory(&extent,0,sizeof(extent)); /* @@ -784,6 +785,7 @@ MagickExport MagickBooleanType GetTypeMetrics(Image *image, assert(draw_info->signature == MagickSignature); annotate_info=CloneDrawInfo((ImageInfo *) NULL,draw_info); annotate_info->render=MagickFalse; + annotate_info->direction=UndefinedDirection; (void) ResetMagickMemory(metrics,0,sizeof(*metrics)); offset.x=0.0; offset.y=0.0; @@ -795,8 +797,8 @@ MagickExport MagickBooleanType GetTypeMetrics(Image *image, "underline position: %g; underline thickness: %g",annotate_info->text, metrics->width,metrics->height,metrics->ascent,metrics->descent, metrics->max_advance,metrics->bounds.x1,metrics->bounds.y1, - metrics->bounds.x2,metrics->bounds.y2,metrics->origin.x,metrics->origin.y, - metrics->pixels_per_em.x,metrics->pixels_per_em.y, + metrics->bounds.x2,metrics->bounds.y2,metrics->origin.x, + metrics->origin.y,metrics->pixels_per_em.x,metrics->pixels_per_em.y, metrics->underline_position,metrics->underline_thickness); annotate_info=DestroyDrawInfo(annotate_info); return(status);