函数名称:UI\Draw\Text\Font\Descriptor::__construct()
适用版本:PHP 7.4.0 及以上版本
函数用法: UI\Draw\Text\Font\Descriptor::__construct() 函数用于创建 UI\Draw\Text\Font\Descriptor 类的新实例。该类用于描述字体的特性,例如字体名称、大小、样式等。
语法:
public UI\Draw\Text\Font\Descriptor::__construct(string $family, float $size, int $weight, int $italic)
参数:
示例:
$fontDescriptor = new UI\Draw\Text\Font\Descriptor("Arial", 12.0, 0, 0);
以上示例将创建一个 UI\Draw\Text\Font\Descriptor 类的实例,使用 Arial 字体,大小为 12.0,正常粗细,非斜体。
注意:上述示例需要在 PHP 7.4.0 及以上版本中运行,且需要安装并启用 UI 扩展。