]> git.saurik.com Git - wxWidgets.git/blobdiff - include/wx/dc.h
bracket unused function
[wxWidgets.git] / include / wx / dc.h
index aa6b39e26065cab026d5a82d1a02f04939b04257..a06217ab45365a51eb772427f9c0bcc31d72a893 100644 (file)
@@ -114,6 +114,27 @@ enum wxMappingMode
     wxMM_POINTS
 };
 
+// Description of text characteristics.
+struct wxFontMetrics
+{
+    wxFontMetrics()
+    {
+        height =
+        ascent =
+        descent =
+        internalLeading =
+        externalLeading =
+        averageWidth = 0;
+    }
+
+    int height,             // Total character height.
+        ascent,             // Part of the height above the baseline.
+        descent,            // Part of the height below the baseline.
+        internalLeading,    // Intra-line spacing.
+        externalLeading,    // Inter-line spacing.
+        averageWidth;       // Average font width, a.k.a. "x-width".
+};
+
 #if WXWIN_COMPATIBILITY_2_8
 
 //-----------------------------------------------------------------------------
@@ -375,6 +396,18 @@ public:
 
     virtual wxCoord GetCharHeight() const = 0;
     virtual wxCoord GetCharWidth() const = 0;
+
+    // The derived classes should really override DoGetFontMetrics() to return
+    // the correct values in the future but for now provide a default
+    // implementation in terms of DoGetTextExtent() to avoid breaking the
+    // compilation of all other ports as wxMSW is the only one to implement it.
+    virtual void DoGetFontMetrics(int *height,
+                                  int *ascent,
+                                  int *descent,
+                                  int *internalLeading,
+                                  int *externalLeading,
+                                  int *averageWidth) const;
+
     virtual void DoGetTextExtent(const wxString& string,
                                  wxCoord *x, wxCoord *y,
                                  wxCoord *descent = NULL,
@@ -840,6 +873,15 @@ public:
     wxCoord GetCharWidth() const
         { return m_pimpl->GetCharWidth(); }
 
+    wxFontMetrics GetFontMetrics() const
+    {
+        wxFontMetrics fm;
+        m_pimpl->DoGetFontMetrics(&fm.height, &fm.ascent, &fm.descent,
+                                  &fm.internalLeading, &fm.externalLeading,
+                                  &fm.averageWidth);
+        return fm;
+    }
+
     void GetTextExtent(const wxString& string,
                        wxCoord *x, wxCoord *y,
                        wxCoord *descent = NULL,