PHP | Imagick setFont() Function Last Updated : 17 Aug, 2020 Comments Improve Suggest changes 1 Likes Like Report 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 extension needs to be installed for this function. Below programs illustrate the Imagick::getFont() function in PHP: Program 1: php <?php // Create a new imagick object $imagick = new Imagick(); // Use setFont() function to set the // font using .ttf font file. The .ttf // file is placed in same folder $imagick->setFont('Windsong.ttf'); // Write a caption in image format $imagick->newPseudoImage(800, 350, "caption:GeekforGeeks"); // Show the output $imagick->setformat('png'); header("Content-Type: image/png"); echo $imagick->getImageBlob(); ?> Output: Program 2: php <?php // Create a new imagick object $imagick = new Imagick(); // Set the font - make sure .ttf font file // is placed in same folder $imagick->setFont('FFF_Tusj.ttf'); // Write the caption in a image $imagick->newPseudoImage(800, 350, "caption:GeekforGeeks"); // Show the output $imagick->setformat('png'); header("Content-Type: image/png"); echo $imagick->getImageBlob(); ?> Output: Reference: https://www.php.net/manual/en/imagick.setfont.php Create Quiz Comment G gurrrung Follow 1 Improve G gurrrung Follow 1 Improve Article Tags : Web Technologies PHP PHP-function PHP-Imagick Explore BasicsPHP Syntax4 min readPHP Variables5 min readPHP | Functions6 min readPHP Loops4 min readArrayPHP Arrays5 min readPHP Associative Arrays4 min readMultidimensional arrays in PHP5 min readSorting Arrays in PHP4 min readOOPs & InterfacesPHP Classes2 min readPHP | Constructors and Destructors5 min readPHP Access Modifiers4 min readMultiple Inheritance in PHP4 min readMySQL DatabasePHP | MySQL Database Introduction4 min readPHP Database connection2 min readPHP | MySQL ( Creating Database )3 min readPHP | MySQL ( Creating Table )3 min readPHP AdvancePHP Superglobals6 min readPHP | Regular Expressions12 min readPHP Form Handling4 min readPHP File Handling4 min readPHP | Uploading File3 min readPHP Cookies9 min readPHP | Sessions7 min read Like