mirror of
https://github.com/HASwitchPlate/openHASP.git
synced 2025-07-28 05:36:37 +00:00
Add HASP_USE_FREETYPE #249
This commit is contained in:
parent
817843558b
commit
6ea280dbe9
@ -1,7 +1,9 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "hasplib.h"
|
#include "hasplib.h"
|
||||||
|
#if HASP_USE_FREETYPE > 0
|
||||||
#include "lv_freetype.h"
|
#include "lv_freetype.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "hasp_mem.h"
|
#include "hasp_mem.h"
|
||||||
#include "font/hasp_font_loader.h"
|
#include "font/hasp_font_loader.h"
|
||||||
@ -51,28 +53,28 @@ static lv_font_t* font_add_to_list(const char* payload)
|
|||||||
lv_font_t* font = hasp_font_load(filename);
|
lv_font_t* font = hasp_font_load(filename);
|
||||||
char* name_p = NULL;
|
char* name_p = NULL;
|
||||||
|
|
||||||
#if defined(ARDUINO_ARCH_ESP32)
|
#if defined(ARDUINO_ARCH_ESP32) && (HASP_USE_FREETYPE > 0)
|
||||||
if(!font) {
|
// if(!font) {
|
||||||
// Try .ttf file
|
// // Try .ttf file
|
||||||
|
|
||||||
size_t pos = font_split_payload(payload);
|
// size_t pos = font_split_payload(payload);
|
||||||
if(pos > 0 && pos < 56) {
|
// if(pos > 0 && pos < 56) {
|
||||||
uint16_t size = atoi(payload + pos);
|
// uint16_t size = atoi(payload + pos);
|
||||||
|
|
||||||
char fontname[64];
|
// char fontname[64];
|
||||||
memset(fontname, 0, sizeof(fontname));
|
// memset(fontname, 0, sizeof(fontname));
|
||||||
strncpy(fontname, payload, pos);
|
// strncpy(fontname, payload, pos);
|
||||||
snprintf_P(filename, sizeof(filename), PSTR("L:\\%s.ttf"), fontname);
|
// snprintf_P(filename, sizeof(filename), PSTR("L:\\%s.ttf"), fontname);
|
||||||
|
|
||||||
lv_ft_info_t info;
|
// lv_ft_info_t info;
|
||||||
info.name = filename;
|
// info.name = filename;
|
||||||
info.weight = size;
|
// info.weight = size;
|
||||||
info.style = FT_FONT_STYLE_NORMAL;
|
// info.style = FT_FONT_STYLE_NORMAL;
|
||||||
if(lv_ft_font_init(&info)) {
|
// if(lv_ft_font_init(&info)) {
|
||||||
font = info.font;
|
// font = info.font;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
if(!font) {
|
if(!font) {
|
||||||
// Try .otf file
|
// Try .otf file
|
||||||
|
Loading…
x
Reference in New Issue
Block a user