PHP | ImagickDraw setFont() Function Last Updated : 11 Jul, 2025 Summarize Comments Improve Suggest changes Share Like Article Like Report The ImagickDraw::setFont() function is an inbuilt function in PHP which is used to set the fully-specified font to use when annotating with text. Syntax: bool ImagickDraw::setFont( $font_name ) Parameters: This function accepts a single parameter $font_name which is used to hold the value of font name as string. Return Value: This function returns True on success. Below programs illustrates the ImagickDraw::setFont() function in PHP: Program 1: php <?php // Create an ImagickDraw object. $draw = new ImagickDraw(); // Set the fill color $draw->setFillColor('green'); // Set the Font Size $draw->setFontSize(40); // Set the Font Style $draw->setFont("./font/IndieFlower.ttf"); // Set the text to be added $draw->annotation(50, 50, "GeeksForGeeks"); // Set the Font Style $draw->setFont("./font/DancingScript-Regular.ttf"); // Set the text to be added $draw->annotation(10, 100, "A Computer Science Portal For Geeks!"); // Set the Font Style $draw->setFont("./font/NanumGothic-Regular.ttf"); // Set the text to be added $draw->annotation(50, 150, "@sarthak_ishu11"); // Create new Imagick object $imagick = new Imagick(); // Set the image dimension $imagick->newImage(560, 200, 'white'); // Set the image format $imagick->setImageFormat("png"); // Draw the image $imagick->drawImage($draw); header("Content-Type: image/png"); // Display the image echo $imagick->getImageBlob(); ?> Output: Program 2: php <?php // Create an ImagickDraw object $draw = new ImagickDraw(); // Set the Font Size $draw->setFontSize(40); // Set the image filled color $draw->setFillColor('green'); // Draw the rectangle $draw->rectangle(30, 100, 300, 300); // Set the image filled color $draw->setFillColor('black'); // Set the font style $draw->setFont("./font/IndieFlower.ttf"); // Set the text to be added $draw->annotation(35, 280, "GeeksForGeeks"); // Create new Imagick object $imagick = new Imagick(); // Set the image dimensions $imagick->newImage(330, 330, 'white'); // Set the image format $imagick->setImageFormat("png"); // Draw the image $imagick->drawImage($draw); header("Content-Type: image/png"); // Display the image echo $imagick->getImageBlob(); ?> Output: Reference: https://www.php.net/manual/en/imagickdraw.setfont.php Comment More infoAdvertise with us Next Article PHP | Imagick setFont() Function S sarthak_ishu11 Follow Improve Article Tags : Technical Scripter Web Technologies PHP Image-Processing PHP-function PHP-Imagick +2 More Similar Reads PHP | GmagickDraw setfont() function The GmagickDraw::setfont() function is an inbuilt function in PHP which is used to set the fully-specified font to use when annotating with text. Syntax: GmagickDraw GmagickDraw::setfont( string $font ) Parameters:This function accepts a single parameter $font which is used to hold the value of font 1 min read PHP | ImagickDraw setFontSize() Function The ImagickDraw::setFontSize() function is an inbuilt function in PHP which is used to set the font point size. It is used when annotating with text. Syntax:  bool ImagickDraw::setFontSize( $pointsize ) Parameters: This function accepts a single parameter $pointsize which is used to hold the value 2 min read PHP | ImagickDraw setFontStyle() Function The ImagickDraw::setFontStyle() function is an inbuilt function in PHP which is used to set the font style to use when annotating with text. The AnyStyle enumeration acts as a wild-card "don't care" option. Syntax: bool ImagickDraw::setFontStyle( $style ) Parameters: This function accepts a single p 2 min read PHP | Imagick setFont() Function The Imagick::setFont() function is an inbuilt function in PHP which is used to set the font. Syntax: bool Imagick::setFont( string $font ) Parameters: This function accepts single parameter $font which holds the name of font file. Return Value: This function returns TRUE on success. Extensions: GD e 1 min read PHP | ImagickDraw setFontFamily() Function The ImagickDraw::setFontFamily() function is an inbuilt function in PHP which is used to set the font family to use when annotating with text. Syntax: bool ImagickDraw::setFontFamily( $font_family ) Parameters:This function accepts a single parameter $font_family which is used to hold the value of 2 min read PHP | ImagickDraw setFontWeight() Function The ImagickDraw::setFontWeight() function is an inbuilt function in PHP which is used to set the font-weight. Syntax: bool ImagickDraw::setFontWeight( $font_weight ) Parameters: This function accepts a single parameter $font_weight which is used to hold the value of font weight as integer type. Retu 2 min read Like