Fonts refactoring (no more font list in libopenui)
This commit is contained in:
+1
-1
@@ -413,7 +413,7 @@ coord_t BitmapBuffer::drawSizedText(coord_t x, coord_t y, const char * s, uint8_
|
|||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t fontindex = FONTINDEX(flags);
|
uint32_t fontindex = FONT_INDEX(flags);
|
||||||
const unsigned char * font = fontsTable[fontindex];
|
const unsigned char * font = fontsTable[fontindex];
|
||||||
const uint16_t * fontspecs = fontspecsTable[fontindex];
|
const uint16_t * fontspecs = fontspecsTable[fontindex];
|
||||||
|
|
||||||
|
|||||||
+2
-36
@@ -44,42 +44,8 @@
|
|||||||
/* telemetry flags */
|
/* telemetry flags */
|
||||||
#define NO_UNIT 0x40
|
#define NO_UNIT 0x40
|
||||||
|
|
||||||
enum FontSizeIndex
|
#define FONT_MASK 0x0F00
|
||||||
{
|
#define FONT_INDEX(flags) (((flags) & FONT_MASK) >> 8)
|
||||||
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 TIMEBLINK 0x1000
|
#define TIMEBLINK 0x1000
|
||||||
#define TIMEHOUR 0x2000
|
#define TIMEHOUR 0x2000
|
||||||
|
|||||||
+2
-2
@@ -24,8 +24,8 @@
|
|||||||
#include "libopenui_config.h"
|
#include "libopenui_config.h"
|
||||||
|
|
||||||
extern uint16_t lcdColorTable[LCD_COLOR_COUNT];
|
extern uint16_t lcdColorTable[LCD_COLOR_COUNT];
|
||||||
extern const uint16_t * const fontspecsTable[FONT_TABLE_SIZE];
|
extern const uint16_t * const fontspecsTable[FONTS_COUNT];
|
||||||
extern const uint8_t * fontsTable[FONT_TABLE_SIZE];
|
extern const uint8_t * fontsTable[FONTS_COUNT];
|
||||||
|
|
||||||
inline void lcdSetColor(uint16_t color)
|
inline void lcdSetColor(uint16_t color)
|
||||||
{
|
{
|
||||||
|
|||||||
+2
-2
@@ -24,9 +24,9 @@ void MenuToolbarButton::paint(BitmapBuffer * dc)
|
|||||||
{
|
{
|
||||||
if (checked()) {
|
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->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 {
|
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
@@ -53,7 +53,7 @@ class StaticText : public Window {
|
|||||||
class Subtitle: public StaticText {
|
class Subtitle: public StaticText {
|
||||||
public:
|
public:
|
||||||
Subtitle(Window * parent, const rect_t & rect, const char * text):
|
Subtitle(Window * parent, const rect_t & rect, const char * text):
|
||||||
StaticText(parent, rect, text, 0, BOLD)
|
StaticText(parent, rect, text, 0, FONT(BOLD))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user