Skip to content

Commit

Permalink
Merge pull request #50 from sync1211/main
Browse files Browse the repository at this point in the history
Replaced hardcoded paper width with model specific width
  • Loading branch information
NaitLee authored Feb 7, 2023
2 parents 27eb88e + 3074076 commit 105427b
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions printer.py
Original file line number Diff line number Diff line change
Expand Up @@ -690,34 +690,35 @@ def _main():

mode = 'pbm'

# Connect to printer
if args.dry:
info(i18n('dry-run-test-print-process-only'))
printer.dry_run = True
if args.fake:
printer.fake = True
printer.model = Models[args.fake]
else:
info(i18n('connecting'))
printer.scan(identifier, use_result=True)
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:
# TODO: remove hardcoded width
file = magick_text(file, 384,
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, 384, (
file = magick_image(file, printer.model.paper_width, (
'None'
if args.convert == 'text'
else 'FloydSteinberg')
)

if args.dry:
info(i18n('dry-run-test-print-process-only'))
printer.dry_run = True
if args.fake:
printer.fake = True
printer.model = Models[args.fake]
else:
info(i18n('connecting'))
printer.scan(identifier, use_result=True)
printer.dump = args.dump

if args.nothing:
global Printer
Printer = printer
Expand Down

0 comments on commit 105427b

Please sign in to comment.