Don't use deprecated wxBOLD, wxNORMAL and similar constants.

Replace them with wxFONTWEIGHT_BOLD, wxFONTSTYLE_NORMAL or wxFONTWEIGHT_NORMAL
and equivalents in the code of the library itself and in the samples.

Also simplify font construction using wxFontInfo where possible to avoid
specifying these constants at all if they are not needed.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@75590 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2014-01-11 14:25:30 +00:00
parent 7696081c90
commit d66e7af9aa
21 changed files with 192 additions and 198 deletions

View File

@@ -1041,8 +1041,8 @@ void wxPostScriptDCImpl::SetFont( const wxFont& font )
m_font = font;
int Style = m_font.GetStyle();
int Weight = m_font.GetWeight();
wxFontStyle Style = m_font.GetStyle();
wxFontWeight Weight = m_font.GetWeight();
const char *name;
switch (m_font.GetFamily())
@@ -1050,16 +1050,16 @@ void wxPostScriptDCImpl::SetFont( const wxFont& font )
case wxTELETYPE:
case wxMODERN:
{
if (Style == wxITALIC)
if (Style == wxFONTSTYLE_ITALIC)
{
if (Weight == wxBOLD)
if (Weight == wxFONTWEIGHT_BOLD)
name = "/Courier-BoldOblique";
else
name = "/Courier-Oblique";
}
else
{
if (Weight == wxBOLD)
if (Weight == wxFONTWEIGHT_BOLD)
name = "/Courier-Bold";
else
name = "/Courier";
@@ -1068,16 +1068,16 @@ void wxPostScriptDCImpl::SetFont( const wxFont& font )
}
case wxROMAN:
{
if (Style == wxITALIC)
if (Style == wxFONTSTYLE_ITALIC)
{
if (Weight == wxBOLD)
if (Weight == wxFONTWEIGHT_BOLD)
name = "/Times-BoldItalic";
else
name = "/Times-Italic";
}
else
{
if (Weight == wxBOLD)
if (Weight == wxFONTWEIGHT_BOLD)
name = "/Times-Bold";
else
name = "/Times-Roman";
@@ -1092,16 +1092,16 @@ void wxPostScriptDCImpl::SetFont( const wxFont& font )
case wxSWISS:
default:
{
if (Style == wxITALIC)
if (Style == wxFONTSTYLE_ITALIC)
{
if (Weight == wxBOLD)
if (Weight == wxFONTWEIGHT_BOLD)
name = "/Helvetica-BoldOblique";
else
name = "/Helvetica-Oblique";
}
else
{
if (Weight == wxBOLD)
if (Weight == wxFONTWEIGHT_BOLD)
name = "/Helvetica-Bold";
else
name = "/Helvetica";
@@ -2092,7 +2092,7 @@ void wxPostScriptDCImpl::DoGetTextExtent(const wxString& string,
/ dc.StartDoc("Test");
/ dc.StartPage();
/ wxCoord w,h;
/ dc.SetFont(new wxFont(10, wxROMAN, wxNORMAL, wxNORMAL));
/ dc.SetFont(new wxFontInfo(10).Family(wxFONTFAMILY_ROMAN));
/ dc.GetTextExtent("Hallo",&w,&h);
/ dc.EndPage();
/ dc.EndDoc();
@@ -2135,17 +2135,17 @@ void wxPostScriptDCImpl::DoGetTextExtent(const wxString& string,
case wxMODERN:
case wxTELETYPE:
{
if ((Style == wxITALIC) && (Weight == wxBOLD)) name = wxT("CourBoO.afm");
else if ((Style != wxITALIC) && (Weight == wxBOLD)) name = wxT("CourBo.afm");
else if ((Style == wxITALIC) && (Weight != wxBOLD)) name = wxT("CourO.afm");
if ((Style == wxFONTSTYLE_ITALIC) && (Weight == wxFONTWEIGHT_BOLD)) name = wxT("CourBoO.afm");
else if ((Style != wxFONTSTYLE_ITALIC) && (Weight == wxFONTWEIGHT_BOLD)) name = wxT("CourBo.afm");
else if ((Style == wxFONTSTYLE_ITALIC) && (Weight != wxFONTWEIGHT_BOLD)) name = wxT("CourO.afm");
else name = wxT("Cour.afm");
break;
}
case wxROMAN:
{
if ((Style == wxITALIC) && (Weight == wxBOLD)) name = wxT("TimesBoO.afm");
else if ((Style != wxITALIC) && (Weight == wxBOLD)) name = wxT("TimesBo.afm");
else if ((Style == wxITALIC) && (Weight != wxBOLD)) name = wxT("TimesO.afm");
if ((Style == wxFONTSTYLE_ITALIC) && (Weight == wxFONTWEIGHT_BOLD)) name = wxT("TimesBoO.afm");
else if ((Style != wxFONTSTYLE_ITALIC) && (Weight == wxFONTWEIGHT_BOLD)) name = wxT("TimesBo.afm");
else if ((Style == wxFONTSTYLE_ITALIC) && (Weight != wxFONTWEIGHT_BOLD)) name = wxT("TimesO.afm");
else name = wxT("TimesRo.afm");
break;
}
@@ -2157,9 +2157,9 @@ void wxPostScriptDCImpl::DoGetTextExtent(const wxString& string,
case wxSWISS:
default:
{
if ((Style == wxITALIC) && (Weight == wxBOLD)) name = wxT("HelvBoO.afm");
else if ((Style != wxITALIC) && (Weight == wxBOLD)) name = wxT("HelvBo.afm");
else if ((Style == wxITALIC) && (Weight != wxBOLD)) name = wxT("HelvO.afm");
if ((Style == wxFONTSTYLE_ITALIC) && (Weight == wxFONTWEIGHT_BOLD)) name = wxT("HelvBoO.afm");
else if ((Style != wxFONTSTYLE_ITALIC) && (Weight == wxFONTWEIGHT_BOLD)) name = wxT("HelvBo.afm");
else if ((Style == wxFONTSTYLE_ITALIC) && (Weight != wxFONTWEIGHT_BOLD)) name = wxT("HelvO.afm");
else name = wxT("Helv.afm");
break;
}