add invertln and title helpers

This commit is contained in:
Infinidoge 2025-01-14 00:52:00 -05:00
parent 439143a474
commit 77c8dd7fe6
Signed by: Infinidoge
SSH key fingerprint: SHA256:GT2StvPQMMfFHyiiFJymQxfTG/z6EWLJ6NWItf5K5sA

View file

@ -81,6 +81,10 @@ class ReceiptPrinter(CupsPrinter):
with self.set(invert=True):
self.text(text)
def invertln(self, text):
self.invert(text)
self.ln()
def bold(self, text):
with self.set(bold=True):
self.text(text)
@ -89,4 +93,15 @@ class ReceiptPrinter(CupsPrinter):
self.bold(text)
self.ln()
def title(self, text, size=6, width=None, height=None):
width = width or size
height = height or size
with self.set(align="center", bold=True, invert=True, smooth=True, custom_size=True, width=width, height=height):
self.textln(text)
self.ln()
def subtitle(self, text):
with self.set(align="center", double_height=True, double_width=True):
p.textln(text)
p = ReceiptPrinter("EPSON-TM-m30", profile="default")