More steps towards using wxFontInfo in all ports

Replace AccountForCompatValues() with InfoFromLegacyParams() which
directly constructs wxFontInfo from the old-style parameters, applying
all the compatibility hacks internally.

There are no real changes in this commit, just simplify the code further
and make wxFontInfo more central.
This commit is contained in:
Vadim Zeitlin
2018-09-14 19:26:26 +02:00
parent 7866c293e8
commit 9627798496
9 changed files with 127 additions and 100 deletions

View File

@@ -188,7 +188,6 @@ wxFont::wxFont(const wxSize& pixelSize,
const wxString& face,
wxFontEncoding encoding)
{
m_refData = new wxFontRefData();
Create(pixelSize, family, style, weight, underlined, face, encoding);
}
@@ -200,27 +199,19 @@ wxFont::wxFont(int size,
const wxString& face,
wxFontEncoding encoding)
{
m_refData = new wxFontRefData();
Create(wxSize(0, size), (wxFontFamily)family, (wxFontStyle)style, (wxFontWeight)weight, underlined, face, encoding);
}
bool wxFont::Create(wxSize size, wxFontFamily family, wxFontStyle style,
wxFontWeight weight, bool underlined, const wxString& face,
wxFontEncoding WXUNUSED(encoding) )
wxFontEncoding encoding )
{
int pointSize = size.GetHeight();
AccountForCompatValues(pointSize, style, weight);
UnRef();
if (!face.empty())
M_FONTDATA.SetFaceName(face);
else
M_FONTDATA.SetFamily(family);
M_FONTDATA.SetStyle(style);
M_FONTDATA.SetWeight(weight);
M_FONTDATA.SetUnderlined(underlined);
M_FONTDATA.SetPointSize(pointSize);
m_refData = new wxFontRefData(InfoFromLegacyParams(size.GetHeight(), family,
style, weight, underlined,
face, encoding));
return true;
}