From 2f6cad2fc2508d8988d5ce30ff06d94e7cafe220 Mon Sep 17 00:00:00 2001 From: Nicolas Schodet Date: Tue, 22 Jun 2021 18:23:19 +0200 Subject: [PATCH] Use smaller font when temperature does not fit, closes #52 This is the case for negative temperatures (-10 for example). --- examples/WatchFaces/7_SEG/Watchy_7_SEG.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/examples/WatchFaces/7_SEG/Watchy_7_SEG.cpp b/examples/WatchFaces/7_SEG/Watchy_7_SEG.cpp index 8bbf362..ba1da15 100644 --- a/examples/WatchFaces/7_SEG/Watchy_7_SEG.cpp +++ b/examples/WatchFaces/7_SEG/Watchy_7_SEG.cpp @@ -103,7 +103,13 @@ void Watchy7SEG::drawWeather(){ int16_t x1, y1; uint16_t w, h; display.getTextBounds(String(temperature), 0, 0, &x1, &y1, &w, &h); - display.setCursor(159 - w - x1, 150); + if(159 - w - x1 > 87){ + display.setCursor(159 - w - x1, 150); + }else{ + display.setFont(&DSEG7_Classic_Bold_25); + display.getTextBounds(String(temperature), 0, 0, &x1, &y1, &w, &h); + display.setCursor(159 - w - x1, 136); + } display.println(temperature); display.drawBitmap(165, 110, strcmp(TEMP_UNIT, "metric") == 0 ? celsius : fahrenheit, 26, 20, DARKMODE ? GxEPD_WHITE : GxEPD_BLACK); const unsigned char* weatherIcon;