如何使用 PHP 中的 imagefontheight() 函数获取指定字体中字符的像素高度?
imagefontheight()是PHP中的一个内置函数,用于获取指定字体中字符的像素高度。
语法
int imagefontheight(int $font)
参数
imagefontheight()接受一个参数$font。它保存字体值。内置字体的$font值可以是1、2、3、4和5,也可以通过使用imageloadfont()自定义字体的函数来使用。
返回值
imagefontheight()返回字体的像素高度。
示例1
输出结果Font height: 13
示例2
'; //输出结果
is used for the line break echo 'Font height for the font value 2 is' .imagefontheight(2) . '
'; echo 'Font height for the font value 3 is' .imagefontheight(3) . '
'; echo 'Font height for the font value 4 is' .imagefontheight(4) .'
'; echo 'Font height for the font value 5 is ' .imagefontheight(5) .'
'; ?>
Font height for the font value 1 is 8 Font height for the font value 2 is 13 Font height for the font value 3 is 13 Font height for the font value 4 is 16 Font height for the font value 5 is 15
热门推荐
10 简短正能量生日祝福语
11 新年祝福语长辈简短红包
12 鼓励孩子小考祝福语简短
13 生日祝福语男孩 简短独特
14 简短祝福语蛋糕简笔画
15 18岁的祝福语简短
16 老同学十一祝福语简短
17 新年送老师简短祝福语
18 给女儿祝福语简短精辟