]> git.saurik.com Git - wxWidgets.git/commitdiff
Avoided rounding errors in font point size calculations
authorJulian Smart <julian@anthemion.co.uk>
Tue, 18 Jan 2000 17:06:44 +0000 (17:06 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Tue, 18 Jan 2000 17:06:44 +0000 (17:06 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@5502 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/generic/proplist.cpp
src/msw/fontutil.cpp

index 6acfe87f882ba162d0b87e4ce05efb9124e583b0..399a81944929a27a75a37a0e43091f091bed7217 100644 (file)
@@ -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
index 6d80870a2231d942285efa24643d21e06d15af30..92332ba22a5d4c232790e0a0d2cd6f6ac814c849 100644 (file)
@@ -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);