PHP | ImagickDraw setTextInterwordSpacing() Function
Last Updated :
17 Dec, 2019
The ImagickDraw::setTextInterwordSpacing() function is an inbuilt function in PHP which is used to used to set the text interword spacing which means nothing but space between each word. The greater the number the greater the space will be. The default spacing is 0.
Syntax:
bool ImagickDraw::setTextInterwordSpacing( float $spacing )
Parameters: This function accepts a single parameter $spacing which holds the text interword spacing.
Return Value: This function returns TRUE on success.
Below programs illustrate the ImagickDraw::setTextInterwordSpacing() function in PHP:
Program 1:
<?php
$draw = new ImagickDraw();
$draw ->setTextInterWordSpacing(40);
$textInterwordSpacing = $draw ->getTextInterwordSpacing();
echo $textInterwordSpacing ;
?>
|
Output:
40
Program 2:
<?php
$imagick = new Imagick();
$imagick ->newImage(800, 250, '#1cced4' );
$draw = new ImagickDraw();
$draw ->setFontSize(50);
$draw ->setTextInterwordSpacing(65);
$draw ->annotation(150, 140, "Geeks for Geeks" );
$imagick ->drawImage( $draw );
$imagick ->setImageFormat( 'png' );
header( "Content-Type: image/png" );
echo $imagick ->getImageBlob();
?>
|
Output:
Reference: https://www.php.net/manual/en/imagickdraw.settextinterwordspacing.php
Share your thoughts in the comments
Please Login to comment...