Setting caption font properties using MagickWand API
Posted: 2007-10-28T12:20:01-07:00
How are caption: font type, font color and other font properties set using MagickWand API?
Use https://github.com/ImageMagick/ImageMagick/discussions instead.
https://imagemagick.com/discourse-server/
https://imagemagick.com/discourse-server/viewtopic.php?t=9997
Code: Select all
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% M a g i c k S e t F o n t %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% MagickSetFont() sets the font for the MagickWand.
%
% The format of the MagickSetFont method is:
%
% MagickBooleanType MagickSetFont(MagickWand *wand, const char *font)
%
% A description of each parameter follows:
%
% o wand: The magick wand.
%
% o font: the font
%
*/
WandExport MagickBooleanType MagickSetFont(MagickWand *wand, const char *font)
{
if ((font == (const char *) NULL) || (*font == '\0'))
return(MagickFalse);
assert(wand != (MagickWand *) NULL);
assert(wand->signature == WandSignature);
if (wand->debug != MagickFalse)
(void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
(void) CloneString(&wand->image_info->font,font);
return(MagickTrue);
}
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% M a g i c k G e t F o n t %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% MagickGetFont() gets the font from the MagickWand.
%
% The format of the MagickGetFont method is:
%
% char *MagickGetFont(MagickWand *wand)
%
% A description of each parameter follows:
%
% o wand: The magick wand.
%
*/
WandExport char *MagickGetFont(MagickWand *wand)
{
assert(wand != (MagickWand *) NULL);
assert(wand->signature == WandSignature);
if (wand->debug != MagickFalse)
(void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
if(wand->image_info->font != (char *) NULL)
return(AcquireString(wand->image_info->font));
return((char *) NULL);
}
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% M a g i c k S e t F o n t S i z e %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% MagickSetFontSize() sets the font size for the MagickWand.
%
% The format of the MagickSetFontSize method is:
%
% MagickBooleanType MagickSetFontSize(MagickWand *wand, const double pointsize)
%
% A description of each parameter follows:
%
% o wand: The magick wand.
%
% o pointsize: the size of the font
%
*/
WandExport MagickBooleanType MagickSetFontSize(MagickWand *wand, const double pointsize)
{
assert(wand != (MagickWand *) NULL);
assert(wand->signature == WandSignature);
if (wand->debug != MagickFalse)
(void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
wand->image_info->pointsize = pointsize;
return(MagickTrue);
}
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% M a g i c k G e t F o n t S i z e %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% MagickGetFontSize() gets the font size from the MagickWand.
%
% The format of the MagickGetFontSize method is:
%
% double MagickGetFontSize(MagickWand *wand)
%
% A description of each parameter follows:
%
% o wand: The magick wand.
%
*/
WandExport double MagickGetFontSize(MagickWand *wand)
{
assert(wand != (MagickWand *) NULL);
assert(wand->signature == WandSignature);
if (wand->debug != MagickFalse)
(void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
return(wand->image_info->pointsize);
}