]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk1/dcclient.cpp
DP: Just came back from 3 days fishing and found that forget to commit some
[wxWidgets.git] / src / gtk1 / dcclient.cpp
index e75db15ce07048088a3dc44bb14d097890f103fe..e8473c5318d97c77c4d6e9c6f37fc9f22318e9be 100644 (file)
@@ -552,22 +552,25 @@ void wxPaintDC::DrawText( const wxString &text, long x, long y, bool WXUNUSED(us
   }
 }
 
-
-
 bool wxPaintDC::CanGetTextExtent(void) const
 {
   return TRUE;
 }
 
 void wxPaintDC::GetTextExtent( const wxString &string, long *width, long *height,
-                     long *WXUNUSED(descent), long *WXUNUSED(externalLeading),
-                     wxFont *WXUNUSED(theFont), bool WXUNUSED(use16) )
+                     long *descent, long *externalLeading,
+                     wxFont *theFont, bool WXUNUSED(use16) )
 {
   if (!Ok()) return;
   
-  GdkFont *font = m_font.GetInternalFont( m_scaleY );
+  wxFont fontToUse = m_font;
+  if (theFont) fontToUse = *theFont;
+  
+  GdkFont *font = fontToUse.GetInternalFont( m_scaleY );
   if (width) (*width) = long(gdk_string_width( font, string ) / m_scaleX);
   if (height) (*height) = long((font->ascent + font->descent) / m_scaleY);
+  if (descent) (*descent) = long(font->descent / m_scaleY);
+  if (externalLeading) (*externalLeading) = 0;  // ??
 }
 
 long wxPaintDC::GetCharWidth(void)
@@ -575,7 +578,7 @@ long wxPaintDC::GetCharWidth(void)
   if (!Ok()) return 0;
   
   GdkFont *font = m_font.GetInternalFont( m_scaleY );
-  return gdk_string_width( font, "H" );
+  return long(gdk_string_width( font, "H" ) / m_scaleX);
 }
 
 long wxPaintDC::GetCharHeight(void)
@@ -583,7 +586,7 @@ long wxPaintDC::GetCharHeight(void)
   if (!Ok()) return 0;
   
   GdkFont *font = m_font.GetInternalFont( m_scaleY );
-  return font->ascent + font->descent;
+  return long((font->ascent + font->descent) / m_scaleY);
 }
 
 void wxPaintDC::Clear(void)