imagefontwidth
(PHP 4, PHP 5, PHP 7)
imagefontwidth - 获取字体宽度
描述
int imagefontwidth ( int $font )
返回字体中字符的像素宽度。
参数
`font`
对于latin2编码(其中较大的数字对应较大的字体)或使用imageloadfont()注册的任何自己的字体标识符,可以为1,2,3,4,5。
返回值
返回字体的像素宽度。
例子
Example #1 Using imagefontwidth() on built-in fonts
<?php
echo 'Font width: ' . imagefontwidth(4);
?>
上面的例子会输出类似于:
Font width: 8
Example #2 Using imagefontwidth() together with imageloadfont()
<?php
// Load a .gdf font
$font = imageloadfont('anonymous.gdf');
echo 'Font width: ' . imagefontwidth($font);
?>
上面的例子会输出类似于:
Font width: 23
← imagefontheight
imageftbbox →
本文档系腾讯云开发者社区成员共同维护,如有问题请联系 cloudcommunity@tencent.com