improve default font handling

This commit is contained in:
lixianjing 2020-05-22 18:30:13 +08:00
parent 0b79f75209
commit 3f5e3623b2
6 changed files with 14 additions and 5 deletions

View File

@ -44,4 +44,8 @@ ret_t application_exit() {
#define LCD_HEGHT 600 #define LCD_HEGHT 600
#define APP_TYPE APP_DESKTOP #define APP_TYPE APP_DESKTOP
#ifdef WITH_FS_RES
#define APP_DEFAULT_FONT "default_full"
#endif/*WITH_FS_RES*/
#include "awtk_main.inc" #include "awtk_main.inc"

View File

@ -106,4 +106,8 @@ ret_t application_exit() {
return RET_OK; return RET_OK;
} }
#ifdef WITH_FS_RES
#define APP_DEFAULT_FONT "default_full"
#endif/*WITH_FS_RES*/
#include "awtk_main.inc" #include "awtk_main.inc"

View File

@ -862,4 +862,8 @@ ret_t application_exit() {
return RET_OK; return RET_OK;
} }
#ifdef WITH_FS_RES
#define APP_DEFAULT_FONT "default_full"
#endif/*WITH_FS_RES*/
#include "awtk_main.inc" #include "awtk_main.inc"

View File

@ -1,6 +1,7 @@
# 最新动态 # 最新动态
* 2020/05/22 * 2020/05/22
* 修改 list item 快速点击无效的问题(感谢 yeslee 提供补丁) * 修改 list item 快速点击无效的问题(感谢 yeslee 提供补丁)
* 完善缺省字体处理(感谢俊杰提供补丁)
* 2020/05/21 * 2020/05/21
* 增加文档《自定义控件规范》 * 增加文档《自定义控件规范》

View File

@ -26,11 +26,7 @@ extern ret_t assets_init(void);
END_C_DECLS END_C_DECLS
#ifndef APP_DEFAULT_FONT #ifndef APP_DEFAULT_FONT
#ifdef WITH_FS_RES
#define APP_DEFAULT_FONT "default_full"
#else
#define APP_DEFAULT_FONT "default" #define APP_DEFAULT_FONT "default"
#endif /*WITH_FS_RES*/
#endif /*APP_DEFAULT_FONT*/ #endif /*APP_DEFAULT_FONT*/
#ifndef LCD_WIDTH #ifndef LCD_WIDTH

View File

@ -152,7 +152,7 @@ font_t* font_manager_get_font(font_manager_t* fm, const char* name, font_size_t
} }
} }
if (font == NULL) { if (font == NULL && fm->fonts.size > 0) {
font_t** fonts = (font_t**)fm->fonts.elms; font_t** fonts = (font_t**)fm->fonts.elms;
font = fonts[0]; font = fonts[0];
} }