Skip to main content

drawText 绘制文字

drawText

类型: MethodDeclaration

所属类: Printer

定义位置: printer.ts

描述

绘制文字

参数 context: 2D上下文

参数 command: 打印机指令

参数 text: 文本内容

参数

参数名类型描述默认值
contextPrinterRenderingContext--
commandPrinterCommand--
textstring--

返回值

类型: void

源代码

位置: 第 1303 行

private static drawText(context: PrinterRenderingContext, command: PrinterCommand, text: string): void {
const x = command.x
const y = command.y + command.size * 0.85
context.font = command.font
context.fillStyle = command.color
context.globalCompositeOperation = 'source-over'
context.fillText(text, x, y)
}

文档生成时间:2025/7/7 12:07:06