Add wxDC::GetFontMetrics() and implement it for wxMSW.
Add a new wxDC method allowing to retrieve the font characteristics not available from GetTextExtent(), notably the internal leading (and also the average font width). Currently this is implemented for wxMSW only, the internal leading is always 0 in the other ports. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67063 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -79,6 +79,28 @@ enum wxMappingMode
|
||||
wxMM_POINTS
|
||||
};
|
||||
|
||||
/**
|
||||
Simple collection of various font metrics.
|
||||
|
||||
This object is returned by wxDC::GetFontMetrics().
|
||||
|
||||
@since 2.9.2
|
||||
|
||||
@library{wxcore}
|
||||
@category{dc,gdi}
|
||||
*/
|
||||
struct wxFontMetrics
|
||||
{
|
||||
/// Constructor initializes all fields to 0.
|
||||
wxFontMetrics();
|
||||
|
||||
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".
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
@@ -773,6 +795,21 @@ public:
|
||||
*/
|
||||
wxCoord GetCharWidth() const;
|
||||
|
||||
/**
|
||||
Returns the various font characteristics.
|
||||
|
||||
This method allows to retrieve some of the font characteristics not
|
||||
returned by GetTextExtent(), notably internal leading and average
|
||||
character width.
|
||||
|
||||
Currently this method returns correct results only under wxMSW, in the
|
||||
other ports the internal leading will always be 0 and the average
|
||||
character width will be computed as the width of the character 'x'.
|
||||
|
||||
@since 2.9.2
|
||||
*/
|
||||
wxFontMetrics GetFontMetrics() const;
|
||||
|
||||
/**
|
||||
Gets the dimensions of the string using the currently selected font.
|
||||
@a string is the text string to measure, @e heightLine, if non @NULL,
|
||||
|
Reference in New Issue
Block a user