diff --git a/demos/demo_desktop.c b/demos/demo_desktop.c index a9a58b680..433a28b7b 100644 --- a/demos/demo_desktop.c +++ b/demos/demo_desktop.c @@ -44,4 +44,8 @@ ret_t application_exit() { #define LCD_HEGHT 600 #define APP_TYPE APP_DESKTOP +#ifdef WITH_FS_RES +#define APP_DEFAULT_FONT "default_full" +#endif/*WITH_FS_RES*/ + #include "awtk_main.inc" diff --git a/demos/demo_file_browser.c b/demos/demo_file_browser.c index 05e235d1e..21e29e4b8 100644 --- a/demos/demo_file_browser.c +++ b/demos/demo_file_browser.c @@ -106,4 +106,8 @@ ret_t application_exit() { return RET_OK; } +#ifdef WITH_FS_RES +#define APP_DEFAULT_FONT "default_full" +#endif/*WITH_FS_RES*/ + #include "awtk_main.inc" diff --git a/demos/demo_ui_app.c b/demos/demo_ui_app.c index c895b0ac3..ad5c24074 100644 --- a/demos/demo_ui_app.c +++ b/demos/demo_ui_app.c @@ -862,4 +862,8 @@ ret_t application_exit() { return RET_OK; } +#ifdef WITH_FS_RES +#define APP_DEFAULT_FONT "default_full" +#endif/*WITH_FS_RES*/ + #include "awtk_main.inc" diff --git a/docs/changes.md b/docs/changes.md index 3af288734..5aa39740f 100644 --- a/docs/changes.md +++ b/docs/changes.md @@ -1,6 +1,7 @@ # 最新动态 * 2020/05/22 * 修改 list item 快速点击无效的问题(感谢 yeslee 提供补丁) + * 完善缺省字体处理(感谢俊杰提供补丁) * 2020/05/21 * 增加文档《自定义控件规范》 diff --git a/src/awtk_main.inc b/src/awtk_main.inc index 960609c59..77aaff9b0 100644 --- a/src/awtk_main.inc +++ b/src/awtk_main.inc @@ -26,11 +26,7 @@ extern ret_t assets_init(void); END_C_DECLS #ifndef APP_DEFAULT_FONT -#ifdef WITH_FS_RES -#define APP_DEFAULT_FONT "default_full" -#else #define APP_DEFAULT_FONT "default" -#endif /*WITH_FS_RES*/ #endif /*APP_DEFAULT_FONT*/ #ifndef LCD_WIDTH diff --git a/src/base/font_manager.c b/src/base/font_manager.c index b3bb46ffe..3baf36147 100644 --- a/src/base/font_manager.c +++ b/src/base/font_manager.c @@ -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 = fonts[0]; }