Skip to content

Commit

Permalink
https://github.com/ImageMagick/ImageMagick/issues/4558
Browse files Browse the repository at this point in the history
  • Loading branch information
Cristy committed Dec 11, 2021
1 parent ecb4ffa commit 54c3203
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
3 changes: 3 additions & 0 deletions ChangeLog
@@ -1,6 +1,9 @@
2021-12-11 7.1.0-18 <quetzlzacatenango@image...>
* Release ImageMagick version 7.1.0-18 GIT revision 19...

2021-12-11 7.1.0-18 <quetzlzacatenango@image...>
* support face index for font collections, e.g. msgothic.ttc[1].

2021-12-11 7.1.0-18 Dirk Lemstra <dirk@lem.....org>
* Improved adjustment of page offset when resizing an image.

Expand Down
18 changes: 16 additions & 2 deletions MagickCore/annotate.c
Expand Up @@ -1382,6 +1382,9 @@ static MagickBooleanType RenderFreetype(Image *image,const DrawInfo *draw_info,
FT_Library
library;

FT_Long
face_index;

FT_Matrix
affine;

Expand Down Expand Up @@ -1443,16 +1446,27 @@ static MagickBooleanType RenderFreetype(Image *image,const DrawInfo *draw_info,
if (ft_status != 0)
ThrowBinaryException(TypeError,"UnableToInitializeFreetypeLibrary",
image->filename);
face_index=(FT_Long) draw_info->face;
args.flags=FT_OPEN_PATHNAME;
if (draw_info->font == (char *) NULL)
args.pathname=ConstantString("helvetica");
else
if (*draw_info->font != '@')
args.pathname=ConstantString(draw_info->font);
else
args.pathname=ConstantString(draw_info->font+1);
{
/*
Extract face index, e.g. @msgothic[1].
*/
ImageInfo *image_info=AcquireImageInfo();
(void) strcpy(image_info->filename,draw_info->font+1);
(void) SetImageInfo(image_info,0,exception);
face_index=(FT_Long) image_info->scene;
args.pathname=ConstantString(image_info->filename);
image_info=DestroyImageInfo(image_info);
}
face=(FT_Face) NULL;
ft_status=FT_Open_Face(library,&args,(long) draw_info->face,&face);
ft_status=FT_Open_Face(library,&args,face_index,&face);
if (ft_status != 0)
{
(void) FT_Done_FreeType(library);
Expand Down

0 comments on commit 54c3203

Please sign in to comment.