improve font manager

This commit is contained in:
lixianjing 2021-06-15 18:04:53 +08:00
parent e5393b950e
commit 9ff8d8a25c
3 changed files with 8 additions and 1 deletions

View File

@ -3,6 +3,7 @@
2021/06/15
* edit不再用左右键切换焦点。
* 完善is\_same\_col/is\_same\_row的算法。
* 完善font manager字体卸载(感谢智明提供补丁)
2021/06/11
* 修改一些编译警告。

View File

@ -203,7 +203,9 @@ ret_t font_manager_unload_font(font_manager_t* fm, const char* name, font_size_t
#endif
ret = darray_remove(&(fm->fonts), &info);
assets_manager_clear_cache_ex(assets_manager(), ASSET_TYPE_FONT, name);
if (ret == RET_OK) {
assets_manager_clear_cache_ex(assets_manager(), ASSET_TYPE_FONT, name);
}
return ret;
}

View File

@ -52,6 +52,10 @@ TEST(FontManager, loader) {
TEST(FontManager, unload) {
font_manager_t font_manager;
emitter_t* emitter = EMITTER(assets_manager());
if (emitter_size(emitter) > 0) {
emitter_off_by_tag(emitter, 0);
}
font_manager_init(&font_manager, font_loader_truetype());
font_manager_set_assets_manager(&font_manager, assets_manager());