revert(color): Go back to using embedded fonts (#4347)

This commit is contained in:
philmoz
2023-11-27 21:37:46 +10:00
committed by GitHub
parent 40c992f060
commit aa62221fc2
45 changed files with 198990 additions and 39915 deletions
Binary file not shown.
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
Binary file not shown.
File diff suppressed because it is too large Load Diff
Binary file not shown.
File diff suppressed because it is too large Load Diff
Binary file not shown.
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
Binary file not shown.
File diff suppressed because it is too large Load Diff
Binary file not shown.
File diff suppressed because it is too large Load Diff
Binary file not shown.
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
Binary file not shown.
File diff suppressed because it is too large Load Diff
Binary file not shown.
File diff suppressed because it is too large Load Diff
Binary file not shown.
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
Binary file not shown.
File diff suppressed because it is too large Load Diff
Binary file not shown.
File diff suppressed because it is too large Load Diff
Binary file not shown.
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
Binary file not shown.
File diff suppressed because it is too large Load Diff
Binary file not shown.
File diff suppressed because it is too large Load Diff
Binary file not shown.
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
Binary file not shown.
File diff suppressed because it is too large Load Diff
Binary file not shown.
File diff suppressed because it is too large Load Diff
+29 -21
View File
@@ -32,11 +32,10 @@ function make_font() {
local name=$1 local name=$1
local ttf=$2 local ttf=$2
local size=$3 local size=$3
local bpp=$4 local chars=$4
local chars=$5 local arg=$5
local arg=$6
lv_font_conv --no-prefilter --bpp ${bpp} --size ${size} \ lv_font_conv --no-prefilter --bpp 4 --size ${size} \
--font ${TTF_DIR}${ttf} -r ${ASCII},${DEGREE},${BULLET},${COMPARE}${chars} \ --font ${TTF_DIR}${ttf} -r ${ASCII},${DEGREE},${BULLET},${COMPARE}${chars} \
--font EdgeTX/extra.ttf -r ${EXTRA_SYM} \ --font EdgeTX/extra.ttf -r ${EXTRA_SYM} \
--font ${ARROWS_FONT} -r ${ARROWS} \ --font ${ARROWS_FONT} -r ${ARROWS} \
@@ -44,20 +43,29 @@ function make_font() {
--format lvgl -o lv_font_${name}_${size}.c --force-fast-kern-format ${arg} --format lvgl -o lv_font_${name}_${size}.c --force-fast-kern-format ${arg}
} }
function make_font_bin() { function make_font_w_extra_sym() {
local name=$1 local name=$1
local ttf=$2 local ttf=$2
local size=$3 local size=$3
local bpp=$4 local chars=$4
local chars=$5 local arg=$5
local arg=$6
lv_font_conv --no-prefilter --bpp ${bpp} --size ${size} \ lv_font_conv --no-prefilter --bpp 4 --size ${size} \
--font ${TTF_DIR}${ttf} -r ${ASCII},${DEGREE},${BULLET},${COMPARE}${chars} \ --font ${TTF_DIR}${ttf} -r ${ASCII},${DEGREE}${chars} \
--font EdgeTX/extra.ttf -r ${EXTRA_SYM} \ --font EdgeTX/extra.ttf -r ${EXTRA_SYM} \
--font ${ARROWS_FONT} -r ${ARROWS} \ --format lvgl -o lv_font_${name}_${size}.c --force-fast-kern-format ${arg}
--font ${SYMBOLS_FONT} -r ${SYMBOLS} \ }
--format bin -o lv_font_${name}_${size}.bin --force-fast-kern-format --no-compress ${arg}
function make_font_no_sym() {
local name=$1
local ttf=$2
local size=$3
local chars=$4
local arg=$5
lv_font_conv --no-prefilter --bpp 4 --size ${size} \
--font ${TTF_DIR}${ttf} -r ${ASCII},${DEGREE}${chars} \
--format lvgl -o lv_font_${name}_${size}.c --force-fast-kern-format ${arg}
} }
# LV_SYMBOL_CHARGE, LV_SYMBOL_NEW_LINE, LV_SYMBOL_SD_CARD, LV_SYMBOL_CLOSE # LV_SYMBOL_CHARGE, LV_SYMBOL_NEW_LINE, LV_SYMBOL_SD_CARD, LV_SYMBOL_CLOSE
@@ -79,14 +87,14 @@ function make_font_set() {
local ttf_normal=$2 local ttf_normal=$2
local ttf_bold=$3 local ttf_bold=$3
local chars=$4 local chars=$4
make_font "${name}" "${ttf_normal}" 9 4 ${chars} --no-compress make_font "${name}" "${ttf_normal}" 9 ${chars} --no-compress
make_font "${name}" "${ttf_normal}" 13 4 ${chars} --no-compress make_font "${name}" "${ttf_normal}" 13 ${chars} --no-compress
make_font "${name}" "${ttf_normal}" 16 4 ${chars} --no-compress make_font "${name}" "${ttf_normal}" 16 ${chars} --no-compress
make_font "${name}_bold" "${ttf_bold}" 16 4 ${chars} --no-compress make_font "${name}_bold" "${ttf_bold}" 16 ${chars}
make_font_bin "${name}" "${ttf_normal}" 24 4 ${chars} make_font_w_extra_sym "${name}" "${ttf_normal}" 24 ${chars}
make_font_bin "${name}_bold" "${ttf_bold}" 32 4 ${chars} make_font_no_sym "${name}_bold" "${ttf_bold}" 32 ${chars}
make_font_bin "${name}_bold" "${ttf_bold}" 64 4 ${chars} make_font_no_sym "${name}_bold" "${ttf_bold}" 64
} }
# Regular fonts # Regular fonts
+3 -46
View File
@@ -30,67 +30,25 @@
&lv_font_ ## name ## _bold_16, /* FONT_BOLD_INDEX */ \ &lv_font_ ## name ## _bold_16, /* FONT_BOLD_INDEX */ \
&lv_font_ ## name ## _9, /* FONT_XXS_INDEX */ \ &lv_font_ ## name ## _9, /* FONT_XXS_INDEX */ \
&lv_font_ ## name ## _13, /* FONT_XS_INDEX */ \ &lv_font_ ## name ## _13, /* FONT_XS_INDEX */ \
nullptr, /* FONT_L_INDEX */ \ &lv_font_ ## name ## _24, /* FONT_L_INDEX */ \
nullptr, /* FONT_XL_INDEX */ \ &lv_font_ ## name ## _bold_32, /* FONT_XL_INDEX */ \
nullptr, /* FONT_XXL_INDEX */ \ &lv_font_ ## name ## _bold_64, /* FONT_XXL_INDEX */ \
} }
#if defined(TRANSLATIONS_CN) #if defined(TRANSLATIONS_CN)
FONT_TABLE(noto_cn); FONT_TABLE(noto_cn);
#define XXL_FONT "F/FONTS/lv_font_noto_cn_bold_64.bin"
#define XL_FONT "F/FONTS/lv_font_noto_cn_bold_32.bin"
#define L_FONT "F/FONTS/lv_font_noto_cn_24.bin"
#elif defined(TRANSLATIONS_TW) #elif defined(TRANSLATIONS_TW)
FONT_TABLE(noto_tw); FONT_TABLE(noto_tw);
#define XXL_FONT "F/FONTS/lv_font_noto_tw_bold_64.bin"
#define XL_FONT "F/FONTS/lv_font_noto_tw_bold_32.bin"
#define L_FONT "F/FONTS/lv_font_noto_tw_24.bin"
#elif defined(TRANSLATIONS_JP) #elif defined(TRANSLATIONS_JP)
FONT_TABLE(noto_jp); FONT_TABLE(noto_jp);
#define XXL_FONT "F/FONTS/lv_font_noto_jp_bold_64.bin"
#define XL_FONT "F/FONTS/lv_font_noto_jp_bold_32.bin"
#define L_FONT "F/FONTS/lv_font_noto_jp_24.bin"
#elif defined(TRANSLATIONS_HE) #elif defined(TRANSLATIONS_HE)
FONT_TABLE(arimo_he); FONT_TABLE(arimo_he);
#define XXL_FONT "F/FONTS/lv_font_arimo_he_bold_64.bin"
#define XL_FONT "F/FONTS/lv_font_arimo_he_bold_32.bin"
#define L_FONT "F/FONTS/lv_font_arimo_he_24.bin"
#elif defined(TRANSLATIONS_RU) #elif defined(TRANSLATIONS_RU)
FONT_TABLE(arimo_ru); FONT_TABLE(arimo_ru);
#define XXL_FONT "F/FONTS/lv_font_arimo_ru_bold_64.bin"
#define XL_FONT "F/FONTS/lv_font_arimo_ru_bold_32.bin"
#define L_FONT "F/FONTS/lv_font_arimo_ru_24.bin"
#else #else
FONT_TABLE(roboto); FONT_TABLE(roboto);
#define XXL_FONT "F/FONTS/lv_font_roboto_bold_64.bin"
#define XL_FONT "F/FONTS/lv_font_roboto_bold_32.bin"
#define L_FONT "F/FONTS/lv_font_roboto_24.bin"
#endif #endif
void initFont(uint8_t font)
{
if (font >= FONT_L_INDEX && lvglFontTable[FONT_L_INDEX] == nullptr) {
const lv_font_t* lvFont = lv_font_load(L_FONT);
if (lvFont == nullptr)
lvFont = lvglFontTable[FONT_STD_INDEX];
lvglFontTable[FONT_L_INDEX] = lvFont;
}
if (font >= FONT_XL_INDEX && lvglFontTable[FONT_XL_INDEX] == nullptr) {
const lv_font_t* lvFont = lv_font_load(XL_FONT);
if (lvFont == nullptr)
lvFont = lvglFontTable[FONT_L_INDEX];
lvglFontTable[FONT_XL_INDEX] = lvFont;
}
if (font == FONT_XXL_INDEX && lvglFontTable[font] == nullptr) {
const lv_font_t* lvFont = lv_font_load(XXL_FONT);
if (lvFont == nullptr)
lvFont = lvglFontTable[font-1];
lvglFontTable[font] = lvFont;
}
}
#endif // BOOT #endif // BOOT
// used to set the line height to the line heights used in Edgetx < 2.7 and OpenTX // used to set the line height to the line heights used in Edgetx < 2.7 and OpenTX
@@ -110,7 +68,6 @@ const lv_font_t* getFont(LcdFlags flags)
return LV_FONT_DEFAULT; return LV_FONT_DEFAULT;
#else #else
auto fontIndex = FONT_INDEX(flags); auto fontIndex = FONT_INDEX(flags);
initFont(fontIndex);
if (fontIndex >= FONTS_COUNT) return LV_FONT_DEFAULT; if (fontIndex >= FONTS_COUNT) return LV_FONT_DEFAULT;
return lvglFontTable[fontIndex]; return lvglFontTable[fontIndex];
#endif #endif
-8
View File
@@ -746,19 +746,11 @@
#endif #endif
/*API for FATFS (needs to be added separately). Uses f_open, f_read, etc*/ /*API for FATFS (needs to be added separately). Uses f_open, f_read, etc*/
#if defined(BOOT)
#define LV_USE_FS_FATFS 0 #define LV_USE_FS_FATFS 0
#if LV_USE_FS_FATFS #if LV_USE_FS_FATFS
#define LV_FS_FATFS_LETTER '\0' /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/ #define LV_FS_FATFS_LETTER '\0' /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/
#define LV_FS_FATFS_CACHE_SIZE 0 /*>0 to cache this number of bytes in lv_fs_read()*/ #define LV_FS_FATFS_CACHE_SIZE 0 /*>0 to cache this number of bytes in lv_fs_read()*/
#endif #endif
#else
#define LV_USE_FS_FATFS 1
#if LV_USE_FS_FATFS
#define LV_FS_FATFS_LETTER 'F' /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/
#define LV_FS_FATFS_CACHE_SIZE 0 /*>0 to cache this number of bytes in lv_fs_read()*/
#endif
#endif
/*PNG decoder library*/ /*PNG decoder library*/
#if !defined(BOOT) #if !defined(BOOT)