From 5abb5fa5510d32131218a27895d1501def0691fd Mon Sep 17 00:00:00 2001 From: Simone Margaritelli <evilsocket@gmail.com> Date: Sat, 28 Sep 2019 19:52:32 +0200 Subject: [PATCH] fixed fonts --- .../rootfs/root/pwnagotchi/scripts/pwnagotchi/ui/fonts.py | 8 ++++++++ .../rootfs/root/pwnagotchi/scripts/pwnagotchi/ui/view.py | 6 ++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/sdcard/rootfs/root/pwnagotchi/scripts/pwnagotchi/ui/fonts.py b/sdcard/rootfs/root/pwnagotchi/scripts/pwnagotchi/ui/fonts.py index e8a4107..0f8ae5b 100644 --- a/sdcard/rootfs/root/pwnagotchi/scripts/pwnagotchi/ui/fonts.py +++ b/sdcard/rootfs/root/pwnagotchi/scripts/pwnagotchi/ui/fonts.py @@ -6,3 +6,11 @@ Bold = ImageFont.truetype("%s-Bold.ttf" % PATH, 10) BoldSmall = ImageFont.truetype("%s-Bold.ttf" % PATH, 8) Medium = ImageFont.truetype("%s.ttf" % PATH, 10) Huge = ImageFont.truetype("%s-Bold.ttf" % PATH, 25) + + +def setup(bold, bold_small, medium, huge): + global PATH, Bold, BoldSmall, Medium, Huge + Bold = ImageFont.truetype("%s-Bold.ttf" % PATH, bold) + BoldSmall = ImageFont.truetype("%s-Bold.ttf" % PATH, bold_small) + Medium = ImageFont.truetype("%s.ttf" % PATH, medium) + Huge = ImageFont.truetype("%s-Bold.ttf" % PATH, huge) diff --git a/sdcard/rootfs/root/pwnagotchi/scripts/pwnagotchi/ui/view.py b/sdcard/rootfs/root/pwnagotchi/scripts/pwnagotchi/ui/view.py index 9550f90..ee04ac5 100644 --- a/sdcard/rootfs/root/pwnagotchi/scripts/pwnagotchi/ui/view.py +++ b/sdcard/rootfs/root/pwnagotchi/scripts/pwnagotchi/ui/view.py @@ -22,12 +22,14 @@ class View(object): self._canvas = None self._lock = Lock() - if config['ui']['display']['type'] == 'inkyphat': + if config['ui']['display']['type'] in ('inky', 'inkyphat'): self._width = 212 self._height = 104 - else: + fonts.setup(10, 9, 10, 35) + elif config['ui']['display']['type'] in ('ws', 'waveshare'): self._width = 250 self._height = 122 + fonts.setup(10, 8, 10, 25) self._state = State(state={ 'channel': LabeledValue(color=BLACK, label='CH', value='00', position=(0, 0), label_font=fonts.Bold,