mirror of
https://gitee.com/zlgopen/awtk.git
synced 2024-12-02 03:58:33 +08:00
improve font_stb_get_vmetrics for mingw
This commit is contained in:
parent
7d3c89e73e
commit
90f59cace5
@ -1,5 +1,8 @@
|
|||||||
# 最新动态
|
# 最新动态
|
||||||
|
|
||||||
|
2024/10/23
|
||||||
|
* 修复mingw编译下font_stb_get_vmetrics异常问题(感谢颖健提供补丁)
|
||||||
|
|
||||||
2024/10/21
|
2024/10/21
|
||||||
* 完善AWTK字号转成标准字号的功能(感谢颖健提供补丁)
|
* 完善AWTK字号转成标准字号的功能(感谢颖健提供补丁)
|
||||||
* 打开对话框失去焦点时Ctrl状态未恢复的问题(感谢颖健提供补丁)
|
* 打开对话框失去焦点时Ctrl状态未恢复的问题(感谢颖健提供补丁)
|
||||||
|
@ -85,12 +85,15 @@ static bool_t font_stb_match(font_t* f, const char* name, font_size_t font_size)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static font_vmetrics_t font_stb_get_vmetrics(font_t* f, font_size_t font_size) {
|
static font_vmetrics_t font_stb_get_vmetrics(font_t* f, font_size_t font_size) {
|
||||||
int16_t ascender = 0;
|
int ascender = 0;
|
||||||
int16_t descender = 0;
|
int descender = 0;
|
||||||
font_vmetrics_t vmetrics;
|
float scale = 0.0f;
|
||||||
font_stb_t* font = (font_stb_t*)f;
|
font_stb_t* font = (font_stb_t*)f;
|
||||||
stbtt_fontinfo* sf = &(font->stb_font);
|
const stbtt_fontinfo* sf = &(font->stb_font);
|
||||||
float scale = stbtt_ScaleForPixelHeight(sf, font_size);
|
font_vmetrics_t vmetrics = {font_size, 0, 0, 0, 0, 0};
|
||||||
|
|
||||||
|
return_value_if_fail(sf != NULL, vmetrics);
|
||||||
|
scale = stbtt_ScaleForPixelHeight(sf, font_size);
|
||||||
if (scale == INFINITY) {
|
if (scale == INFINITY) {
|
||||||
scale = stbtt_ScaleForMappingEmToPixels(sf, font_size);
|
scale = stbtt_ScaleForMappingEmToPixels(sf, font_size);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user