Printer
new Printer(texture)
- Source:
Parameters:
| Name |
Type |
Description |
texture |
Texture
|
打印机纹理
|
Members
alignmentFactorX :number
- Source:
Type:
alignmentFactorY :number
- Source:
Type:
breakable :boolean
- Source:
Type:
buffer :string
- Source:
Type:
canvas :HTMLCanvasElement
- Source:
Type:
colors :Array.<number>
- Source:
Type:
content :string
- Source:
Type:
context :CanvasRenderingContext2D
- Source:
Type:
direction :string
- Source:
Type:
fonts :Array.<string>
- Source:
Type:
height :number
- Source:
Type:
horizontal :boolean
- Source:
Type:
horizontalAlign :string
- Source:
Type:
index :number
- Source:
Type:
letterSpacing :number
- Source:
Type:
lineHeight :number
- Source:
Type:
lineSpacing :number
- Source:
Type:
paddingBottom :number
- Source:
Type:
paddingLeft :number
- Source:
Type:
paddingRight :number
- Source:
Type:
paddingTop :number
- Source:
Type:
printHeight :number
- Source:
Type:
printWidth :number
- Source:
Type:
sizes :Array.<number>
- Source:
Type:
styles :Array.<string>
- Source:
Type:
truncate :boolean
- Source:
Type:
verticalAlign :string
- Source:
Type:
weights :Array.<string>
- Source:
Type:
width :number
- Source:
Type:
wordWrap :boolean
- Source:
Type:
wrapEnd :number
- Source:
Type:
Methods
calculatePadding()
- Source:
calculateTextPosition()
- Source:
draw(content)
- Source:
Parameters:
| Name |
Type |
Description |
content |
string
|
文本内容
|
executeCommands()
- Source:
getScaledLetterSpacing()
- Source:
getScaledLineSpacing()
- Source:
getScaledPrintHeight()
- Source:
getScaledPrintWidth()
- Source:
matchTag() → {boolean}
- Source:
measureHeight(string) → {number}
- Source:
Parameters:
| Name |
Type |
Description |
string |
string
|
目标字符串
|
measureWidth(string) → {number}
- Source:
Parameters:
| Name |
Type |
Description |
string |
string
|
目标字符串
|
(static) drawText(2D上下文, command, text)
- Source:
Parameters:
| Name |
Type |
Description |
2D上下文 |
CanvasRenderingContext2D
|
|
command |
Object
|
打印机指令
|
text |
string
|
文本内容
|
(static) drawTextWithOutline(2D上下文, command, text)
- Source:
Parameters:
| Name |
Type |
Description |
2D上下文 |
CanvasRenderingContext2D
|
|
command |
Object
|
打印机指令
|
text |
string
|
文本内容
|
(static) drawTextWithShadow(2D上下文, command, text)
- Source:
Parameters:
| Name |
Type |
Description |
2D上下文 |
CanvasRenderingContext2D
|
|
command |
Object
|
打印机指令
|
text |
string
|
文本内容
|
(static) drawTextWithStroke(2D上下文, command, text)
- Source:
Parameters:
| Name |
Type |
Description |
2D上下文 |
CanvasRenderingContext2D
|
|
command |
Object
|
打印机指令
|
text |
string
|
文本内容
|
(static) fetchCommand() → {Object}
- Source:
(static) importFonts(imports) → {Promise}
- Source:
Parameters:
| Name |
Type |
Description |
imports |
Array.<string>
|
导入字体文件ID列表
|
(static) initialize() → {Promise}
- Source:
(static) loadDefault() → {Promise}
- Source:
(static) parseEffect(effect) → {Object}
- Source:
Parameters:
| Name |
Type |
Description |
effect |
Object
|
文字效果数据对象
|
(static) resetCommands()
- Source:
(static) restoreTexture()
- Source: