Properly round font size

Use MulDiv for proper rounding to nearest integer.

Fixes #1547.
This commit is contained in:
ge0rdi
2023-05-22 19:41:08 +02:00
parent 2130047bd6
commit 9c149334fa
4 changed files with 4 additions and 4 deletions
+1 -1
View File
@@ -920,7 +920,7 @@ HFONT CreateFontSetting( const wchar_t *fontStr, int dpi )
weight=FW_BOLD, bItalic=true;
str=GetToken(str,token,_countof(token),L", \t");
int size=-_wtol(token);
return CreateFont(size*dpi/72,0,0,0,weight,bItalic?1:0,0,0,DEFAULT_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,DEFAULT_PITCH,name);
return CreateFont(MulDiv(size,dpi,72),0,0,0,weight,bItalic?1:0,0,0,DEFAULT_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,DEFAULT_PITCH,name);
}
static UINT WINAPI GetDpiForWindow(HWND hwnd)