]> git.saurik.com Git - wxWidgets.git/commitdiff
Fix the size of the font returned by wxTextCtrl::GetStyle() in MSW.
authorVadim Zeitlin <vadim@wxwidgets.org>
Tue, 27 Dec 2011 01:21:33 +0000 (01:21 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Tue, 27 Dec 2011 01:21:33 +0000 (01:21 +0000)
CHARFORMAT stores height in 1/20th of a point, not pixels. Add the correct
conversion to the units used by LOGFONT.

See #13384.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70122 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/msw/textctrl.cpp

index 4792c8de81208969ee4a5abaa8e67205dd5f37b4..c963a170b35e2333a29be145e8fbcb06df70fab5 100644 (file)
@@ -2740,7 +2740,10 @@ bool wxTextCtrl::GetStyle(long position, wxTextAttr& style)
 
 
     LOGFONT lf;
-    lf.lfHeight = cf.yHeight;
+    // Convert the height from the units of 1/20th of the point in which
+    // CHARFORMAT stores it to pixel-based units used by LOGFONT.
+    const wxCoord ppi = wxClientDC(this).GetPPI().y;
+    lf.lfHeight = -MulDiv(cf.yHeight/2, ppi, 72);
     lf.lfWidth = 0;
     lf.lfCharSet = ANSI_CHARSET; // FIXME: how to get correct charset?
     lf.lfClipPrecision = 0;