SetPixelSize(pixelSize);
}
+ wxFont(int pointSize,
+ wxFontFamily family,
+ int flags = wxFONTFLAG_DEFAULT,
+ const wxString& face = wxEmptyString,
+ wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
+ {
+ Create(pointSize, family,
+ GetStyleFromFlags(flags),
+ GetWeightFromFlags(flags),
+ GetUnderlinedFromFlags(flags),
+ face, encoding);
+ }
+
/*! @abstract Construction with opaque wxNativeFontInfo
*/
wxFont(const wxNativeFontInfo& info)
SetPixelSize(pixelSize);
}
+ wxFont(int pointSize,
+ wxFontFamily family,
+ int flags = wxFONTFLAG_DEFAULT,
+ const wxString& face = wxEmptyString,
+ wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
+ {
+ Create(pointSize, family,
+ GetStyleFromFlags(flags),
+ GetWeightFromFlags(flags),
+ GetUnderlinedFromFlags(flags),
+ face, encoding);
+ }
+
bool Create(int size,
wxFontFamily family,
wxFontStyle style,
// wxFONTFAMILY_UNKNOWN unlike the public method (see comment there).
virtual wxFontFamily DoGetFamily() const = 0;
+
+ // Helper functions to recover wxFONTSTYLE/wxFONTWEIGHT and underlined flg
+ // values from flags containing a combination of wxFONTFLAG_XXX.
+ static wxFontStyle GetStyleFromFlags(int flags)
+ {
+ return flags & wxFONTFLAG_ITALIC
+ ? wxFONTSTYLE_ITALIC
+ : flags & wxFONTFLAG_SLANT
+ ? wxFONTSTYLE_SLANT
+ : wxFONTSTYLE_NORMAL;
+ }
+
+ static wxFontWeight GetWeightFromFlags(int flags)
+ {
+ return flags & wxFONTFLAG_LIGHT
+ ? wxFONTWEIGHT_LIGHT
+ : flags & wxFONTFLAG_BOLD
+ ? wxFONTWEIGHT_BOLD
+ : wxFONTWEIGHT_NORMAL;
+ }
+
+ static bool GetUnderlinedFromFlags(int flags)
+ {
+ return (flags & wxFONTFLAG_UNDERLINED) != 0;
+ }
+
+
private:
// the currently default encoding: by default, it's the default system
// encoding, but may be changed by the application using
SetPixelSize(pixelSize);
}
+ wxFont(int pointSize,
+ wxFontFamily family,
+ int flags = wxFONTFLAG_DEFAULT,
+ const wxString& face = wxEmptyString,
+ wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
+
bool Create(int size,
wxFontFamily family,
wxFontStyle style,
SetPixelSize(pixelSize);
}
+ wxFont(int pointSize,
+ wxFontFamily family,
+ int flags = wxFONTFLAG_DEFAULT,
+ const wxString& face = wxEmptyString,
+ wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
+ {
+ Create(pointSize, family,
+ GetStyleFromFlags(flags),
+ GetWeightFromFlags(flags),
+ GetUnderlinedFromFlags(flags),
+ face, encoding);
+ }
+
bool Create(int size,
wxFontFamily family,
wxFontStyle style,
SetPixelSize(pixelSize);
}
+ wxFont(int pointSize,
+ wxFontFamily family,
+ int flags = wxFONTFLAG_DEFAULT,
+ const wxString& face = wxEmptyString,
+ wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
+ {
+ Create(pointSize, family,
+ GetStyleFromFlags(flags),
+ GetWeightFromFlags(flags),
+ GetUnderlinedFromFlags(flags),
+ face, encoding);
+ }
+
bool Create(int size,
wxFontFamily family,
wxFontStyle style,
Create(info, hFont);
}
+ wxFont(int pointSize,
+ wxFontFamily family,
+ int flags = wxFONTFLAG_DEFAULT,
+ const wxString& face = wxEmptyString,
+ wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
+
wxFont(const wxString& fontDesc);
SetPixelSize(pixelSize);
}
+ wxFont(int pointSize,
+ wxFontFamily family,
+ int flags = wxFONTFLAG_DEFAULT,
+ const wxString& face = wxEmptyString,
+ wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
+ {
+ Create(pointSize, family,
+ GetStyleFromFlags(flags),
+ GetWeightFromFlags(flags),
+ GetUnderlinedFromFlags(flags),
+ face, encoding);
+ }
+
bool Create(int size,
wxFontFamily family,
wxFontStyle style,
SetPixelSize(pixelSize);
}
+ wxFont(int pointSize,
+ wxFontFamily family,
+ int flags = wxFONTFLAG_DEFAULT,
+ const wxString& face = wxEmptyString,
+ wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
+ {
+ Create(pointSize, family,
+ GetStyleFromFlags(flags),
+ GetWeightFromFlags(flags),
+ GetUnderlinedFromFlags(flags),
+ face, encoding);
+ }
+
bool Create(int size,
wxFontFamily family,
wxFontStyle style,
SetPixelSize(pixelSize);
}
+ wxFont(int pointSize,
+ wxFontFamily family,
+ int flags = wxFONTFLAG_DEFAULT,
+ const wxString& face = wxEmptyString,
+ wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
+ {
+ Create(pointSize, family,
+ GetStyleFromFlags(flags),
+ GetWeightFromFlags(flags),
+ GetUnderlinedFromFlags(flags),
+ face, encoding);
+ }
+
bool Create(int size,
wxFontFamily family,
wxFontStyle style,
wxFont(const wxFont& font);
/**
- Creates a font object with the specified attributes.
+ Creates a font object with the specified attributes and size in points.
@param pointSize
Size in points. See SetPointSize() for more info.
wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
/**
- Creates a font object with the specified attributes.
+ Creates a font object with the specified attributes and size in pixels.
@param pixelSize
Size in pixels. See SetPixelSize() for more info.
const wxString& faceName = wxEmptyString,
wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
+ /**
+ Creates a font object using font flags.
+
+ This constructor is similar to the constructors above except it
+ specifies the font styles such as underlined, italic, bold, ... in a
+ single @a flags argument instead of using separate arguments for them.
+ This parameter can be a combination of ::wxFontFlag enum elements.
+ The meaning of the remaining arguments is the same as in the other
+ constructors, please see their documentation for details.
+
+ @since 2.9.4
+ */
+ wxFont(int pointSize, wxFontFamily family, int flags,
+ const wxString& faceName = wxEmptyString,
+ wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
+
/**
Constructor from font description string.
// implementation
// ============================================================================
-// ----------------------------------------------------------------------------
-// helper functions
-// ----------------------------------------------------------------------------
-
-static inline int flags2Style(int flags)
-{
- return flags & wxFONTFLAG_ITALIC
- ? wxFONTSTYLE_ITALIC
- : flags & wxFONTFLAG_SLANT
- ? wxFONTSTYLE_SLANT
- : wxFONTSTYLE_NORMAL;
-}
-
-static inline int flags2Weight(int flags)
-{
- return flags & wxFONTFLAG_LIGHT
- ? wxFONTWEIGHT_LIGHT
- : flags & wxFONTFLAG_BOLD
- ? wxFONTWEIGHT_BOLD
- : wxFONTWEIGHT_NORMAL;
-}
-
-static inline bool flags2Underlined(int flags)
-{
- return (flags & wxFONTFLAG_UNDERLINED) != 0;
-}
-
// ----------------------------------------------------------------------------
// wxFontBase
// ----------------------------------------------------------------------------
const wxString& face,
wxFontEncoding encoding)
{
- return New(pointSize, family, flags2Style(flags), flags2Weight(flags),
- flags2Underlined(flags), face, encoding);
+ return New(pointSize, family,
+ GetStyleFromFlags(flags),
+ GetWeightFromFlags(flags),
+ GetUnderlinedFromFlags(flags),
+ face, encoding);
}
/* static */
const wxString& face,
wxFontEncoding encoding)
{
- return New(pixelSize, family, flags2Style(flags), flags2Weight(flags),
- flags2Underlined(flags), face, encoding);
+ return New(pixelSize, family,
+ GetStyleFromFlags(flags),
+ GetWeightFromFlags(flags),
+ GetUnderlinedFromFlags(flags),
+ face, encoding);
}
/* static */
info.GetEncoding() );
}
+wxFont::wxFont(int pointSize,
+ wxFontFamily family,
+ int flags,
+ const wxString& face,
+ wxFontEncoding encoding)
+{
+ m_refData = new wxFontRefData(pointSize, family,
+ GetStyleFromFlags(flags),
+ GetWeightFromFlags(flags),
+ GetUnderlinedFromFlags(flags),
+ face, encoding);
+}
+
bool wxFont::Create( int pointSize,
wxFontFamily family,
wxFontStyle style,
(void)Create(info);
}
+wxFont::wxFont(int pointSize,
+ wxFontFamily family,
+ int flags,
+ const wxString& face,
+ wxFontEncoding encoding)
+{
+ m_refData = new wxFontRefData(pointSize, wxDefaultSize, false,
+ family,
+ GetStyleFromFlags(flags),
+ GetWeightFromFlags(flags),
+ GetUnderlinedFromFlags(flags),
+ face, encoding);
+}
+
bool wxFont::Create(const wxNativeFontInfo& info, WXHFONT hFont)
{
UnRef();