Draw text command

绘制文字命令

实现

构造函数

属性

align: string = 'left'

Text alignment

对齐方式

bold: boolean

Whether the text is bold

是否为粗体

color: string = '#ffffff'

Text color, e.g., "#ff0000".

文本颜色,比如"#ff0000"。

fontFamily: string

Font family

字体名称

fontSize: number = 20

Font size

字号

italic: boolean

Whether the text is italic

是否为斜体

letterSpacing: number = 0

Letter spacing

字间距

shadowBlur: number = 0

Shadow blur radius

阴影模糊半径

shadowColor: string = '#000000'

Shadow color

阴影颜色

shadowOffsetX: number = 0

Shadow offset in the x direction

阴影在x方向的偏移量

shadowOffsetY: number = 0

Shadow offset in the y direction

阴影在y方向的偏移量

singleCharRender: boolean

Whether to render single characters separately

是否单字分开渲染

stroke: number = 0

Stroke width

描边宽度

strokeColor: string = '#000000'

Stroke color

描边颜色

text: string

Text content

文本内容

x: number = 0

The x position of the start of the text (relative to the canvas).

开始绘制文本的 x 坐标位置(相对于画布)。

y: number = 0

The y position of the start of the text (relative to the canvas).

开始绘制文本的 y 坐标位置(相对于画布)。

ID: string = className

Identifier for the FillTextCmd

绘制文字命令的标识符

访问器

方法

  • 参数

    • text: string

      Text content

    • x: number

      X position

    • y: number

      Y position

    • font: string

      Font

    • 可选color: string

      Text color

    • 可选align: string

      Alignment

    • 可选stroke: number

      Stroke width

    • 可选strokeColor: string

      Stroke color

    返回 FillTextCmd

    FillTextCmd instance

    Create a FillTextCmd instance

    创建绘制文本的命令的实例