Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

PHP | GmagickDraw getfontstyle() Function

  • Last Updated : 21 Jan, 2020

The GmagickDraw::getfontstyle() function is an inbuilt function in PHP which is used to get the font style used when annotating with text.


int GmagickDraw::getfontstyle( void )

Parameters: This function doesn’t accept any parameters.

Return Value: This function returns an integer value corresponding to one of the STYLE constants.
The list of STYLE constants are given below:

  • Gmagick::STYLE_NORMAL (Integer)
  • Gmagick::STYLE_ITALIC (Integer)
  • Gmagick::STYLE_OBLIQUE (Integer)
  • Gmagick::STYLE_ANY (Integer)

Exceptions: This function throws GmagickDrawException on error.

Below given programs illustrate the GmagickDraw::getfontstyle() function in PHP:

Used Image:

Program 1:

// Create a new GmagickDraw object 
$draw = new GmagickDraw(); 
// Get the font Style 
$fontStyle = $draw->getfontstyle(); 
echo $fontStyle


0 // Which is the default value.

Program 3:

// Create a new GmagickDraw object 
$draw = new GmagickDraw(); 
// Set the font style
// Get the font Style 
$fontStyle = $draw->getfontstyle(); 
echo $fontStyle



Program 2:

// Create a new Gmagick object
$gmagick = new Gmagick('geeksforgeeks.png');
// Create a GmagickDraw object
$draw = new GmagickDraw();
// Set the color
// Set the font size
// Draw rectangle for background
$draw->rectangle(-10, -10, 800, 400);
// Set the fill color
// Set the font style to Italic
// Annotate a text
$draw->annotate(50, 100, 'The Font style here is '
    . $draw->getFontStyle() . '.');
// Use of drawimage functeannotate
// Display the output image
header("Content-Type: image/png");
echo $gmagick->getImageBlob();



My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!