Add wxNativeFontInfo::GetPointSizeFromLogFontHeight() helper

No real changes, just refactor the code previously present in both
wxNativeFontInfo ctor and SetPixelSize() in a single function and reuse
it in both places.
This commit is contained in:
Vadim Zeitlin
2019-07-16 14:33:36 +02:00
parent 8ab9fed14e
commit 5507f8eebc
2 changed files with 12 additions and 6 deletions

View File

@@ -118,7 +118,14 @@ public:
// set the XFLD
void SetXFontName(const wxString& xFontName);
#elif defined(__WXMSW__)
wxNativeFontInfo(const LOGFONT& lf_);
wxNativeFontInfo(const LOGFONT& lf_)
: lf(lf_),
pointSize(GetPointSizeFromLogFontHeight(lf.lfHeight))
{
}
// MSW-specific: get point size from LOGFONT height using the default DPI.
static float GetPointSizeFromLogFontHeight(int height);
// MSW-specific: get the height value in pixels using LOGFONT convention
// (i.e. negative) corresponding to the given size in points and DPI.