1
0
mirror of https://github.com/jtgans/g13gui.git synced 2025-07-09 09:27:25 -04:00

g13gui: Fix the display height

Apparently I misunderstood the source of pbm2lpbm. There is no padding, despite
the count of rows being off in the source.
This commit is contained in:
June Tate-Gans 2021-04-29 20:29:42 -05:00
parent aeced13908
commit cc7232e580
2 changed files with 3 additions and 5 deletions
g13gui/g13gui/bitwidgets

View File

@ -10,7 +10,7 @@ from g13gui.observer import ChangeType
class DisplayMetrics(object):
WIDTH_PIXELS = 160
HEIGHT_PIXELS = 43
HEIGHT_PIXELS = 48
LPBM_LENGTH = 960
@ -42,9 +42,6 @@ def ImageToLPBM(image):
col = 0
row += 8
# padding? lpbm files are always 960 bytes, the last bytes are filled with garbage.
bio.write(bytes(LPBM_LENGTH - maxBytes))
return bio.getvalue()

View File

@ -16,8 +16,9 @@ class DisplayTests(unittest.TestCase):
def testConversion(self):
ctx = self.d.getContext()
ctx.rectangle((0, 0, 160, 43), fill=1)
ctx.text((0, 0), "Hello world!",
font=FontManager.getFont(Fonts.HUGE), fill=1)
font=FontManager.getFont(Fonts.HUGE), fill=0)
result = ImageToLPBM(self.d._bitmap)
self.assertEqual(len(result), LPBM_LENGTH)