Fix wxDFB build after the font changes

Implement the new wxFont pure virtual methods in this port version of
this class.

Neither arbitrary weights nor fractional point sizes are actually
supported in this port however.
This commit is contained in:
Vadim Zeitlin
2018-09-07 02:30:52 +02:00
parent 1f95a041e9
commit 4e0b4e5939
4 changed files with 30 additions and 24 deletions

View File

@@ -72,19 +72,19 @@ public:
bool Create(const wxNativeFontInfo& fontinfo);
// implement base class pure virtuals
virtual int GetPointSize() const;
virtual float GetFractionalPointSize() const;
virtual wxFontStyle GetStyle() const;
virtual wxFontWeight GetWeight() const;
virtual int GetNumericWeight() const;
virtual wxString GetFaceName() const;
virtual bool GetUnderlined() const;
virtual wxFontEncoding GetEncoding() const;
virtual bool IsFixedWidth() const;
virtual const wxNativeFontInfo *GetNativeFontInfo() const;
virtual void SetPointSize(int pointSize);
virtual void SetFractionalPointSize(float pointSize);
virtual void SetFamily(wxFontFamily family);
virtual void SetStyle(wxFontStyle style);
virtual void SetWeight(wxFontWeight weight);
virtual void SetNumericWeight(int weight);
virtual bool SetFaceName(const wxString& faceName);
virtual void SetUnderlined(bool underlined);
virtual void SetEncoding(wxFontEncoding encoding);

View File

@@ -204,7 +204,7 @@ public:
wxFontMgrFontRefData(int size = wxDEFAULT,
wxFontFamily family = wxFONTFAMILY_DEFAULT,
wxFontStyle style = wxFONTSTYLE_NORMAL,
wxFontWeight weight = wxFONTWEIGHT_NORMAL,
int weight = wxFONTWEIGHT_NORMAL,
bool underlined = false,
const wxString& faceName = wxEmptyString,
wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
@@ -218,18 +218,18 @@ public:
const wxNativeFontInfo *GetNativeFontInfo() const { return &m_info; }
int GetPointSize() const { return m_info.pointSize; }
float GetFractionalPointSize() const { return m_info.pointSize; }
wxString GetFaceName() const { return m_info.faceName; }
wxFontFamily GetFamily() const { return m_info.family; }
wxFontStyle GetStyle() const { return m_info.style; }
wxFontWeight GetWeight() const { return m_info.weight; }
int GetNumericWeight() const { return m_info.weight; }
bool GetUnderlined() const { return m_info.underlined; }
wxFontEncoding GetEncoding() const { return m_info.encoding; }
void SetPointSize(int pointSize);
void SetFractionalPointSize(float pointSize);
void SetFamily(wxFontFamily family);
void SetStyle(wxFontStyle style);
void SetWeight(wxFontWeight weight);
void SetNumericWeight(int weight);
void SetFaceName(const wxString& faceName);
void SetUnderlined(bool underlined);
void SetEncoding(wxFontEncoding encoding);

View File

@@ -118,7 +118,7 @@ wxFontBundleBase::GetFaceForFont(const wxFontMgrFontRefData& font) const
int type = FaceType_Regular;
if ( font.GetWeight() == wxFONTWEIGHT_BOLD )
if ( font.GetNumericWeight() >= wxFONTWEIGHT_BOLD )
type |= FaceType_Bold;
// FIXME -- this should read "if ( font->GetStyle() == wxFONTSTYLE_ITALIC )",
@@ -227,7 +227,7 @@ void wxFontsManagerBase::AddBundle(wxFontBundle *bundle)
wxFontMgrFontRefData::wxFontMgrFontRefData(int size,
wxFontFamily family,
wxFontStyle style,
wxFontWeight weight,
int weight,
bool underlined,
const wxString& faceName,
wxFontEncoding encoding)
@@ -240,7 +240,7 @@ wxFontMgrFontRefData::wxFontMgrFontRefData(int size,
m_info.family = (wxFontFamily)family;
m_info.faceName = faceName;
m_info.style = (wxFontStyle)style;
m_info.weight = (wxFontWeight)weight;
m_info.weight = weight;
m_info.pointSize = size;
m_info.underlined = underlined;
m_info.encoding = encoding;
@@ -281,7 +281,7 @@ wxFontMgrFontRefData::GetFontInstance(float scale, bool antialiased) const
antialiased);
}
void wxFontMgrFontRefData::SetPointSize(int pointSize)
void wxFontMgrFontRefData::SetFractionalPointSize(float pointSize)
{
m_info.pointSize = pointSize;
m_fontValid = false;
@@ -299,7 +299,7 @@ void wxFontMgrFontRefData::SetStyle(wxFontStyle style)
m_fontValid = false;
}
void wxFontMgrFontRefData::SetWeight(wxFontWeight weight)
void wxFontMgrFontRefData::SetNumericWeight(int weight)
{
m_info.weight = weight;
m_fontValid = false;

View File

@@ -40,8 +40,14 @@ typedef wxFontMgrFontRefData wxFontRefData;
bool wxFont::Create(const wxNativeFontInfo& info)
{
return Create(info.pointSize, info.family, info.style, info.weight,
info.underlined, info.faceName, info.encoding);
m_refData = new wxFontRefData(info.pointSize,
info.family,
info.style,
info.weight,
info.underlined,
info.faceName,
info.encoding);
return true;
}
bool wxFont::Create(int pointSize,
@@ -81,11 +87,11 @@ wxIDirectFBFontPtr wxFont::GetDirectFBFont(bool antialiased) const
return i ? i->GetDirectFBFont() : wxIDirectFBFontPtr();
}
int wxFont::GetPointSize() const
float wxFont::GetFractionalPointSize() const
{
wxCHECK_MSG( IsOk(), 0, wxT("invalid font") );
return M_FONTDATA->GetPointSize();
return M_FONTDATA->GetFractionalPointSize();
}
wxString wxFont::GetFaceName() const
@@ -107,11 +113,11 @@ wxFontStyle wxFont::GetStyle() const
return M_FONTDATA->GetStyle();
}
wxFontWeight wxFont::GetWeight() const
int wxFont::GetNumericWeight() const
{
wxCHECK_MSG( IsOk(), wxFONTWEIGHT_MAX, wxT("invalid font") );
return M_FONTDATA->GetWeight();
return M_FONTDATA->GetNumericWeight();
}
bool wxFont::GetUnderlined() const
@@ -147,10 +153,10 @@ const wxNativeFontInfo *wxFont::GetNativeFontInfo() const
// change font attributes
// ----------------------------------------------------------------------------
void wxFont::SetPointSize(int pointSize)
void wxFont::SetFractionalPointSize(float pointSize)
{
AllocExclusive();
M_FONTDATA->SetPointSize(pointSize);
M_FONTDATA->SetFractionalPointSize(pointSize);
}
void wxFont::SetFamily(wxFontFamily family)
@@ -165,10 +171,10 @@ void wxFont::SetStyle(wxFontStyle style)
M_FONTDATA->SetStyle(style);
}
void wxFont::SetWeight(wxFontWeight weight)
void wxFont::SetNumericWeight(int weight)
{
AllocExclusive();
M_FONTDATA->SetWeight(weight);
M_FONTDATA->SetNumericWeight(weight);
}
bool wxFont::SetFaceName(const wxString& faceName)