Closed Ian9231 closed 3 years ago
That is an extreme case. Maybe the constructor should throw an exception: such a Writer really isn't much practical use.
True, an exception would be better, as it was not initialy apparent to me that the freesans10.py font was 17 height. And my work around results in no text being displayed.
Update which throws a ValueError now pushed.
I had modified the SSD1306 driver to have two frame buffers (display is 128 x 64 with the top 16 row yellow and remainder blue). the upper buffer is 128 x 16 and the lower 128 x 48. Writer works fine on the lower buffer and can be instantiated on the upper using the freesans10.py font. Writer then hangs when printstring is called. If row clipping is set True the printstring returns but no text is displayed.
Note freesans10.py is 17 pixels high.
My work around in _init is self.row_clip = (self.font.height() > self.screenheight) to prevent hanging.