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:
@@ -66,6 +66,18 @@ enum wxFontWeight
|
||||
wxFONTWEIGHT_MAX
|
||||
};
|
||||
|
||||
// Symbolic font sizes as defined in CSS specification.
|
||||
enum wxFontSymbolicSize
|
||||
{
|
||||
wxFONTSIZE_XX_SMALL = -3,
|
||||
wxFONTSIZE_X_SMALL,
|
||||
wxFONTSIZE_SMALL,
|
||||
wxFONTSIZE_MEDIUM,
|
||||
wxFONTSIZE_LARGE,
|
||||
wxFONTSIZE_X_LARGE,
|
||||
wxFONTSIZE_XX_LARGE
|
||||
};
|
||||
|
||||
// the font flag bits for the new font ctor accepting one combined flags word
|
||||
enum wxFontFlag
|
||||
{
|
||||
@@ -240,6 +252,19 @@ public:
|
||||
bool SetNativeFontInfo(const wxString& info);
|
||||
bool SetNativeFontInfoUserDesc(const wxString& info);
|
||||
|
||||
// Symbolic font sizes support: set the font size to "large" or "very
|
||||
// small" either absolutely (i.e. compared to the default font size) or
|
||||
// relatively to the given font size.
|
||||
void SetSymbolicSize(wxFontSymbolicSize size);
|
||||
void SetSymbolicSizeRelativeTo(wxFontSymbolicSize size, int base)
|
||||
{
|
||||
SetPointSize(AdjustToSymbolicSize(size, base));
|
||||
}
|
||||
|
||||
// Adjust the base size in points according to symbolic size.
|
||||
static int AdjustToSymbolicSize(wxFontSymbolicSize size, int base);
|
||||
|
||||
|
||||
// translate the fonts into human-readable string (i.e. GetStyleString()
|
||||
// will return "wxITALIC" for an italic font, ...)
|
||||
wxString GetFamilyString() const;
|
||||
|
Reference in New Issue
Block a user