PHP | GmagickDraw setfont() function Last Updated : 23 Jan, 2020 Summarize Comments Improve Suggest changes Share Like Article Like Report 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 name as string. Return Value: This function returns GmagickDraw object on success. Exceptions: This function throws GmagickDrawException on error. Below given programs illustrate the GmagickDraw::setfont() function in PHP: Program 1: php <?php // Create a GmagickDraw object $draw = new GmagickDraw(); // Set the font using a local ttf file $draw->setfont('roboto.ttf'); // Get the font $font = $draw->getfont(); echo $font; ?> Output: /home/user/php/roboto.ttf Program 2: php <?php // Create a new Gmagick object // https://media.geeksforgeeks.org/wp-content/uploads/geeksforgeeks-13.png $gmagick = new Gmagick('geeksforgeeks.png'); // Create a GmagickDraw object $draw = new GmagickDraw(); // Draw rectangle for background $draw->rectangle(-100, -1000, 800, 400); // Set the font size $draw->setfontsize(90); // Set the stroke color $draw->setstrokecolor('red'); // Set the font $draw->setfont('Pacifico.ttf'); // Create a rectangle $draw->annotate(20, 110, 'GeeksforGeeks'); // Use of drawimage function $gmagick->drawImage($draw); // Display the output image header("Content-Type: image/png"); echo $gmagick->getImageBlob(); ?> Output: Reference: https://www.php.net/manual/en/gmagickdraw.setfont.php Comment More infoAdvertise with us Next Article PHP | GmagickDraw setfontstyle() Function G gurrrung Follow Improve Article Tags : Web Technologies PHP PHP-function PHP-Gmagick Similar Reads PHP | ImagickDraw setFont() Function 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 na 2 min read PHP | GmagickDraw setfontsize() Function The Gmagick::setfontsize() function is an inbuilt function in PHP which is used to set the font size to use when annotating with text. Syntax: public GmagickDraw::setfontsize( $pointsize )  Parameters: This function accept single parameter $pointsize which is used to store font size. Return Value: 2 min read PHP | GmagickDraw setfontstyle() Function The GmagickDraw::setfontstyle() function is an inbuilt function in PHP that is used to set the font style to use when annotating with text. Style enumeration acts as a wild-card don't care option. Syntax: public GmagickDraw::setfontstyle( $style ) : GmagickDraw Parameters: This function accepts a s 2 min read PHP | GmagickDraw setfontweight() Function The GmagickDraw::setfontweight() function is an inbuilt function in PHP that is used to set the font weight. Syntax: public GmagickDraw::setfontweight( $font_weight ) : GmagickDraw Parameters: This function accepts a single parameter $font_weight which is used to hold the value of font-weight as an 2 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 Like