ImagickDraw::getTextInterwordSpacing()函数是PHP中的内置函数,用于获取文本inter-word间距,该间距表示每个单词之间的间距。数字越大,包含的空间越大。默认间距为0。
用法:
float ImagickDraw::getTextInterwordSpacing( void )
参数:此函数不接受任何参数。
返回值:此函数返回一个浮点值,其中包含文本词间间距。
以下示例程序旨在说明PHP中的ImagickDraw::getTextInterwordSpacing()函数:
示例1:
<?php
// Create a new ImagickDraw object
$draw = new ImagickDraw();
// Get the text interword spacing
$textInterwordSpacing = $draw->getTextInterwordSpacing();
echo $textInterwordSpacing;
?>
输出:
0 // Which is the default value
示例2:
<?php
// Create a new ImagickDraw object
$draw = new ImagickDraw();
// Get the text interword spacing
$draw->setTextInterWordSpacing(30);
// Get the text interword spacing
$textInterwordSpacing = $draw->getTextInterwordSpacing();
echo $textInterwordSpacing;
?>
输出:
30
示例3:
<?php
// Create a new imagick object
$imagick = new Imagick();
// Create a image on imagick object
$imagick->newImage(800, 250, '#c0eb34');
// Create a new ImagickDraw object
$draw = new ImagickDraw();
// Set the font size
$draw->setFontSize(20);
// Annotate a text
$draw->annotation(50, 80, "The text interterword spacing here is "
. $draw->getTextInterwordSpacing());
// Set the text interword spacing
$draw->setTextInterwordSpacing(20);
// Annotate a text
$draw->annotation(50, 120, "The text interterword spacing here is "
. $draw->getTextInterwordSpacing());
// Set the text interword spacing
$draw->setTextInterwordSpacing(35);
// Annotate a text
$draw->annotation(50, 160, "The text interterword spacing here is "
. $draw->getTextInterwordSpacing());
// Render the draw commands
$imagick->drawImage($draw);
// Show the output
$imagick->setImageFormat('png');
header("Content-Type: image/png");
echo $imagick->getImageBlob();
?>
输出:
参考: https://www.php.net/manual/en/imagickdraw.gettextinterwordspacing.php
相关用法
- PHP ImagickDraw arc()用法及代码示例
- PHP ImagickDraw pop()用法及代码示例
- PHP ImagickDraw getTextAlignment()用法及代码示例
- PHP ImagickDraw destroy()用法及代码示例
- PHP ImagickDraw getStrokeDashOffset()用法及代码示例
- PHP ImagickDraw setTextEncoding()用法及代码示例
- PHP ImagickDraw getTextEncoding()用法及代码示例
- PHP ImagickDraw setFontWeight()用法及代码示例
- PHP ImagickDraw getFillRule()用法及代码示例
- PHP ImagickDraw setClipPath()用法及代码示例
- PHP ImagickDraw getClipPath()用法及代码示例
- PHP ImagickDraw color()用法及代码示例
- PHP ImagickDraw setStrokeMiterLimit()用法及代码示例
- PHP ImagickDraw comment()用法及代码示例
- PHP ImagickDraw polyline()用法及代码示例
注:本文由纯净天空筛选整理自gurrrung大神的英文原创作品 PHP | ImagickDraw getTextInterwordSpacing() Function。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。