fix label auto adjust resize

This commit is contained in:
lixianjing 2021-03-13 07:28:42 +08:00
parent 97adc000e7
commit 010051230f
2 changed files with 9 additions and 2 deletions

View File

@ -1,5 +1,8 @@
# 最新动态
2020/03/13
* 修复 label\_get\_text\_line\_max\_w 接口在tr\_text属性为空调用失败的问题(感谢雨欣提供补丁)
2020/03/10
* 增加输入类型INPUT\_ASCII用于输入纯英文字符。
* 修复font\_manager\_unload\_font在OpenGL模式下不能卸载字体的问题。

View File

@ -130,8 +130,12 @@ static wh_t label_get_text_line_max_w(widget_t* widget, canvas_t* c) {
wstr_t s;
wstr_init(&s, 0);
if (widget->tr_text) {
const char* utf8 = locale_info_tr(locale_info(), widget->tr_text);
return_value_if_fail(wstr_set_utf8(&s, utf8) == RET_OK, 0);
} else if (widget->text.size) {
return_value_if_fail(wstr_set(&s, widget->text.str) == RET_OK, 0)
}
wchar_t* str = s.str;
uint32_t size = s.size;