This commit is contained in:
陶林 2024-03-11 16:41:02 +08:00
parent 65613ce895
commit 8be3b1afcb
3 changed files with 23 additions and 2 deletions

View File

@ -1,3 +1,18 @@
https://www.npmjs.com/package/@taoya7/print-help https://www.npmjs.com/package/@taoya7/print-help
示例
```javascript
import { FONTMUL, FONTTYPE, LabelCommand, ROTATION } from '@/command/Label'
function main() {
let label = new LabelCommand(50, 30, 0);
label.addText(0, 0, FONTTYPE.FONT_1, ROTATION.ROTATION_0, FONTMUL.MUL_1, FONTMUL.MUL_1, 'Hello World');
var command = label.getCommand();
console.log(command);// 获取字节码
console.log(label.getCommandStr(command));
}
main();
```

View File

@ -1,6 +1,6 @@
{ {
"name": "@taoya7/print-help", "name": "@taoya7/print-help",
"version": "1.0.0", "version": "1.0.1",
"license": "MIT", "license": "MIT",
"type": "module", "type": "module",
"keywords": [ "keywords": [

View File

@ -367,9 +367,15 @@ export class LabelCommand {
let str: string = `SET CUTTER ${enable}\r\n`; let str: string = `SET CUTTER ${enable}\r\n`;
this.addStrToCommand(str); this.addStrToCommand(str);
} }
/**
*
*/
getCommand() { getCommand() {
return this.command; return this.command;
} }
/**
*
*/
getCommandStr(command: number[]) { getCommandStr(command: number[]) {
let str = ""; let str = "";
for (let i = 0; i < command.length; i++) { for (let i = 0; i < command.length; i++) {