HomeLanguagesPHP | ImagickDraw setTextInterlineSpacing() Function

PHP | ImagickDraw setTextInterlineSpacing() Function

The ImagickDraw::setTextInterlineSpacing() function is an inbuilt function in PHP which is used to set the text interline spacing.

Syntax:

bool ImagickDraw::setTextInterlineSpacing( float $spacing )

Parameters: This function accepts a single parameter $spacing which holds the text interline spacing.

Return Value: This function returns TRUE on success.

Below programs illustrate the ImagickDraw::setTextInterlineSpacing() function in PHP:

Program 1:




<?php
  
// Create a new ImagickDraw object
$draw = new ImagickDraw();
   
// Set the text interline spacing
$draw->setTextInterLineSpacing(15);
   
// Get the text interline spacing
$textInterlineSpacing = $draw->getTextInterLineSpacing();
echo $textInterlineSpacing;
?>


Output:

15

Program 2:




<?php
  
// Create a new imagick object
$imagick = new Imagick();
  
// Create a image on imagick object
$imagick->newImage(800, 250, 'white');
  
// Create a new ImagickDraw object
$draw = new ImagickDraw();
  
// Set the fill color
$draw->setFillColor('green');
  
// Set the font size
$draw->setFontSize(40);
  
// Set the text interline spacing
$draw->setTextInterLineSpacing(40);
  
// Annotate a text
$draw->annotation(350, 70, "Geeks \nfor\nGeeks");
  
// Render the draw commands
$imagick->drawImage($draw);
  
// Show the output
$imagick->setImageFormat('png');
header("Content-Type: image/png");
echo $imagick->getImageBlob();
?>


Output:

Reference: https://www.php.net/manual/en/imagickdraw.settextinterlinespacing.php

Dominic
Dominichttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Dominic
32688 POSTS0 COMMENTS
Milvus
131 POSTS0 COMMENTS
Nango Kala
7057 POSTS0 COMMENTS
Nicole Veronica
12198 POSTS0 COMMENTS
Nokonwaba Nkukhwana
12293 POSTS0 COMMENTS
Shaida Kate Naidoo
7182 POSTS0 COMMENTS
Ted Musemwa
7447 POSTS0 COMMENTS
Thapelo Manthata
7160 POSTS0 COMMENTS
Umr Jansen
7150 POSTS0 COMMENTS