diff --git a/radio/src/gui/horus/bitmapbuffer.cpp b/radio/src/gui/horus/bitmapbuffer.cpp index 56eb5ba74..85bd749ff 100644 --- a/radio/src/gui/horus/bitmapbuffer.cpp +++ b/radio/src/gui/horus/bitmapbuffer.cpp @@ -311,11 +311,9 @@ void BitmapBuffer::drawSizedText(coord_t x, coord_t y, const char * s, uint8_t l #define INCREMENT_POS(delta) \ do { if (flags & VERTICAL) y -= delta; else x += delta; } while(0) - if ((flags & TINSIZE) && (flags & BOLD)) flags &= ~(BOLD); //TINSIZE | BOLD segfault, so preventing it - int width = getTextWidth(s, len, flags); int height = getFontHeight(flags); - int fontindex = FONTSIZE(flags) >> 8; + uint32_t fontindex = FONTINDEX(flags); const pm_uchar * font = fontsTable[fontindex]; const uint16_t * fontspecs = fontspecsTable[fontindex]; BitmapBuffer * fontcache = NULL; @@ -327,7 +325,7 @@ void BitmapBuffer::drawSizedText(coord_t x, coord_t y, const char * s, uint8_t l coord_t & pos = (flags & VERTICAL) ? y : x; - if ((flags&INVERS) && ((~flags & BLINK) || BLINK_ON_PHASE)) { + if ((flags & INVERS) && ((~flags & BLINK) || BLINK_ON_PHASE)) { uint16_t fgColor = lcdColorTable[COLOR_IDX(flags)]; if (fgColor == lcdColorTable[TEXT_COLOR_INDEX]) { flags = TEXT_INVERTED_COLOR | (flags & 0x0ffff); diff --git a/radio/src/gui/horus/fonts.cpp b/radio/src/gui/horus/fonts.cpp index 8bb09b972..d00a8445e 100644 --- a/radio/src/gui/horus/fonts.cpp +++ b/radio/src/gui/horus/fonts.cpp @@ -76,8 +76,15 @@ pm_uchar font_stdsizebold[] = { #include "font_stdsizebold.lbm" }; -const uint16_t * const fontspecsTable[16] = { font_stdsize_specs, font_tinsize_specs, font_smlsize_specs, font_midsize_specs, font_dblsize_specs, font_xxlsize_specs, font_stdsizebold_specs }; -const uint8_t * const fontsTable[16] = { font_stdsize, font_tinsize, font_smlsize, font_midsize, font_dblsize, font_xxlsize, font_stdsizebold }; +const uint16_t * const fontspecsTable[16] = { + font_stdsize_specs, font_tinsize_specs, font_smlsize_specs, font_midsize_specs, font_dblsize_specs, font_xxlsize_specs, font_stdsize_specs, font_stdsize_specs, + font_stdsizebold_specs, font_tinsize_specs, font_smlsize_specs, font_midsize_specs, font_dblsize_specs, font_xxlsize_specs, font_stdsize_specs, font_stdsize_specs +}; + +const uint8_t * const fontsTable[16] = { + font_stdsize, font_tinsize, font_smlsize, font_midsize, font_dblsize, font_xxlsize, font_stdsize, font_stdsize, + font_stdsizebold, font_tinsize, font_smlsize, font_midsize, font_dblsize, font_xxlsize, font_stdsize, font_stdsize +}; BitmapBuffer * fontCache[2] = { NULL, NULL }; diff --git a/radio/src/gui/horus/lcd.cpp b/radio/src/gui/horus/lcd.cpp index 2564d53aa..3c82ace8f 100644 --- a/radio/src/gui/horus/lcd.cpp +++ b/radio/src/gui/horus/lcd.cpp @@ -66,7 +66,7 @@ void lcdPutFontPattern(coord_t x, coord_t y, const uint8_t * font, const uint16_ void lcdDrawChar(coord_t x, coord_t y, const unsigned char c, LcdFlags flags) { - int fontindex = FONTSIZE(flags) >> 8; + uint32_t fontindex = FONTINDEX(flags); const pm_uchar * font = fontsTable[fontindex]; const uint16_t * fontspecs = fontspecsTable[fontindex]; lcdPutFontPattern(x, y, font, fontspecs, getMappedChar(c), flags); @@ -81,15 +81,15 @@ uint8_t getStringInfo(const char *s) return result; } -int getFontHeight(LcdFlags flags) +uint8_t getFontHeight(LcdFlags flags) { - static const int heightTable[16] = { 12, 10, 11, 14, 32, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12 }; - return heightTable[FONTSIZE(flags) >> 8]; + static const uint8_t heightTable[16] = { 12, 10, 11, 14, 32, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12 }; + return heightTable[FONTINDEX(flags)]; } int getTextWidth(const char * s, int len, LcdFlags flags) { - const uint16_t * specs = fontspecsTable[FONTSIZE(flags) >> 8]; + const uint16_t * specs = fontspecsTable[FONTINDEX(flags)]; int result = 0; for (int i=0; len==0 || i> 8) -#define VERTICAL 0x0800 #define TIMEBLINK 0x1000 #define TIMEHOUR 0x2000 +#define VERTICAL 0x4000 #define NO_FONTCACHE 0x8000 #include "colors.h" @@ -241,7 +251,7 @@ inline int getBitmapHeight(const uint8_t * bmp) } char getMappedChar(unsigned char c); -int getFontHeight(LcdFlags flags); +uint8_t getFontHeight(LcdFlags flags); int getTextWidth(const pm_char *s, int len=0, LcdFlags flags=0); inline void lcdDrawBitmapPattern(coord_t x, coord_t y, const uint8_t * img, LcdFlags flags=0, coord_t offset=0, coord_t width=0)