Add wxFont::SetSymbolicSize() and SetSymbolicSizeRelativeTo().

These methods allow to set the font size using CSS-like absolute size
specifications.

Notice that the factors used here are incompatible with (but better than) the
ones used in wxBuildFontSizes() in src/html/winpars.cpp. In the future it
would be nice to reuse the new wxFont functions in wxHTML code.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67052 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2011-02-27 12:47:05 +00:00
parent 801423ee34
commit 19da7aaa9b
4 changed files with 92 additions and 0 deletions

View File

@@ -70,6 +70,27 @@ enum wxFontWeight
wxFONTWEIGHT_MAX
};
/**
Symbolic font sizes.
The elements of this enum correspond to CSS absolute size specifications,
see http://www.w3.org/TR/CSS21/fonts.html#font-size-props
@see wxFont::SetSymbolicSize()
@since 2.9.2
*/
enum wxFontSymbolicSize
{
wxFONTSIZE_XX_SMALL = -3, //!< Extra small.
wxFONTSIZE_X_SMALL, //!< Very small.
wxFONTSIZE_SMALL, //!< Small.
wxFONTSIZE_MEDIUM, //!< Normal.
wxFONTSIZE_LARGE, //!< Large.
wxFONTSIZE_X_LARGE, //!< Very large.
wxFONTSIZE_XX_LARGE //!< Extra large.
};
/**
The font flag bits for the new font ctor accepting one combined flags word.
*/
@@ -791,6 +812,28 @@ public:
*/
virtual void SetStyle(wxFontStyle style);
/**
Sets the font size using a predefined symbolic size name.
This function allows to change font size to be (very) large or small
compared to the standard font size.
@see SetSymbolicSizeRelativeTo().
@since 2.9.2
*/
void SetSymbolicSize(wxFontSymbolicSize size);
/**
Sets the font size compared to the base font size.
This is the same as SetSymbolicSize() except that it uses the given
font size as the normal font size instead of the standard font size.
@since 2.9.2
*/
void SetSymbolicSizeRelativeTo(wxFontSymbolicSize size, int base);
/**
Sets underlining.