PHP | Imagick setFont() Function
Last Updated :
17 Aug, 2020
The Imagick::setFont() function is an inbuilt function in PHP which is used to set the font.
Syntax:
bool Imagick::setFont( string $font )
Parameters: This function accepts single parameter $font which holds the name of font file.
Return Value: This function returns TRUE on success.
Extensions: GD extension needs to be installed for this function.
Below programs illustrate the Imagick::getFont() function in PHP:
Program 1:
<?php
$imagick = new Imagick();
$imagick ->setFont( 'Windsong.ttf' );
$imagick ->newPseudoImage(800, 350, "caption:GeekforGeeks" );
$imagick ->setformat( 'png' );
header( "Content-Type: image/png" );
echo $imagick ->getImageBlob();
?>
|
Output:
Program 2:
<?php
$imagick = new Imagick();
$imagick ->setFont( 'FFF_Tusj.ttf' );
$imagick ->newPseudoImage(800, 350, "caption:GeekforGeeks" );
$imagick ->setformat( 'png' );
header( "Content-Type: image/png" );
echo $imagick ->getImageBlob();
?>
|
Output:
Reference: https://www.php.net/manual/en/imagick.setfont.php
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...