Possibility to have a constant width for numbers
This commit is contained in:
+5
-2
@@ -557,7 +557,7 @@ coord_t BitmapBuffer::drawSizedText(coord_t x, coord_t y, const char * s, uint8_
|
||||
else if (c >= 0xFE) {
|
||||
// CJK char
|
||||
s++;
|
||||
c = uint8_t(*s) + ((c & 0x01) << 8) - 1;
|
||||
c = uint8_t(*s) + ((c & 0x01u) << 8u) - 1;
|
||||
if (c >= 0x101)
|
||||
c -= 1;
|
||||
c += CJK_FIRST_LETTER_INDEX;
|
||||
@@ -566,7 +566,10 @@ coord_t BitmapBuffer::drawSizedText(coord_t x, coord_t y, const char * s, uint8_
|
||||
}
|
||||
else if (c >= 0x20) {
|
||||
uint8_t width = drawChar(x, y, font, fontspecs, getMappedChar(c), flags);
|
||||
INCREMENT_POS(width + CHAR_SPACING);
|
||||
if ((flags & SPACING_NUMBERS_CONST) && c >= '0' && c <= '9')
|
||||
INCREMENT_POS(getCharWidth('9', fontspecs) + CHAR_SPACING);
|
||||
else
|
||||
INCREMENT_POS(width + CHAR_SPACING);
|
||||
}
|
||||
else if (c == '\n') {
|
||||
pos = orig_pos;
|
||||
|
||||
+11
-9
@@ -22,8 +22,10 @@
|
||||
|
||||
#include "libopenui_types.h"
|
||||
|
||||
/* lcd common flags */
|
||||
#define BLINK 0x01u
|
||||
/* obsolete flags */
|
||||
#define BLINK 0
|
||||
#define EXPANDED 0
|
||||
#define TIMEHOUR 0
|
||||
|
||||
/* drawText flags */
|
||||
#define LEFT 0x00u /* align left */
|
||||
@@ -31,6 +33,10 @@
|
||||
#define CENTERED 0x04u /* align center */
|
||||
#define RIGHT 0x08u /* align right */
|
||||
#define SHADOWED 0x80u /* black copy at +1 +1 */
|
||||
// unused 0x1000u
|
||||
#define SPACING_NUMBERS_CONST 0x2000u
|
||||
#define VERTICAL 0x4000u
|
||||
// unused 0x8000u
|
||||
|
||||
/* drawNumber flags */
|
||||
#define LEADING0 0x10u
|
||||
@@ -41,13 +47,9 @@
|
||||
/* telemetry flags */
|
||||
#define NO_UNIT 0x40u
|
||||
|
||||
#define FONT_MASK 0x0F00u
|
||||
#define FONT_INDEX(flags) (((flags) & FONT_MASK) >> 8u)
|
||||
#define FONT(xx) (unsigned(FONT_ ## xx ## _INDEX) << 8u)
|
||||
|
||||
#define TIMEHOUR 0x2000u
|
||||
#define EXPANDED 0x2000u
|
||||
#define VERTICAL 0x4000u
|
||||
#define FONT_MASK 0x0F00u
|
||||
#define FONT_INDEX(flags) (((flags) & FONT_MASK) >> 8u)
|
||||
#define FONT(xx) (unsigned(FONT_ ## xx ## _INDEX) << 8u)
|
||||
|
||||
#define ARGB_SPLIT(color, a, r, g, b) \
|
||||
uint16_t a = ((color) & 0xF000) >> 12; \
|
||||
|
||||
Reference in New Issue
Block a user