Remove Mac-specific wxFont ctors and fix strikethrough support
Only accept fractional point sizes and numeric weights via wxFont ctor using wxFontInfo and avoid having specific ctor/Create() overloads for the different combinations of font properties: this is not portable (as these ctors don't exist in the other ports) and unsustainable due to the very real potential of combinatorial explosion as more properties are added. As a side-effect, fix support for stricken-through fonts under Mac, which was broken, by adding the missing wxFontInfo::IsStrikethrough() call.
This commit is contained in:
@@ -56,17 +56,6 @@ public:
|
|||||||
Create(size, family, style, weight, underlined, face, encoding);
|
Create(size, family, style, weight, underlined, face, encoding);
|
||||||
}
|
}
|
||||||
|
|
||||||
wxFont(float size,
|
|
||||||
wxFontFamily family,
|
|
||||||
wxFontStyle style,
|
|
||||||
int weight,
|
|
||||||
bool underlined = false,
|
|
||||||
const wxString& face = wxEmptyString,
|
|
||||||
wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
|
|
||||||
{
|
|
||||||
Create(size, family, style, weight, underlined, face, encoding);
|
|
||||||
}
|
|
||||||
|
|
||||||
wxFont(const wxSize& pixelSize,
|
wxFont(const wxSize& pixelSize,
|
||||||
wxFontFamily family,
|
wxFontFamily family,
|
||||||
wxFontStyle style,
|
wxFontStyle style,
|
||||||
@@ -87,14 +76,6 @@ public:
|
|||||||
const wxString& face = wxEmptyString,
|
const wxString& face = wxEmptyString,
|
||||||
wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
|
wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
|
||||||
|
|
||||||
bool Create(float size,
|
|
||||||
wxFontFamily family,
|
|
||||||
wxFontStyle style,
|
|
||||||
int weight,
|
|
||||||
bool underlined = false,
|
|
||||||
const wxString& face = wxEmptyString,
|
|
||||||
wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
|
|
||||||
|
|
||||||
wxFont(const wxNativeFontInfo& info)
|
wxFont(const wxNativeFontInfo& info)
|
||||||
{
|
{
|
||||||
(void)Create(info);
|
(void)Create(info);
|
||||||
|
@@ -542,13 +542,17 @@ wxFont::wxFont(const wxString& fontdesc)
|
|||||||
|
|
||||||
wxFont::wxFont(const wxFontInfo& info)
|
wxFont::wxFont(const wxFontInfo& info)
|
||||||
{
|
{
|
||||||
Create(info.GetFractionalPointSize(),
|
m_refData = new wxFontRefData
|
||||||
info.GetFamily(),
|
(
|
||||||
info.GetStyle(),
|
info.GetFractionalPointSize(),
|
||||||
info.GetNumericWeight(),
|
info.GetFamily(),
|
||||||
info.IsUnderlined(),
|
info.GetStyle(),
|
||||||
info.GetFaceName(),
|
info.GetNumericWeight(),
|
||||||
info.GetEncoding());
|
info.IsUnderlined(),
|
||||||
|
info.IsStrikethrough(),
|
||||||
|
info.GetFaceName(),
|
||||||
|
info.GetEncoding()
|
||||||
|
);
|
||||||
|
|
||||||
if ( info.IsUsingSizeInPixels() )
|
if ( info.IsUsingSizeInPixels() )
|
||||||
SetPixelSize(info.GetPixelSize());
|
SetPixelSize(info.GetPixelSize());
|
||||||
@@ -566,22 +570,6 @@ wxFont::wxFont(int size,
|
|||||||
(wxFontWeight)weight, underlined, face, encoding);
|
(wxFontWeight)weight, underlined, face, encoding);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxFont::Create(float pointSize,
|
|
||||||
wxFontFamily family,
|
|
||||||
wxFontStyle style,
|
|
||||||
int weight,
|
|
||||||
bool underlined,
|
|
||||||
const wxString& faceName,
|
|
||||||
wxFontEncoding encoding)
|
|
||||||
{
|
|
||||||
UnRef();
|
|
||||||
|
|
||||||
m_refData = new wxFontRefData(pointSize, family, style, weight,
|
|
||||||
underlined, false, faceName, encoding);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool wxFont::Create(int pointSize,
|
bool wxFont::Create(int pointSize,
|
||||||
wxFontFamily family,
|
wxFontFamily family,
|
||||||
wxFontStyle style,
|
wxFontStyle style,
|
||||||
@@ -592,10 +580,14 @@ bool wxFont::Create(int pointSize,
|
|||||||
{
|
{
|
||||||
AccountForCompatValues(pointSize, style, weight);
|
AccountForCompatValues(pointSize, style, weight);
|
||||||
|
|
||||||
return Create(wxFontInfo::ToFloatPointSize(pointSize),
|
m_refData = new wxFontRefData
|
||||||
family, style,
|
(
|
||||||
GetNumericWeightOf(weight),
|
wxFontInfo::ToFloatPointSize(pointSize),
|
||||||
underlined, faceName, encoding);
|
family, style,
|
||||||
|
GetNumericWeightOf(weight),
|
||||||
|
underlined, false, faceName, encoding
|
||||||
|
);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxFont::~wxFont()
|
wxFont::~wxFont()
|
||||||
|
Reference in New Issue
Block a user