牛牛在线工具

UI\Draw\Text\Font\Descriptor::__construct()

收录 8868 个 PHP 函数,含用途说明与用法示例。

UI\Draw\Text\Font\Descriptor::__construct()

创建 UI\Draw\Text\Font\Descriptor 类的新实例

函数名称: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) 参数: $family:字体名称,字符串类型,表示要使用的字体的名称。 $size:字体大小,浮点数类型,表示要使用的字体的大小。 $weight:字体粗细,整数类型,表示要使用的字体的粗细程度。可选值有: 0:正常(默认值) 1:粗体 $italic:字体斜体,整数类型,表示要使用的字体是否为斜体。可选值有: 0:非斜体(默认值) 1:斜体 示例: $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 扩展。