PHP | ImagickDraw getTextKerning() Function
Last Updated :
23 Dec, 2019
The ImagickDraw::getTextKerning() function is an inbuilt function in PHP which is used to get the text kerning used in image which is nothing but the spacing between letters.
Syntax:
float ImagickDraw::getTextKerning( void )
Parameters: This function doesn’t accept any parameter.
Return Value: This function returns an float value containing the text kerning.
Exceptions: This function throws ImagickException on error.
Below given programs illustrate the ImagickDraw::getTextKerning() function in PHP:
Program 1:
<?php
$draw = new ImagickDraw();
$textKerning = $draw ->getTextKerning();
echo $textKerning ;
?>
|
Output:
0 // which is the default text kerning.
Program 2:
<?php
$draw = new ImagickDraw();
$draw ->setTextKerning(5);
$textKerning = $draw ->getTextKerning();
echo $textKerning ;
?>
|
Output:
5
Program 3:
<?php
$imagick = new Imagick();
$imagick ->newImage(800, 250, '#eba09b' );
$draw = new ImagickDraw();
$draw ->setFontSize(20);
$draw ->annotation(50, 100,
'The text kerning here is default.' );
$draw ->setTextKerning(10);
$draw ->annotation(50, 200, 'The text kerning here is '
. $draw ->getTextKerning() . '.' );
$imagick ->drawImage( $draw );
$imagick ->setImageFormat( 'png' );
header( "Content-Type: image/png" );
echo $imagick ->getImageBlob();
?>
|
Output:
Reference: https://www.php.net/manual/en/imagickdraw.gettextkerning.php
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...