Reinstate bitmap fonts for testing

This commit is contained in:
fvanroie 2022-11-28 17:26:49 +01:00
parent e78abd362f
commit e30a572dcb
3 changed files with 13 additions and 6 deletions

View File

@ -376,7 +376,7 @@ typedef void* lv_indev_drv_user_data_t; /*Type of user data in the in
/*==================
* FONT USAGE
*===================*/
#if HASP_USE_FREETYPE<=0
#if 1 || HASP_USE_FREETYPE<=0
#if TFT_HEIGHT>=480 && TFT_WIDTH>=480
#ifndef ROBOTOCONDENSED_REGULAR_24_LATIN1
#define ROBOTOCONDENSED_REGULAR_24_LATIN1 1
@ -674,7 +674,7 @@ typedef void* lv_font_user_data_t;
// #define HASP_FONT_4 FONT_CONCAT(HASP_FONT_4_base, HASP_CHARACTER_SET)
/*Always set a default font from the built-in fonts*/
#if HASP_USE_FREETYPE<=0 // LV_HIGH_RESOURCE_MCU>0
#if 1 || HASP_USE_FREETYPE<=0 // LV_HIGH_RESOURCE_MCU>0
// #define LV_FONT_CUSTOM_DECLARE LV_FONT_DECLARE(lv_font_montserrat_16);
// #define LV_FONT_CUSTOM_12 LV_FONT_DECLARE(robotocondensed_regular_12)
@ -712,7 +712,7 @@ typedef void* lv_font_user_data_t;
#define LV_THEME_DEFAULT_COLOR_PRIMARY LV_COLOR_RED
#define LV_THEME_DEFAULT_COLOR_SECONDARY LV_COLOR_BLUE
#define LV_THEME_DEFAULT_FLAG 0 //LV_THEME_MATERIAL_FLAG_NONE
#if HASP_USE_FREETYPE<=0 //LV_HIGH_RESOURCE_MCU
#if 1 || HASP_USE_FREETYPE<=0 //LV_HIGH_RESOURCE_MCU
#define LV_THEME_DEFAULT_FONT_SMALL &HASP_FONT_1 //&lv_font_montserrat_12
#define LV_THEME_DEFAULT_FONT_NORMAL &HASP_FONT_2 //&lv_font_montserrat_16
#define LV_THEME_DEFAULT_FONT_SUBTITLE &HASP_FONT_3 //&lv_font_montserrat_22

View File

@ -467,15 +467,22 @@ static bool lv_ft_font_init_cache(lv_ft_info_t* info)
// font->get_glyph_dsc = get_glyph_dsc_cb_cache;
font->get_glyph_dsc = get_glyph_dsc_cb;
font->get_glyph_bitmap = get_glyph_bitmap_cb_cache;
font->line_height = ((32 + face_size->face->size->metrics.height) >> 6);
font->base_line = ((32 - face_size->face->size->metrics.descender) >> 6);
font->subpx = LV_FONT_SUBPX_NONE;
font->line_height = ((face_size->face->size->metrics.ascender - face_size->face->size->metrics.descender) >> 6);
font->base_line = -(face_size->face->size->metrics.descender >> 6);
FT_Fixed scale = face_size->face->size->metrics.y_scale;
int8_t thickness = FT_MulFix(scale, face_size->face->underline_thickness) >> 6;
font->underline_position = FT_MulFix(scale, face_size->face->underline_position) >> 6;
font->underline_thickness = thickness < 1 ? 1 : thickness;
LV_LOG_WARN("Ascender: %d", face_size->face->size->metrics.ascender);
LV_LOG_WARN("Descender: %d", face_size->face->size->metrics.descender);
LV_LOG_WARN("Lineheight: %d", font->line_height);
LV_LOG_WARN("Baseline: %d", font->base_line);
LV_LOG_WARN("Underline: %d", font->underline_position);
LV_LOG_WARN("Underline: %d", font->underline_thickness);
/* return to user */
info->font = font;

View File

@ -561,7 +561,7 @@ void haspSetup(void)
LOG_WARNING(TAG_ATTR, "%s %d %x", __FILE__, __LINE__, haspFonts[0]);
// LOG_WARNING(TAG_ATTR, "%s %d %x", __FILE__, __LINE__, &robotocondensed_regular_16);
#if HASP_USE_FREETYPE > 0
#if 0 && HASP_USE_FREETYPE > 0
#if TFT_HEIGHT >= 480 && TFT_WIDTH >= 480
haspFonts[0] = get_font(" 24");