Fonts refactoring (no more font list in libopenui)

This commit is contained in:
Bertrand Songis
2019-10-22 10:25:18 +02:00
parent 847e1d9ddf
commit 1c99e1a67f
5 changed files with 8 additions and 42 deletions
+1 -1
View File
@@ -413,7 +413,7 @@ coord_t BitmapBuffer::drawSizedText(coord_t x, coord_t y, const char * s, uint8_
return x;
}
uint32_t fontindex = FONTINDEX(flags);
uint32_t fontindex = FONT_INDEX(flags);
const unsigned char * font = fontsTable[fontindex];
const uint16_t * fontspecs = fontspecsTable[fontindex];
+2 -36
View File
@@ -44,42 +44,8 @@
/* telemetry flags */
#define NO_UNIT 0x40
enum FontSizeIndex
{
STDSIZE_INDEX,
TINSIZE_INDEX,
SMLSIZE_INDEX,
MIDSIZE_INDEX,
DBLSIZE_INDEX,
XXLSIZE_INDEX,
SPARE6_INDEX,
SPARE7_INDEX,
STDSIZE_BOLD_INDEX,
SPARE9_INDEX,
SPAREa_INDEX,
SPAREb_INDEX,
SPAREc_INDEX,
SPAREd_INDEX,
SPAREe_INDEX,
SPAREf_INDEX,
};
#define STDSIZE (STDSIZE_INDEX << 8)
#define TINSIZE (TINSIZE_INDEX << 8)
#define SMLSIZE (SMLSIZE_INDEX << 8)
#define MIDSIZE (MIDSIZE_INDEX << 8)
#define DBLSIZE (DBLSIZE_INDEX << 8)
#define XXLSIZE (XXLSIZE_INDEX << 8)
#define BOLD (STDSIZE_BOLD_INDEX << 8)
#define FONTSIZE_MASK 0x0f00
#if !defined(BOOT)
#define FONTSIZE(flags) ((flags) & FONTSIZE_MASK)
#define FONTINDEX(flags) (FONTSIZE(flags) >> 8)
#else
#define FONTSIZE(flags) STDSIZE
#define FONTINDEX(flags) STDSIZE_INDEX
#endif
#define FONT_MASK 0x0F00
#define FONT_INDEX(flags) (((flags) & FONT_MASK) >> 8)
#define TIMEBLINK 0x1000
#define TIMEHOUR 0x2000
+2 -2
View File
@@ -24,8 +24,8 @@
#include "libopenui_config.h"
extern uint16_t lcdColorTable[LCD_COLOR_COUNT];
extern const uint16_t * const fontspecsTable[FONT_TABLE_SIZE];
extern const uint8_t * fontsTable[FONT_TABLE_SIZE];
extern const uint16_t * const fontspecsTable[FONTS_COUNT];
extern const uint8_t * fontsTable[FONTS_COUNT];
inline void lcdSetColor(uint16_t color)
{
+2 -2
View File
@@ -24,9 +24,9 @@ void MenuToolbarButton::paint(BitmapBuffer * dc)
{
if (checked()) {
dc->drawSolidFilledRect(MENUS_TOOLBAR_BUTTON_PADDING, MENUS_TOOLBAR_BUTTON_PADDING, MENUS_TOOLBAR_BUTTON_WIDTH - 2 * MENUS_TOOLBAR_BUTTON_PADDING, MENUS_TOOLBAR_BUTTON_WIDTH - 2 * MENUS_TOOLBAR_BUTTON_PADDING, FOCUS_BGCOLOR);
dc->drawSizedText(rect.w / 2, (rect.h - getFontHeight(STDSIZE)) / 2 + 1, &picto, 1, CENTERED | FOCUS_COLOR);
dc->drawSizedText(rect.w / 2, (rect.h - getFontHeight(FONT(STD))) / 2 + 1, &picto, 1, CENTERED | FOCUS_COLOR);
}
else {
dc->drawSizedText(rect.w / 2, (rect.h - getFontHeight(STDSIZE)) / 2 + 1, &picto, 1, CENTERED | DEFAULT_COLOR);
dc->drawSizedText(rect.w / 2, (rect.h - getFontHeight(FONT(STD))) / 2 + 1, &picto, 1, CENTERED | DEFAULT_COLOR);
}
}
+1 -1
View File
@@ -53,7 +53,7 @@ class StaticText : public Window {
class Subtitle: public StaticText {
public:
Subtitle(Window * parent, const rect_t & rect, const char * text):
StaticText(parent, rect, text, 0, BOLD)
StaticText(parent, rect, text, 0, FONT(BOLD))
{
}