mirror of
https://github.com/NaitLee/Cat-Printer.git
synced 2025-05-19 00:30:17 -07:00
Merge pull request #50 from sync1211/main
Replaced hardcoded paper width with model specific width
This commit is contained in:
commit
105427bf58
35
printer.py
35
printer.py
@ -690,23 +690,7 @@ def _main():
|
|||||||
|
|
||||||
mode = 'pbm'
|
mode = 'pbm'
|
||||||
|
|
||||||
if args.text:
|
# Connect to printer
|
||||||
info(i18n('text-printing-mode'))
|
|
||||||
printer.font_family = font_family or 'font'
|
|
||||||
if 'pf2' not in text_param:
|
|
||||||
# TODO: remove hardcoded width
|
|
||||||
file = magick_text(file, 384,
|
|
||||||
font_size, font_family)
|
|
||||||
else:
|
|
||||||
printer.font_scale = font_size
|
|
||||||
mode = 'text'
|
|
||||||
elif args.convert:
|
|
||||||
file = magick_image(file, 384, (
|
|
||||||
'None'
|
|
||||||
if args.convert == 'text'
|
|
||||||
else 'FloydSteinberg')
|
|
||||||
)
|
|
||||||
|
|
||||||
if args.dry:
|
if args.dry:
|
||||||
info(i18n('dry-run-test-print-process-only'))
|
info(i18n('dry-run-test-print-process-only'))
|
||||||
printer.dry_run = True
|
printer.dry_run = True
|
||||||
@ -718,6 +702,23 @@ def _main():
|
|||||||
printer.scan(identifier, use_result=True)
|
printer.scan(identifier, use_result=True)
|
||||||
printer.dump = args.dump
|
printer.dump = args.dump
|
||||||
|
|
||||||
|
# Prepare image / text
|
||||||
|
if args.text:
|
||||||
|
info(i18n('text-printing-mode'))
|
||||||
|
printer.font_family = font_family or 'font'
|
||||||
|
if 'pf2' not in text_param:
|
||||||
|
file = magick_text(file, printer.model.paper_width,
|
||||||
|
font_size, font_family)
|
||||||
|
else:
|
||||||
|
printer.font_scale = font_size
|
||||||
|
mode = 'text'
|
||||||
|
elif args.convert:
|
||||||
|
file = magick_image(file, printer.model.paper_width, (
|
||||||
|
'None'
|
||||||
|
if args.convert == 'text'
|
||||||
|
else 'FloydSteinberg')
|
||||||
|
)
|
||||||
|
|
||||||
if args.nothing:
|
if args.nothing:
|
||||||
global Printer
|
global Printer
|
||||||
Printer = printer
|
Printer = printer
|
||||||
|
Loading…
x
Reference in New Issue
Block a user