Select used fonts via user_config_override

This commit is contained in:
arovak 2021-04-21 22:14:58 +02:00
parent 19408175ca
commit 19a1d0576a
4 changed files with 52 additions and 4 deletions

View File

@ -1,3 +1,7 @@
#ifdef USE_CONFIG_OVERRIDE
#include "user_config_override.h"
#endif
#include "lv_conf_v7.h"
#define LV_THEME_DEFAULT_FLAGS LV_THEME_DEFAULT_FLAG

View File

@ -367,6 +367,19 @@ typedef void* lv_indev_drv_user_data_t; /*Type of user data in the in
#define ROBOTOCONDENSED_REGULAR_48_LATIN1 1
#endif
#ifndef HASP_FONT_SIZE_1
#define HASP_FONT_SIZE_1 16
#endif
#ifndef HASP_FONT_SIZE_2
#define HASP_FONT_SIZE_2 24
#endif
#ifndef HASP_FONT_SIZE_3
#define HASP_FONT_SIZE_3 32
#endif
#ifndef HASP_FONT_SIZE_4
#define HASP_FONT_SIZE_4 48
#endif
#else
#ifndef HASP_FONT_1
@ -395,6 +408,19 @@ typedef void* lv_indev_drv_user_data_t; /*Type of user data in the in
#define ROBOTOCONDENSED_REGULAR_32_LATIN1 1
#endif
#ifndef HASP_FONT_SIZE_1
#define HASP_FONT_SIZE_1 12
#endif
#ifndef HASP_FONT_SIZE_2
#define HASP_FONT_SIZE_2 16
#endif
#ifndef HASP_FONT_SIZE_3
#define HASP_FONT_SIZE_3 24
#endif
#ifndef HASP_FONT_SIZE_4
#define HASP_FONT_SIZE_4 32
#endif
#endif
/* The built-in fonts contains the ASCII range and some Symbols with 4 bit-per-pixel.

View File

@ -88,6 +88,24 @@
#define D_HTTP_COLOR_BUTTON_RESET "#d43535" // Restart/Reset/Delete button color - Strong red
*/
/***************************************************
* Font Settings
**************************************************/
// #define HASP_FONT_1 robotocondensed_regular_16_latin1 // Use available fonts from src/fonts directory
// #define HASP_FONT_2 robotocondensed_regular_22_latin1
// #define HASP_FONT_3 robotocondensed_regular_40_latin1
// #define HASP_FONT_4 robotocondensed_regular_48_latin1
// #define ROBOTOCONDENSED_REGULAR_16_LATIN1 1 // Enable the selected fonts
// #define ROBOTOCONDENSED_REGULAR_22_LATIN1 1
// #define ROBOTOCONDENSED_REGULAR_40_LATIN1 1
// #define ROBOTOCONDENSED_REGULAR_48_LATIN1 1
// #define HASP_FONT_SIZE_1 16 // Define used font sizes
// #define HASP_FONT_SIZE_2 22
// #define HASP_FONT_SIZE_3 40
// #define HASP_FONT_SIZE_4 48
/***************************************************
* Other Settings
**************************************************/

View File

@ -463,24 +463,24 @@ static lv_font_t* haspPayloadToFont(const char* payload)
#ifndef ARDUINO_ARCH_ESP8266
#ifdef HASP_FONT_1
case 12:
case HASP_FONT_SIZE_1:
return &HASP_FONT_1;
#endif
#ifdef HASP_FONT_2
case 16:
case HASP_FONT_SIZE_2:
LOG_WARNING(TAG_ATTR, "%s %d %x", __FILE__, __LINE__, HASP_FONT_2);
return &HASP_FONT_2;
#endif
#ifdef HASP_FONT_3
case 22:
case HASP_FONT_SIZE_3:
LOG_WARNING(TAG_ATTR, "%s %d %x", __FILE__, __LINE__, HASP_FONT_3);
return &HASP_FONT_3;
#endif
#ifdef HASP_FONT_4
case 28:
case HASP_FONT_SIZE_4:
LOG_WARNING(TAG_ATTR, "%s %d %x", __FILE__, __LINE__, HASP_FONT_4);
return &HASP_FONT_4;
#endif