thermal_printer README.md

This commit is contained in:
cuu 2022-03-17 06:14:14 -05:00
parent 8339687f04
commit 9480125c5b

View File

@ -16,11 +16,28 @@
#### ESC ! n #### ESC ! n
set printer font index,n:0-4 set printer font index,n:0-4
`echo -en "\x1b\x21\x0" > /tmp/DEVTERM_PRINTER_IN` `echo -en "\x1d\x21\x0" > /tmp/DEVTERM_PRINTER_IN`
`echo -en "\x1b\x21\x1" > /tmp/DEVTERM_PRINTER_IN` `echo -en "\x1d\x21\x1" > /tmp/DEVTERM_PRINTER_IN`
`echo -en "\x1b\x21\x2" > /tmp/DEVTERM_PRINTER_IN` `echo -en "\x1d\x21\x2" > /tmp/DEVTERM_PRINTER_IN`
`echo -en "\x1b\x21\x3" > /tmp/DEVTERM_PRINTER_IN` `echo -en "\x1d\x21\x3" > /tmp/DEVTERM_PRINTER_IN`
`echo -en "\x1b\x21\x4" > /tmp/DEVTERM_PRINTER_IN` `echo -en "\x1d\x21\x4" > /tmp/DEVTERM_PRINTER_IN`
##### ascii font size
1. 0 = 8x16
1. 1 = 5x7
1. 2 = 6x12
1. 3 = 7x14
1. 4 = 8x16
##### unicode font size
1. 0 = 12x12
1. 1 = 14x14
1. 2 = 16x16
1. 3 = 18x18
1. 4 = 20x20
https://github.com/clockworkpi/DevTerm/blob/81addc7f4ba1eb4acb2f59fb1fef70386dbe1f0d/Code/thermal_printer/devterm_thermal_printer.c#L381 https://github.com/clockworkpi/DevTerm/blob/81addc7f4ba1eb4acb2f59fb1fef70386dbe1f0d/Code/thermal_printer/devterm_thermal_printer.c#L381
@ -42,15 +59,16 @@ then restart devterm-printer.service with
``` ```
sudo systemctl restart devterm-printer sudo systemctl restart devterm-printer
``` ```
devterm-printer daemon will auto detect if the ttf file existed,if exists, devterm-printer will use the ttf as default font devterm-printer daemon will auto detect the ttf font file
if ttf file not existed, devterm-printer will fallback to ascii mode
#### switch to UNICODE MODE
use above set printer font index,n:0-4 command to set font size, ```
1. 0 = 12x12 echo -en "\x1b\x21\x1" > /tmp/DEVTERM_PRINTER_IN
1. 1 = 14x14 ```
1. 2 = 16x16 #### switch back to default ASCII mode
1. 3 = 18x18 ```
1. 4 = 20x20 echo -en "\x1b\x21\x0" > /tmp/DEVTERM_PRINTER_IN
```
then then