Add wxFontInfo::HasFaceName() and use it
No real changes, just simplify the code a little by adding this helper.
This commit is contained in:
parent
03266b1091
commit
7866c293e8
@ -208,6 +208,9 @@ public:
|
||||
float GetFractionalPointSize() const { return m_pointSize; }
|
||||
int GetPointSize() const { return ToIntPointSize(m_pointSize); }
|
||||
wxSize GetPixelSize() const { return m_pixelSize; }
|
||||
|
||||
// If face name is not empty, it has priority, otherwise use family.
|
||||
bool HasFaceName() const { return !m_faceName.empty(); }
|
||||
wxFontFamily GetFamily() const { return m_family; }
|
||||
const wxString& GetFaceName() const { return m_faceName; }
|
||||
|
||||
|
@ -86,11 +86,10 @@ wxFontRefData::wxFontRefData(const wxFontInfo& info)
|
||||
m_nativeFontInfo.description = pango_font_description_new();
|
||||
|
||||
// And set its values
|
||||
const wxString& faceName = info.GetFaceName();
|
||||
if (!faceName.empty())
|
||||
if ( info.HasFaceName() )
|
||||
{
|
||||
pango_font_description_set_family( m_nativeFontInfo.description,
|
||||
wxGTK_CONV_SYS(faceName) );
|
||||
wxGTK_CONV_SYS(info.GetFaceName()) );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -330,7 +330,7 @@ wxFontRefData::wxFontRefData(const wxFontInfo& info)
|
||||
|
||||
// set the family/facename
|
||||
SetFamily(info.GetFamily());
|
||||
if ( !info.GetFaceName().empty() )
|
||||
if ( info.HasFaceName() )
|
||||
SetFaceName(info.GetFaceName());
|
||||
|
||||
// deal with encoding now (it may override the font family and facename
|
||||
|
@ -255,9 +255,8 @@ wxFontRefData::wxFontRefData(const wxFontInfo& info)
|
||||
{
|
||||
m_info.Init();
|
||||
|
||||
const wxString& faceName = info.GetFaceName();
|
||||
if ( !faceName.empty() )
|
||||
SetFaceName(faceName);
|
||||
if ( info.HasFaceName() )
|
||||
SetFaceName(info.GetFaceName());
|
||||
else
|
||||
SetFamily(info.GetFamily());
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user