Merge pull request #50 from sync1211/main

Replaced hardcoded paper width with model specific width
This commit is contained in:
NaitLee 2023-02-07 22:42:11 +08:00 committed by GitHub
commit 105427bf58
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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