diff --git a/inkyshot/update-display.py b/inkyshot/update-display.py index 73d0f2c..22fa537 100644 --- a/inkyshot/update-display.py +++ b/inkyshot/update-display.py @@ -362,10 +362,10 @@ def temp_to_str(temp, scale): while message_does_not_fit == True: test_message = "" message_width = 0 - FONT_SIZE -= 1 + FONT = ImageFont.truetype(FONT_SELECTED, FONT_SIZE) - if FONT_SIZE <= 17: - FONT_SIZE = 8 + if FONT_SIZE <= 12: + FONT_SIZE = 10 FONT = ImageFont.truetype("/usr/app/fonts/Grand9KPixel.ttf", FONT_SIZE) # We're using the test character here to work out how many characters @@ -384,9 +384,12 @@ def temp_to_str(temp, scale): if len(word_list) <= max_lines: message_does_not_fit = False - if FONT_SIZE < 9: + if FONT_SIZE <= 10: message_does_not_fit = False + if message_does_not_fit: + FONT_SIZE -= 1 + logging.info("Font size: %s", FONT_SIZE) offset_x, offset_y = FONT.getoffset(message) @@ -417,4 +420,4 @@ def temp_to_str(temp, scale): if MODE == 'alternate': set_current_display(target_display) -sys.exit(0) +sys.exit(0) \ No newline at end of file