From 9c282cc8767db9a3fafe507398b52fbdd0c03d9f Mon Sep 17 00:00:00 2001 From: Cristy Date: Sat, 29 Aug 2015 17:37:22 -0400 Subject: [PATCH] http://www.imagemagick.org/discourse-server/viewtopic.php?f=3&t=19319 --- MagickCore/annotate.c | 76 +++++++++++++++++++++---------------------- MagickCore/image.c | 9 ++--- 2 files changed, 42 insertions(+), 43 deletions(-) diff --git a/MagickCore/annotate.c b/MagickCore/annotate.c index e702b155c..d14439e01 100644 --- a/MagickCore/annotate.c +++ b/MagickCore/annotate.c @@ -1009,10 +1009,9 @@ static int TraceCubicBezier(FT_Vector *p,FT_Vector *q,FT_Vector *to, path[MagickPathExtent]; affine=draw_info->affine; - (void) FormatLocaleString(path,MagickPathExtent, - "C%g,%g %g,%g %g,%g",affine.tx+p->x/64.0,affine.ty- - p->y/64.0,affine.tx+q->x/64.0,affine.ty-q->y/64.0,affine.tx+to->x/64.0, - affine.ty-to->y/64.0); + (void) FormatLocaleString(path,MagickPathExtent,"C%g,%g %g,%g %g,%g", + affine.tx+p->x/64.0,affine.ty-p->y/64.0,affine.tx+q->x/64.0,affine.ty- + q->y/64.0,affine.tx+to->x/64.0,affine.ty-to->y/64.0); (void) ConcatenateString(&draw_info->primitive,path); return(0); } @@ -1026,8 +1025,8 @@ static int TraceLineTo(FT_Vector *to,DrawInfo *draw_info) path[MagickPathExtent]; affine=draw_info->affine; - (void) FormatLocaleString(path,MagickPathExtent,"L%g,%g",affine.tx+ - to->x/64.0,affine.ty-to->y/64.0); + (void) FormatLocaleString(path,MagickPathExtent,"L%g,%g",affine.tx+to->x/64.0, + affine.ty-to->y/64.0); (void) ConcatenateString(&draw_info->primitive,path); return(0); } @@ -1041,8 +1040,8 @@ static int TraceMoveTo(FT_Vector *to,DrawInfo *draw_info) path[MagickPathExtent]; affine=draw_info->affine; - (void) FormatLocaleString(path,MagickPathExtent,"M%g,%g",affine.tx+ - to->x/64.0,affine.ty-to->y/64.0); + (void) FormatLocaleString(path,MagickPathExtent,"M%g,%g",affine.tx+to->x/64.0, + affine.ty-to->y/64.0); (void) ConcatenateString(&draw_info->primitive,path); return(0); } @@ -1057,9 +1056,9 @@ static int TraceQuadraticBezier(FT_Vector *control,FT_Vector *to, path[MagickPathExtent]; affine=draw_info->affine; - (void) FormatLocaleString(path,MagickPathExtent,"Q%g,%g %g,%g", - affine.tx+control->x/64.0,affine.ty-control->y/64.0,affine.tx+to->x/64.0, - affine.ty-to->y/64.0); + (void) FormatLocaleString(path,MagickPathExtent,"Q%g,%g %g,%g",affine.tx+ + control->x/64.0,affine.ty-control->y/64.0,affine.tx+to->x/64.0,affine.ty- + to->y/64.0); (void) ConcatenateString(&draw_info->primitive,path); return(0); } @@ -1313,6 +1312,8 @@ static MagickBooleanType RenderFreetype(Image *image,const DrawInfo *draw_info, affine.yy=(FT_Fixed) (65536L*draw_info->affine.sy+0.5); } annotate_info=CloneDrawInfo((ImageInfo *) NULL,draw_info); + if (annotate_info->dash_pattern != (double *) NULL) + annotate_info->dash_pattern[0]=0.0; (void) CloneString(&annotate_info->primitive,"path '"); if (draw_info->render != MagickFalse) { @@ -1380,20 +1381,18 @@ static MagickBooleanType RenderFreetype(Image *image,const DrawInfo *draw_info, metrics->bounds.x2=(double) bounds.xMax; if ((p == draw_info->text) || (bounds.yMax > metrics->bounds.y2)) metrics->bounds.y2=(double) bounds.yMax; - if ((draw_info->stroke.alpha != TransparentAlpha) || - (draw_info->stroke_pattern != (Image *) NULL)) + if (((draw_info->stroke.alpha != TransparentAlpha) || + (draw_info->stroke_pattern != (Image *) NULL)) && + ((status != MagickFalse) && (draw_info->render != MagickFalse))) { - if ((status != MagickFalse) && (draw_info->render != MagickFalse)) - { - /* - Trace the glyph. - */ - annotate_info->affine.tx=glyph.origin.x/64.0; - annotate_info->affine.ty=glyph.origin.y/64.0; - (void) FT_Outline_Decompose(&((FT_OutlineGlyph) glyph.image)-> - outline,&OutlineMethods,annotate_info); - } - } + /* + Trace the glyph. + */ + annotate_info->affine.tx=glyph.origin.x/64.0; + annotate_info->affine.ty=glyph.origin.y/64.0; + (void) FT_Outline_Decompose(&((FT_OutlineGlyph) glyph.image)->outline, + &OutlineMethods,annotate_info); + } FT_Vector_Transform(&glyph.origin,&affine); (void) FT_Glyph_Transform(glyph.image,&affine,&glyph.origin); ft_status=FT_Glyph_To_Bitmap(&glyph.image,ft_render_mode_normal, @@ -1498,6 +1497,20 @@ static MagickBooleanType RenderFreetype(Image *image,const DrawInfo *draw_info, status=MagickFalse; } image_view=DestroyCacheView(image_view); + if (((draw_info->stroke.alpha != TransparentAlpha) || + (draw_info->stroke_pattern != (Image *) NULL)) && + (status != MagickFalse)) + { + /* + Draw text stroke. + */ + annotate_info->linejoin=RoundJoin; + annotate_info->affine.tx=offset->x; + annotate_info->affine.ty=offset->y; + (void) ConcatenateString(&annotate_info->primitive,"'"); + (void) DrawImage(image,annotate_info,exception); + (void) CloneString(&annotate_info->primitive,"path '"); + } } if ((bitmap->left+bitmap->bitmap.width) > metrics->width) metrics->width=bitmap->left+bitmap->bitmap.width; @@ -1518,21 +1531,6 @@ static MagickBooleanType RenderFreetype(Image *image,const DrawInfo *draw_info, utf8=(unsigned char *) RelinquishMagickMemory(utf8); if (last_glyph.id != 0) FT_Done_Glyph(last_glyph.image); - if ((draw_info->stroke.alpha != TransparentAlpha) || - (draw_info->stroke_pattern != (Image *) NULL)) - { - if ((status != MagickFalse) && (draw_info->render != MagickFalse)) - { - /* - Draw text stroke. - */ - annotate_info->linejoin=RoundJoin; - annotate_info->affine.tx=offset->x; - annotate_info->affine.ty=offset->y; - (void) ConcatenateString(&annotate_info->primitive,"'"); - (void) DrawImage(image,annotate_info,exception); - } - } /* Determine font metrics. */ diff --git a/MagickCore/image.c b/MagickCore/image.c index 64f8d1393..2a6ba0294 100644 --- a/MagickCore/image.c +++ b/MagickCore/image.c @@ -3843,10 +3843,11 @@ MagickExport MagickBooleanType SyncImageSettings(const ImageInfo *image_info, if ((flags & SigmaValue) == 0) image->chromaticity.white_point.y=image->chromaticity.white_point.x; } - /* IMv7: pointer to allow the lookup of pre-image artefact will fallback to - a global option setting/define. This saves a lot of duplication of - global options into per-image artifacts, while ensuring only specifically - set per-image artifacts are preserved when parenthesis ends. + /* + Pointer to allow the lookup of pre-image artifact will fallback to a global + option setting/define. This saves a lot of duplication of global options + into per-image artifacts, while ensuring only specifically set per-image + artifacts are preserved when parenthesis ends. */ if (image->image_info != (ImageInfo *) NULL) image->image_info=DestroyImageInfo(image->image_info); -- 2.40.0