mirror of
https://github.com/HASwitchPlate/openHASP.git
synced 2025-07-28 21:56:35 +00:00
Add openhasp.ttf
This commit is contained in:
parent
d2342377fb
commit
50565fb349
3
.gitignore
vendored
3
.gitignore
vendored
@ -8,11 +8,12 @@ bin/*
|
|||||||
data/*
|
data/*
|
||||||
!data/edit.htm
|
!data/edit.htm
|
||||||
!data/edit.htm.gz
|
!data/edit.htm.gz
|
||||||
!data/vars.css
|
!data/openhasp.ttf
|
||||||
!data/style.css
|
!data/style.css
|
||||||
!data/style.css.gz
|
!data/style.css.gz
|
||||||
!data/script.js
|
!data/script.js
|
||||||
!data/script.js.gz
|
!data/script.js.gz
|
||||||
|
!data/vars.css
|
||||||
!data/cert/
|
!data/cert/
|
||||||
!data/cert/x509_crt_bundle.bin
|
!data/cert/x509_crt_bundle.bin
|
||||||
!data/static/
|
!data/static/
|
||||||
|
BIN
data/openhasp.ttf
Normal file
BIN
data/openhasp.ttf
Normal file
Binary file not shown.
@ -6,7 +6,6 @@
|
|||||||
/*********************
|
/*********************
|
||||||
* INCLUDES
|
* INCLUDES
|
||||||
*********************/
|
*********************/
|
||||||
#include "lv_freetype.h"
|
|
||||||
#if LV_USE_FREETYPE
|
#if LV_USE_FREETYPE
|
||||||
|
|
||||||
#include "ft2build.h"
|
#include "ft2build.h"
|
||||||
|
@ -23,6 +23,11 @@ typedef struct
|
|||||||
#include "hasp_mem.h"
|
#include "hasp_mem.h"
|
||||||
#include "font/hasp_font_loader.h"
|
#include "font/hasp_font_loader.h"
|
||||||
|
|
||||||
|
extern const uint8_t OPENHASP_TTF_START[] asm("_binary_data_openhasp_ttf_start");
|
||||||
|
extern const uint8_t OPENHASP_TTF_END[] asm("_binary_data_openhasp_ttf_end");
|
||||||
|
extern const uint8_t OPENHASPLITE_TTF_START[] asm("_binary_data_openhasplite_ttf_start");
|
||||||
|
extern const uint8_t OPENHASPLITE_TTF_END[] asm("_binary_data_openhasplite_ttf_end");
|
||||||
|
|
||||||
static lv_ll_t hasp_fonts_ll;
|
static lv_ll_t hasp_fonts_ll;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
@ -162,7 +167,7 @@ static lv_font_t* font_add_to_list(const char* payload)
|
|||||||
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);
|
||||||
if(payload[pos - 1] == '_') pos--; // trancate trailing underscore
|
if(payload[pos - 1] == '_') pos--; // truncate trailing underscore
|
||||||
|
|
||||||
char fontname[256];
|
char fontname[256];
|
||||||
memset(fontname, 0, sizeof(fontname));
|
memset(fontname, 0, sizeof(fontname));
|
||||||
@ -182,10 +187,11 @@ static lv_font_t* font_add_to_list(const char* payload)
|
|||||||
}
|
}
|
||||||
|
|
||||||
lv_ft_info_t info;
|
lv_ft_info_t info;
|
||||||
info.name = filename;
|
info.name = filename;
|
||||||
info.weight = size;
|
info.weight = size;
|
||||||
info.mem = NULL;
|
info.mem = NULL;
|
||||||
info.style = FT_FONT_STYLE_NORMAL;
|
info.mem_size = 0;
|
||||||
|
info.style = FT_FONT_STYLE_NORMAL;
|
||||||
LOG_VERBOSE(TAG_FONT, F("Loading font %s size %d"), filename, size);
|
LOG_VERBOSE(TAG_FONT, F("Loading font %s size %d"), filename, size);
|
||||||
if(lv_ft_font_init(&info)) {
|
if(lv_ft_font_init(&info)) {
|
||||||
font = info.font;
|
font = info.font;
|
||||||
@ -194,6 +200,24 @@ static lv_font_t* font_add_to_list(const char* payload)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!font) {
|
||||||
|
strcpy(filename, "openhasp");
|
||||||
|
uint16_t size = atoi(payload);
|
||||||
|
if(size > 8) {
|
||||||
|
lv_ft_info_t info;
|
||||||
|
info.name = filename;
|
||||||
|
info.weight = size;
|
||||||
|
info.mem = (const void*) OPENHASP_TTF_START;
|
||||||
|
info.mem_size = OPENHASP_TTF_END - OPENHASP_TTF_START;
|
||||||
|
info.style = FT_FONT_STYLE_NORMAL;
|
||||||
|
LOG_VERBOSE(TAG_FONT, F("Loading font %s size %d"), filename, size);
|
||||||
|
if(lv_ft_font_init(&info)) {
|
||||||
|
font = info.font;
|
||||||
|
font_type = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(!font) return NULL;
|
if(!font) return NULL;
|
||||||
|
@ -7,6 +7,8 @@ debug_tool = esp-prog
|
|||||||
debug_init_break = tbreak setup
|
debug_init_break = tbreak setup
|
||||||
board_build.embed_files =
|
board_build.embed_files =
|
||||||
data/edit.htm.gz
|
data/edit.htm.gz
|
||||||
|
data/openhasp.ttf
|
||||||
|
data/openhasplite.ttf
|
||||||
data/style.css.gz
|
data/style.css.gz
|
||||||
data/script.js.gz
|
data/script.js.gz
|
||||||
data/cert/x509_crt_bundle.bin
|
data/cert/x509_crt_bundle.bin
|
||||||
|
@ -10,9 +10,8 @@ board = esp32dev
|
|||||||
build_flags =
|
build_flags =
|
||||||
${env.build_flags}
|
${env.build_flags}
|
||||||
${esp32.build_flags}
|
${esp32.build_flags}
|
||||||
|
${esp32.ps_ram}
|
||||||
-D HASP_MODEL="FreeTouchDeck"
|
-D HASP_MODEL="FreeTouchDeck"
|
||||||
-DBOARD_HAS_PSRAM ; uses 78kB
|
|
||||||
;-mfix-esp32-psram-cache-issue ; uses 24kB
|
|
||||||
|
|
||||||
;region -- TFT_eSPI build options ------------------------
|
;region -- TFT_eSPI build options ------------------------
|
||||||
${esp32.vspi} ; Use VSPI hardware SPI bus
|
${esp32.vspi} ; Use VSPI hardware SPI bus
|
||||||
|
Loading…
x
Reference in New Issue
Block a user