]> git.saurik.com Git - wxWidgets.git/commitdiff
Draw the underline 1 pixel higher in wxDC::DrawLabel().
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 27 Feb 2011 12:47:55 +0000 (12:47 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 27 Feb 2011 12:47:55 +0000 (12:47 +0000)
Adjust the height of the underline to be compatible with native MSW behaviour.

Notice that in wxGTK we should use pango_font_metrics_get_underline_position()
to get the font-dependent value that should be used here.

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

src/common/dcbase.cpp

index fdb0a2f1b7f6729d4dd9db5591aa3a6e76f17690..dd745d02fb67a6efd13b2842de9ba2e9038683c2 100644 (file)
@@ -1296,7 +1296,14 @@ void wxDC::DrawLabel(const wxString& text,
         // it should be of the same colour as text
         SetPen(wxPen(GetTextForeground(), 0, wxPENSTYLE_SOLID));
 
-        yUnderscore--;
+        // This adjustment is relatively arbitrary: we need to draw the
+        // underline slightly higher to avoid overflowing the character cell
+        // but whether we should do it 1, 2 or 3 pixels higher is not clear.
+        //
+        // The currently used value seems to be compatible with native MSW
+        // behaviour, i.e. it results in the same appearance of the owner-drawn
+        // and normal labels.
+        yUnderscore -= 2;
 
         DrawLine(startUnderscore, yUnderscore, endUnderscore, yUnderscore);
     }