Fix wxX11 build after fractional point size changes

Define {Get,Set}FractionalPointSize() in wxX11 wxFont implementation.

Note that only Pango-based version really supports floating point sizes
as XLFD can't express them.
This commit is contained in:
Vadim Zeitlin
2018-09-07 02:09:31 +02:00
parent c98879e379
commit 8955b4b2fb
2 changed files with 12 additions and 12 deletions

View File

@@ -81,7 +81,7 @@ public:
virtual ~wxFont(); virtual ~wxFont();
// implement base class pure virtuals // implement base class pure virtuals
virtual int GetPointSize() const; virtual float GetFractionalPointSize() const;
virtual wxFontStyle GetStyle() const; virtual wxFontStyle GetStyle() const;
virtual int GetNumericWeight() const; virtual int GetNumericWeight() const;
virtual bool GetUnderlined() const; virtual bool GetUnderlined() const;
@@ -92,7 +92,7 @@ public:
virtual bool IsFixedWidth() const; virtual bool IsFixedWidth() const;
virtual void SetPointSize(int pointSize); virtual void SetFractionalPointSize(float pointSize);
virtual void SetFamily(wxFontFamily family); virtual void SetFamily(wxFontFamily family);
virtual void SetStyle(wxFontStyle style); virtual void SetStyle(wxFontStyle style);
virtual void SetNumericWeight(int weight); virtual void SetNumericWeight(int weight);

View File

@@ -138,7 +138,7 @@ public:
// setters: all of them also take care to modify m_nativeFontInfo if we // setters: all of them also take care to modify m_nativeFontInfo if we
// have it so as to not lose the information not carried by our fields // have it so as to not lose the information not carried by our fields
void SetPointSize(int pointSize); void SetFractionalPointSize(float pointSize);
void SetFamily(wxFontFamily family); void SetFamily(wxFontFamily family);
void SetStyle(wxFontStyle style); void SetStyle(wxFontStyle style);
void SetNumericWeight(int weight); void SetNumericWeight(int weight);
@@ -165,7 +165,7 @@ protected:
void InitFromNative(); void InitFromNative();
// font attributes // font attributes
int m_pointSize; float m_pointSize;
wxFontFamily m_family; wxFontFamily m_family;
wxFontStyle m_style; wxFontStyle m_style;
int m_weight; int m_weight;
@@ -250,7 +250,7 @@ void wxFontRefData::Init(int pointSize,
m_nativeFontInfo.SetUnderlined(underlined); m_nativeFontInfo.SetUnderlined(underlined);
#endif // wxUSE_UNICODE #endif // wxUSE_UNICODE
SetPointSize(pointSize); SetFractionalPointSize(static_cast<float>(pointSize));
} }
void wxFontRefData::InitFromNative() void wxFontRefData::InitFromNative()
@@ -262,7 +262,7 @@ void wxFontRefData::InitFromNative()
// init fields // init fields
m_faceName = wxGTK_CONV_BACK( pango_font_description_get_family( desc ) ); m_faceName = wxGTK_CONV_BACK( pango_font_description_get_family( desc ) );
m_pointSize = pango_font_description_get_size( desc ) / PANGO_SCALE; m_pointSize = static_cast<float>(pango_font_description_get_size( desc )) / PANGO_SCALE;
switch (pango_font_description_get_style( desc )) switch (pango_font_description_get_style( desc ))
{ {
@@ -426,14 +426,14 @@ wxFontRefData::~wxFontRefData()
// wxFontRefData SetXXX() // wxFontRefData SetXXX()
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
void wxFontRefData::SetPointSize(int pointSize) void wxFontRefData::SetFractionalPointSize(float pointSize)
{ {
// NB: Pango doesn't support point sizes less than 1 // NB: Pango doesn't support point sizes less than 1
m_pointSize = pointSize == wxDEFAULT || pointSize < 1 ? wxDEFAULT_FONT_SIZE m_pointSize = pointSize == wxDEFAULT || pointSize < 1 ? wxDEFAULT_FONT_SIZE
: pointSize; : pointSize;
#if wxUSE_UNICODE #if wxUSE_UNICODE
m_nativeFontInfo.SetPointSize(m_pointSize); m_nativeFontInfo.SetFractionalPointSize(m_pointSize);
#endif #endif
} }
@@ -692,11 +692,11 @@ void wxFont::Unshare()
// accessors // accessors
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
int wxFont::GetPointSize() const float wxFont::GetFractionalPointSize() const
{ {
wxCHECK_MSG( IsOk(), 0, wxT("invalid font") ); wxCHECK_MSG( IsOk(), 0, wxT("invalid font") );
return M_FONTDATA->m_nativeFontInfo.GetPointSize(); return M_FONTDATA->m_nativeFontInfo.GetFractionalPointSize();
} }
wxString wxFont::GetFaceName() const wxString wxFont::GetFaceName() const
@@ -799,11 +799,11 @@ bool wxFont::IsFixedWidth() const
// change font attributes // change font attributes
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
void wxFont::SetPointSize(int pointSize) void wxFont::SetFractionalPointSize(float pointSize)
{ {
Unshare(); Unshare();
M_FONTDATA->SetPointSize(pointSize); M_FONTDATA->SetFractionalPointSize(pointSize);
} }
void wxFont::SetFamily(wxFontFamily family) void wxFont::SetFamily(wxFontFamily family)