PHP | ImagickDraw setTextKerning() Function
Last Updated :
17 Dec, 2019
The ImagickDraw::setTextKerning() function is an inbuilt function in PHP which is used to set the text kerning which defines the spacing between the text.
Syntax:
bool ImagickDraw::setTextKerning( float $kerning )
Parameters: This function accepts a single parameter $kerning which holds the text kerning.
Return Value: This function returns TRUE on success.
Exceptions: This function throws ImagickException on error.
Below given programs illustrate the ImagickDraw::setTextKerning() function in PHP:
Program 1:
<?php
$draw = new ImagickDraw();
$draw ->setTextKerning(10);
$textKerning = $draw ->getTextKerning();
echo $textKerning ;
?>
|
Output:
10
Program 2:
<?php
$imagick = new Imagick();
$imagick ->newImage(800, 250, 'black' );
$draw = new ImagickDraw();
$draw ->setFillColor( 'red' );
$draw ->setTextKerning(30);
$draw ->setFontSize(50);
$draw ->annotation(50, 200, 'GeeksforGeeks' );
$imagick ->drawImage( $draw );
$imagick ->setImageFormat( 'png' );
header( "Content-Type: image/png" );
echo $imagick ->getImageBlob();
?>
|
Output:
Reference: https://www.php.net/manual/en/imagickdraw.settextkerning.php
Share your thoughts in the comments
Please Login to comment...