English | 简体中文 | 繁體中文
查询

ImagickDraw::getFontWeight()函数—用法及示例

「 获取当前设置的字体粗细值 」


函数:ImagickDraw::getFontWeight()

适用版本:Imagick 3.4.0

用法:ImagickDraw::getFontWeight() 方法用于获取当前设置的字体粗细值。

示例:

// 创建一个新的ImagickDraw对象
$draw = new ImagickDraw();

// 设置字体粗细为粗体
$draw->setFontWeight(800);

// 获取当前设置的字体粗细值
$fontWeight = $draw->getFontWeight();

// 输出字体粗细值
echo "字体粗细值: " . $fontWeight;

输出:

字体粗细值: 800

在上面的示例中,我们首先创建了一个新的ImagickDraw对象,并使用setFontWeight()方法将字体粗细设置为800(粗体)。然后,使用getFontWeight()方法获取当前设置的字体粗细值,并将其输出到屏幕上。最终输出的结果为"字体粗细值: 800",表示当前字体的粗细值为800。

补充纠错
热门PHP函数
分享链接