PHP GmagickDraw setfontstyle () function

PHP

Syntax:
public GmagickDraw::setfontstyle ($style): GmagickDraw
Parameters: This function takes one $style parameter which is used to store the font style value as an integer type.style constants : a list of style constants is given below:
  • Gmagick::STYLE_NORMAL (integer)
  • Gmagick::STYLE_ITALIC (integer)
  • Gmagick::STYLE_OBLIQUE (integer)
  • Gmagick::STYLE_ANY (integer)
Return value:This function returns a GmagickDraw object if success.The following programs illustrate the GmagickDraw::setfontstyle() function in PHP:Program 1:  
// Create a GmagickDraw object $draw = new GmagickDraw();  
// Set the fill color of the image $draw -> setFillColor ( 'red' );  
// Set font size $draw -> setFontSize (40);  
// Set font style $draw -> setfontstyle (Gmagick::STYLE_OBLIQUE);  
// Set text to add $draw -> annotation (30, 170, "GeeksForGeeks" );  
// Set the fill color of the image $draw -> setFillColor ( 'green' );  
// Set font size $draw -> setFontSize (30);  
// Set text to add $draw -> annotation (30, 250, "Oblique Style" );  
// Create a new Gmagick object $gmagick = new Gmagick();  
// Set image size $gmagick -> newImage (350, 300, 'white' );  
// Set image format $gmagick -> setImageFormat ( "png" );  
// Draw image $gmagick -> drawImage ( $draw ); header ( "Content-Type: image / png" );  
// Show image echo $gmagick -> getImageBlob(); ?>
Output: Program 2:  
// Create GmagickDraw object $draw = new GmagickDraw();  
// Set the fill color of the image $draw -> setFillColor ( 'black' );  
// Set font size $draw -> setFontSize (30);  
// Set font style $draw -> setfontstyle (Gmagick::STYLE_ITALIC);  
// Set text to add $draw -> annotation (30, 170, "GeeksForGeeks" );  
// Set the fill color of the image $draw -> setFillColor ( 'blue' );  
// Set font size $draw -> setFontSize (25);  
// Set text to add $draw -> annotation (30, 250, "Italic Style" );  
// Create a new Gmagick object $gmagick = new Gmagick();  
// Set image size $gmagick -> newImage (350, 300, 'white' );  
// Set image format $gmagick -> setImageFormat ( "png" );  
// Draw image $gmagick -> drawImage ( $draw ); header ( "Content-Type: image / png" );  
// Show image echo $gmagick -> getImageBlob(); ?>
Output: Link: http://php.net/manual/en/gmagickdraw.setfontstyle.php