PHP | ImagickDraw getFont() Function Last Updated : 19 Dec, 2019 Comments Improve Suggest changes Like Article Like Report The ImagickDraw::getFont() function is an inbuilt function in PHP which is used to get the string specifying the font used when annotating with text. Syntax: string ImagickDraw::getFont( void ) Parameters: This function doesn’t accepts any parameters. Return Value: This function returns an string value containing the name of the font. Exceptions: This function throws ImagickException on error. Below programs illustrate the ImagickDraw::getFont() function in PHP: Program 1: php <?php // Create a new ImagickDraw object $draw = new ImagickDraw(); // Get the font $font = $draw->getFont(); echo $font; ?> Output: Empty string which is the default font. Program 2: php <?php // Create a new ImagickDraw object $draw = new ImagickDraw(); // Set the font to a font file name which // should be present in the same folder $draw->setFont('roboto.ttf'); // Get the font $font = $draw->getFont(); echo $font; ?> Output: /home/user/php/roboto.ttf Program 3: php <?php // Create a new imagick object $imagick = new Imagick(); // Create a image on imagick object $imagick->newImage(800, 250, 'yellow'); // Create a new ImagickDraw object $draw = new ImagickDraw(); // Set the font size $draw->setFontSize(30); // Annotate a text $draw->annotation(50, 100, 'The Font here is default.'); // Set the font to a ttf file which should be // placed in same folder where the program is. $draw->setFont('Pacifico.ttf'); // Annotate a text $draw->annotation(50, 200, 'The Font here is ' . $draw->getFont() . '.'); // Render the draw commands $imagick->drawImage($draw); // Show the output $imagick->setImageFormat('png'); header("Content-Type: image/png"); echo $imagick->getImageBlob(); ?> Output: Reference: https://www.php.net/manual/en/imagickdraw.getfont.php Comment More infoAdvertise with us Next Article PHP | GmagickDraw getfont() Function G gurrrung Follow Improve Article Tags : Web Technologies PHP PHP-function PHP-Imagick Similar Reads PHP | GmagickDraw getfont() Function The GmagickDraw::getfont() function is an inbuilt function in PHP which is used to get the string specifying the font used when annotating with text. Syntax: string GmagickDraw::getfont( void ) Parameters: This function doesnât accept any parameters. Return Value: This function returns an string val 2 min read PHP | ImagickDraw getFontSize() Function The ImagickDraw::getFontSize() function is an inbuilt function in PHP which is used to get the font pointsize used when annotating with text. Syntax: float ImagickDraw::getFontSize( void ) Parameters: This function doesnât accept any parameter. Return Value: This function returns a float value conta 1 min read PHP | ImagickDraw getFontSize() Function The ImagickDraw::getFontSize() function is an inbuilt function in PHP which is used to get the font pointsize used when annotating with text. Syntax: float ImagickDraw::getFontSize( void ) Parameters: This function doesnât accept any parameter. Return Value: This function returns a float value conta 1 min read PHP | ImagickDraw getFontStyle() Function The ImagickDraw::getFontStyle() function is an inbuilt function in PHP which is used to get the font style used when annotating with text. Syntax: int ImagickDraw::getFontStyle( void ) Parameters: This function doesnât accepts any parameters. Return Value: This function returns an integer value corr 2 min read PHP | Imagick getFont() Function The Imagick::getFont() function is an inbuilt function in PHP which is used to get the font. Syntax: int Imagick::getFont( void ) Parameters: This function doesn't accept any parameters. Return Value: This function returns a string containing address of font file on success. Below program illustrate 1 min read PHP | Imagick getFont() Function The Imagick::getFont() function is an inbuilt function in PHP which is used to get the font. Syntax: int Imagick::getFont( void ) Parameters: This function doesn't accept any parameters. Return Value: This function returns a string containing address of font file on success. Below program illustrate 1 min read Like