Avoided rounding errors in font point size calculations
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@5502 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
b0c5c42156
commit
bf027a6daa
@ -433,7 +433,7 @@ bool wxPropertyListView::CreateControls()
|
||||
wxFont guiFont = settings.GetSystemFont(wxSYS_DEFAULT_GUI_FONT);
|
||||
|
||||
#ifdef __WXMSW__
|
||||
wxFont *boringFont = wxTheFontList->FindOrCreateFont(guiFont.GetPointSize()+1, wxMODERN, wxNORMAL, wxNORMAL, FALSE, "Courier New");
|
||||
wxFont *boringFont = wxTheFontList->FindOrCreateFont(guiFont.GetPointSize(), wxMODERN, wxNORMAL, wxNORMAL, FALSE, "Courier New");
|
||||
#else
|
||||
wxFont *boringFont = wxTheFontList->FindOrCreateFont(guiFont.GetPointSize(), wxTELETYPE, wxNORMAL, wxNORMAL);
|
||||
#endif
|
||||
|
@ -286,7 +286,8 @@ void wxFillLogFont(LOGFONT *logFont, const wxFont *font)
|
||||
int nHeight = (font->GetPointSize()*ppInch/72);
|
||||
#else
|
||||
// Correct for Windows compatibility
|
||||
int nHeight = - (font->GetPointSize()*ppInch/72);
|
||||
// int nHeight = - (font->GetPointSize()*ppInch/72);
|
||||
int nHeight = - (int) ( (font->GetPointSize()*((double)ppInch)/72.0) + 0.5);
|
||||
#endif
|
||||
|
||||
wxString facename = font->GetFaceName();
|
||||
@ -396,7 +397,7 @@ wxFont wxCreateFontFromLogFont(const LOGFONT *logFont)
|
||||
|
||||
// remember that 1pt = 1/72inch
|
||||
int height = abs(logFont->lfHeight);
|
||||
int fontPoints = (72*height)/GetDeviceCaps(dc, LOGPIXELSY);
|
||||
int fontPoints = (int) ((72.0*((double)height))/(double) GetDeviceCaps(dc, LOGPIXELSY) + 0.5);
|
||||
|
||||
::ReleaseDC(NULL, dc);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user