Compare commits

..

No commits in common. "paul/tweaks" and "main" have entirely different histories.

View File

@ -11,14 +11,14 @@ import PIL.ImageFont
import qrcode import qrcode
HERE = os.path.dirname(__file__) HERE = os.path.dirname(__file__)
font = PIL.ImageFont.truetype(os.path.join(HERE, 'inconsolata.ttf'), 25) font = PIL.ImageFont.truetype(os.path.join(HERE, 'inconsolata.ttf'), 20)
DEFAULT_SOCKET = '/tmp/catprint.s' DEFAULT_SOCKET = '/tmp/catprint.s'
def text2img(text): def text2img(text):
maxwidth=384 maxwidth=384
height=26 height=21
img = PIL.Image.new('1', (maxwidth, height)) img = PIL.Image.new('1', (maxwidth, height))
d = PIL.ImageDraw.Draw(img) d = PIL.ImageDraw.Draw(img)
tw, th = d.textsize(text, font=font) tw, th = d.textsize(text, font=font)
@ -47,7 +47,7 @@ def get_template0(qr_payload, line0, line1, line2=''):
height = qrh height = qrh
textheight = 21 textheight = 21
texttop = (height - 3 * textheight) / 3 texttop = (height - 3 * textheight) / 3
textleft = qrw + 10 textleft = qrw + 20
img = PIL.Image.new('1', (width, height)) img = PIL.Image.new('1', (width, height))
img.paste(qr) img.paste(qr)
d = PIL.ImageDraw.Draw(img) d = PIL.ImageDraw.Draw(img)