From 0d88ea3545d808eae9feeacdd57eec41db18d2ba Mon Sep 17 00:00:00 2001 From: Cristy Date: Fri, 5 Feb 2016 15:20:00 -0500 Subject: [PATCH] Use -define type:features rather than -font-features option --- MagickCore/annotate.c | 72 +++++++++++++++++++----------------------- MagickCore/draw.c | 16 ---------- MagickCore/draw.h | 3 +- MagickCore/option.c | 2 -- MagickWand/mogrify.c | 5 --- MagickWand/operation.c | 5 --- 6 files changed, 34 insertions(+), 69 deletions(-) diff --git a/MagickCore/annotate.c b/MagickCore/annotate.c index d8c3537c9..8f5319ad7 100644 --- a/MagickCore/annotate.c +++ b/MagickCore/annotate.c @@ -1027,11 +1027,14 @@ static MagickBooleanType RenderType(Image *image,const DrawInfo *draw_info, #if defined(MAGICKCORE_FREETYPE_DELEGATE) -static size_t ComplexTextLayout(const char *text,const size_t length, - const FT_Face face,const raqm_direction_t direction,const char *features, +static size_t ComplexTextLayout(const Image *image,const char *text, + const size_t length,const FT_Face face,const raqm_direction_t direction, const FT_Int32 flags,GraphemeInfo **grapheme) { #if defined(MAGICKCORE_RAQM_DELEGATE) + const char + *features; + int i; @@ -1044,21 +1047,18 @@ static size_t ComplexTextLayout(const char *text,const size_t length, raqm_glyph_t *glyphs; - count = 0; - rq = raqm_create(); + count=0; + rq=raqm_create(); if (rq == (raqm_t *) NULL) goto cleanup; - - if (!raqm_set_text_utf8(rq,text,length)) + if (raqm_set_text_utf8(rq,text,length) == 0) goto cleanup; - - if (!raqm_set_par_direction(rq,direction)) + if (raqm_set_par_direction(rq,direction) == 0) goto cleanup; - - if (!raqm_set_freetype_face(rq,face)) + if (raqm_set_freetype_face(rq,face) == 0) goto cleanup; - - if (features) + features=GetImageProperty(image,"type:features",exception); + if (features != (const char *) NULL) { char breaker, @@ -1075,47 +1075,42 @@ static size_t ComplexTextLayout(const char *text,const size_t length, next=0; token_info=AcquireTokenInfo(); token=(char *) AcquireQuantumMemory(50,sizeof(*token)); - status_token = Tokenizer(token_info,0,token,50,features, - "",",","",'\0',&breaker,&next,"e); + status_token=Tokenizer(token_info,0,token,50,features,"",",","",'\0', + &breaker,&next,"e); while (status_token == 0) - { - raqm_add_font_feature(rq, token, strlen(token)); - status_token = Tokenizer(token_info,0,token,50,features, - "",",","",'\0',&breaker,&next,"e); - } + { + raqm_add_font_feature(rq,token,strlen(token)); + status_token=Tokenizer(token_info,0,token,50,features,"",",","",'\0', + &breaker,&next,"e); + } token_info=DestroyTokenInfo(token_info); token=DestroyString(token); } - - if (!raqm_layout(rq)) + if (raqm_layout(rq) == 0) goto cleanup; - - glyphs = raqm_get_glyphs(rq,&count); + glyphs=raqm_get_glyphs(rq,&count); if (glyphs == (raqm_glyph_t *) NULL) { - count = 0; + count=0; goto cleanup; } - *grapheme=(GraphemeInfo *) AcquireQuantumMemory(count,sizeof(**grapheme)); if (*grapheme == (GraphemeInfo *) NULL) { - count = 0; + count=0; goto cleanup; } - for (i = 0; i < count; i++) - { - (*grapheme)[i].index = glyphs[i].index; - (*grapheme)[i].x_offset = glyphs[i].x_offset; - (*grapheme)[i].x_advance = glyphs[i].x_advance; - (*grapheme)[i].y_offset = glyphs[i].y_offset; - (*grapheme)[i].cluster = glyphs[i].cluster; - } + { + (*grapheme)[i].index=glyphs[i].index; + (*grapheme)[i].x_offset=glyphs[i].x_offset; + (*grapheme)[i].x_advance=glyphs[i].x_advance; + (*grapheme)[i].y_offset=glyphs[i].y_offset; + (*grapheme)[i].cluster=glyphs[i].cluster; + } cleanup: - raqm_destroy (rq); - + raqm_destroy(rq); return(count); #else FT_Error @@ -1133,8 +1128,7 @@ cleanup: /* Simple layout for bi-directional text (right-to-left or left-to-right). */ - *grapheme=(GraphemeInfo *) AcquireQuantumMemory(length+1, - sizeof(**grapheme)); + *grapheme=(GraphemeInfo *) AcquireQuantumMemory(length+1,sizeof(**grapheme)); if (*grapheme == (GraphemeInfo *) NULL) return(0); last_glyph=0; @@ -1527,7 +1521,7 @@ static MagickBooleanType RenderFreetype(Image *image,const DrawInfo *draw_info, if (draw_info->direction == LeftToRightDirection) direction=RAQM_DIRECTION_LTR; grapheme=(GraphemeInfo *) NULL; - length=ComplexTextLayout(p,strlen(p),face,direction,draw_info->font_features,flags,&grapheme); + length=ComplexTextLayout(image,p,strlen(p),face,direction,flags,&grapheme); code=0; for (i=0; i < (ssize_t) length; i++) { diff --git a/MagickCore/draw.c b/MagickCore/draw.c index 7454c1337..ab9816a83 100644 --- a/MagickCore/draw.c +++ b/MagickCore/draw.c @@ -282,8 +282,6 @@ MagickExport DrawInfo *CloneDrawInfo(const ImageInfo *image_info, (void) CloneString(&clone_info->text,draw_info->text); if (draw_info->font != (char *) NULL) (void) CloneString(&clone_info->font,draw_info->font); - if (draw_info->font_features != (char *) NULL) - (void) CloneString(&clone_info->font_features,draw_info->font_features); if (draw_info->metrics != (char *) NULL) (void) CloneString(&clone_info->metrics,draw_info->metrics); if (draw_info->family != (char *) NULL) @@ -838,8 +836,6 @@ MagickExport DrawInfo *DestroyDrawInfo(DrawInfo *draw_info) draw_info->stroke_pattern=DestroyImage(draw_info->stroke_pattern); if (draw_info->font != (char *) NULL) draw_info->font=DestroyString(draw_info->font); - if (draw_info->font_features != (char *) NULL) - draw_info->font_features=DestroyString(draw_info->font_features); if (draw_info->metrics != (char *) NULL) draw_info->metrics=DestroyString(draw_info->metrics); if (draw_info->family != (char *) NULL) @@ -2068,15 +2064,6 @@ MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info, (void) CloneString(&graphic_context[n]->family,token); break; } - if (LocaleCompare("font-features",keyword) == 0) - { - GetMagickToken(q,&q,token); - (void) CloneString(&graphic_context[n]->font_features,token); - if (LocaleCompare("none",token) == 0) - graphic_context[n]->font_features=(char *) - RelinquishMagickMemory(graphic_context[n]->font_features); - break; - } if (LocaleCompare("font-size",keyword) == 0) { GetMagickToken(q,&q,token); @@ -4876,9 +4863,6 @@ MagickExport void GetDrawInfo(const ImageInfo *image_info,DrawInfo *draw_info) draw_info->stroke_antialias=clone_info->antialias; if (clone_info->font != (char *) NULL) draw_info->font=AcquireString(clone_info->font); - option=GetImageOption(clone_info,"font-features"); - if (option != (char *) NULL) - draw_info->font_features=AcquireString(option); if (clone_info->density != (char *) NULL) draw_info->density=AcquireString(clone_info->density); draw_info->text_antialias=clone_info->antialias; diff --git a/MagickCore/draw.h b/MagickCore/draw.h index 383fa3bd0..5047dc58f 100644 --- a/MagickCore/draw.h +++ b/MagickCore/draw.h @@ -254,8 +254,7 @@ typedef struct _DrawInfo *text, *font, *metrics, - *family, - *font_features; + *family; size_t face; diff --git a/MagickCore/option.c b/MagickCore/option.c index 44749d4e8..36a2a647f 100644 --- a/MagickCore/option.c +++ b/MagickCore/option.c @@ -477,8 +477,6 @@ static const OptionInfo { "-flop", 0L, SimpleOperatorFlag, MagickFalse }, { "+font", 0L, ImageInfoOptionFlag | DrawInfoOptionFlag, MagickFalse }, { "-font", 1L, ImageInfoOptionFlag | DrawInfoOptionFlag, MagickFalse }, - { "+font-features", 0L, ImageInfoOptionFlag | DrawInfoOptionFlag, MagickFalse }, - { "-font-features", 1L, ImageInfoOptionFlag | DrawInfoOptionFlag, MagickFalse }, { "+foreground", 0L, NonMagickOptionFlag, MagickFalse }, { "-foreground", 1L, NonMagickOptionFlag, MagickFalse }, { "+frame", 1L, DeprecateOptionFlag, MagickTrue }, diff --git a/MagickWand/mogrify.c b/MagickWand/mogrify.c index 4832713d0..35f33c820 100644 --- a/MagickWand/mogrify.c +++ b/MagickWand/mogrify.c @@ -1645,11 +1645,6 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc, (void) CloneString(&draw_info->font,argv[i+1]); break; } - if (LocaleCompare("font-features",option+1) == 0) - { - (void) CloneString(&draw_info->font_features,argv[i+1]); - break; - } if (LocaleCompare("format",option+1) == 0) { format=argv[i+1]; diff --git a/MagickWand/operation.c b/MagickWand/operation.c index ac2f5902c..96f63e448 100644 --- a/MagickWand/operation.c +++ b/MagickWand/operation.c @@ -893,11 +893,6 @@ WandPrivate void CLISettingOptionInfo(MagickCLI *cli_wand, (void) CloneString(&_image_info->font,_draw_info->font); break; } - if (LocaleCompare("font-features",option+1) == 0) - { - (void) CloneString(&_draw_info->font_features,ArgOption(NULL)); - break; - } if (LocaleCompare("format",option+1) == 0) { /* FUTURE: why the ping test, you could set ping after this! */ -- 2.40.0