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.
Syntax:
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:
<?php
$draw = new GmagickDraw();
$fontStyle = $draw ->getfontstyle();
echo $fontStyle ;
?>
|
Output:
0 // Which is the default value.
Program 3:
<?php
$draw = new GmagickDraw();
$draw ->setfontstyle(2);
$fontStyle = $draw ->getfontstyle();
echo $fontStyle ;
?>
|
Output:
2
Program 2:
<?php
$gmagick = new Gmagick( 'geeksforgeeks.png' );
$draw = new GmagickDraw();
$draw ->setFillColor( '#0E0E0E' );
$draw ->setfontsize(40);
$draw ->rectangle(-10, -10, 800, 400);
$draw ->setFillColor( 'white' );
$draw ->setFontStyle(Gmagick::STYLE_ITALIC);
$draw ->annotate(50, 100, 'The Font style here is '
. $draw ->getFontStyle() . '.' );
$gmagick ->drawImage( $draw );
header( "Content-Type: image/png" );
echo $gmagick ->getImageBlob();
?>
|
Output:
Reference: https://www.php.net/manual/en/gmagickdraw.getfontstyle.php
Share your thoughts in the comments
Please Login to comment...