Implement support for numeric weights specified in wxFontInfo
Update the major ports to use wxFontInfo::GetNumericWeight() instead of GetWeight().
This commit is contained in:
@@ -36,19 +36,7 @@ public:
|
||||
// ctors and such
|
||||
wxFont() { }
|
||||
|
||||
wxFont(const wxFontInfo& info)
|
||||
{
|
||||
Create(info.GetFractionalPointSize(),
|
||||
info.GetFamily(),
|
||||
info.GetStyle(),
|
||||
info.GetWeight(),
|
||||
info.IsUnderlined(),
|
||||
info.GetFaceName(),
|
||||
info.GetEncoding());
|
||||
|
||||
if ( info.IsUsingSizeInPixels() )
|
||||
SetPixelSize(info.GetPixelSize());
|
||||
}
|
||||
wxFont(const wxFontInfo& info);
|
||||
|
||||
wxFont( wxOSXSystemFont systemFont );
|
||||
wxFont(CTFontRef font);
|
||||
@@ -71,7 +59,7 @@ public:
|
||||
wxFont(float size,
|
||||
wxFontFamily family,
|
||||
wxFontStyle style,
|
||||
wxFontWeight weight,
|
||||
int weight,
|
||||
bool underlined = false,
|
||||
const wxString& face = wxEmptyString,
|
||||
wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
|
||||
@@ -102,7 +90,7 @@ public:
|
||||
bool Create(float size,
|
||||
wxFontFamily family,
|
||||
wxFontStyle style,
|
||||
wxFontWeight weight,
|
||||
int weight,
|
||||
bool underlined = false,
|
||||
const wxString& face = wxEmptyString,
|
||||
wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
|
||||
|
@@ -50,7 +50,7 @@ public:
|
||||
wxFontRefData(float size = -1.0f,
|
||||
wxFontFamily family = wxFONTFAMILY_DEFAULT,
|
||||
wxFontStyle style = wxFONTSTYLE_NORMAL,
|
||||
wxFontWeight weight = wxFONTWEIGHT_NORMAL,
|
||||
int weight = wxFONTWEIGHT_NORMAL,
|
||||
bool underlined = false,
|
||||
bool strikethrough = false,
|
||||
const wxString& faceName = wxEmptyString,
|
||||
@@ -83,7 +83,7 @@ protected:
|
||||
void Init(float pointSize,
|
||||
wxFontFamily family,
|
||||
wxFontStyle style,
|
||||
wxFontWeight weight,
|
||||
int weight,
|
||||
bool underlined,
|
||||
bool strikethrough,
|
||||
const wxString& faceName,
|
||||
@@ -109,7 +109,7 @@ private:
|
||||
void wxFontRefData::Init(float pointSize,
|
||||
wxFontFamily family,
|
||||
wxFontStyle style,
|
||||
wxFontWeight weight,
|
||||
int weight,
|
||||
bool underlined,
|
||||
bool strikethrough,
|
||||
const wxString& faceName,
|
||||
@@ -138,7 +138,7 @@ void wxFontRefData::Init(float pointSize,
|
||||
pointSize < 0 ? static_cast<float>(wxDEFAULT_FONT_SIZE)
|
||||
: pointSize
|
||||
);
|
||||
SetWeight( weight );
|
||||
SetNumericWeight( weight );
|
||||
SetUnderlined( underlined );
|
||||
SetStrikethrough( strikethrough );
|
||||
}
|
||||
@@ -161,7 +161,7 @@ wxFontRefData::wxFontRefData( const wxFontRefData& data )
|
||||
}
|
||||
|
||||
wxFontRefData::wxFontRefData(float size, wxFontFamily family, wxFontStyle style,
|
||||
wxFontWeight weight, bool underlined, bool strikethrough,
|
||||
int weight, bool underlined, bool strikethrough,
|
||||
const wxString& faceName,
|
||||
wxFontEncoding encoding)
|
||||
{
|
||||
@@ -288,7 +288,7 @@ wxFont::wxFont(const wxFontInfo& info)
|
||||
m_refData = new wxFontRefData(info.GetFractionalPointSize(),
|
||||
info.GetFamily(),
|
||||
info.GetStyle(),
|
||||
info.GetWeight(),
|
||||
info.GetNumericWeight(),
|
||||
info.IsUnderlined(),
|
||||
info.IsStrikethrough(),
|
||||
info.GetFaceName(),
|
||||
@@ -312,7 +312,8 @@ bool wxFont::Create( int pointSize,
|
||||
AccountForCompatValues(pointSize, style, weight);
|
||||
|
||||
m_refData = new wxFontRefData(wxFontInfo::ToFloatPointSize(pointSize),
|
||||
family, style, weight,
|
||||
family, style,
|
||||
GetNumericWeightOf(weight),
|
||||
underlined, false, face, encoding);
|
||||
|
||||
return true;
|
||||
|
@@ -70,7 +70,7 @@ public:
|
||||
bool sizeUsingPixels,
|
||||
wxFontFamily family,
|
||||
wxFontStyle style,
|
||||
wxFontWeight weight,
|
||||
int weight,
|
||||
bool underlined,
|
||||
bool strikethrough,
|
||||
const wxString& faceName,
|
||||
@@ -272,7 +272,7 @@ protected:
|
||||
bool sizeUsingPixels,
|
||||
wxFontFamily family,
|
||||
wxFontStyle style,
|
||||
wxFontWeight weight,
|
||||
int weight,
|
||||
bool underlined,
|
||||
bool strikethrough,
|
||||
const wxString& faceName,
|
||||
@@ -347,7 +347,7 @@ void wxFontRefData::Init(float pointSize,
|
||||
bool sizeUsingPixels,
|
||||
wxFontFamily family,
|
||||
wxFontStyle style,
|
||||
wxFontWeight weight,
|
||||
int weight,
|
||||
bool underlined,
|
||||
bool strikethrough,
|
||||
const wxString& faceName,
|
||||
@@ -371,7 +371,7 @@ void wxFontRefData::Init(float pointSize,
|
||||
}
|
||||
|
||||
SetStyle(style);
|
||||
m_nativeFontInfo.SetWeight(weight);
|
||||
SetNumericWeight(weight);
|
||||
SetUnderlined(underlined);
|
||||
SetStrikethrough(strikethrough);
|
||||
|
||||
@@ -801,7 +801,7 @@ wxFont::wxFont(const wxFontInfo& info)
|
||||
info.IsUsingSizeInPixels(),
|
||||
info.GetFamily(),
|
||||
info.GetStyle(),
|
||||
info.GetWeight(),
|
||||
info.GetNumericWeight(),
|
||||
info.IsUnderlined(),
|
||||
info.IsStrikethrough(),
|
||||
info.GetFaceName(),
|
||||
@@ -833,7 +833,8 @@ bool wxFont::DoCreate(int pointSize,
|
||||
|
||||
m_refData = new wxFontRefData(wxFontInfo::ToFloatPointSize(pointSize),
|
||||
pixelSize, sizeUsingPixels,
|
||||
family, style, weight,
|
||||
family, style,
|
||||
GetNumericWeightOf(weight),
|
||||
underlined, false, faceName, encoding);
|
||||
|
||||
return RealizeResource();
|
||||
|
@@ -45,7 +45,7 @@ public:
|
||||
wxFontRefData(float size,
|
||||
wxFontFamily family,
|
||||
wxFontStyle style,
|
||||
wxFontWeight weight,
|
||||
int weight,
|
||||
bool underlined,
|
||||
bool strikethrough,
|
||||
const wxString& faceName,
|
||||
@@ -173,7 +173,7 @@ protected:
|
||||
void Init(float size,
|
||||
wxFontFamily family,
|
||||
wxFontStyle style,
|
||||
wxFontWeight weight,
|
||||
int weight,
|
||||
bool underlined,
|
||||
bool strikethrough,
|
||||
const wxString& faceName,
|
||||
@@ -289,7 +289,7 @@ void wxFontRefData::Init()
|
||||
void wxFontRefData::Init(float size,
|
||||
wxFontFamily family,
|
||||
wxFontStyle style,
|
||||
wxFontWeight weight,
|
||||
int weight,
|
||||
bool underlined,
|
||||
bool strikethrough,
|
||||
const wxString& faceName,
|
||||
@@ -540,6 +540,20 @@ wxFont::wxFont(const wxString& fontdesc)
|
||||
(void)Create(info);
|
||||
}
|
||||
|
||||
wxFont::wxFont(const wxFontInfo& info)
|
||||
{
|
||||
Create(info.GetFractionalPointSize(),
|
||||
info.GetFamily(),
|
||||
info.GetStyle(),
|
||||
info.GetNumericWeight(),
|
||||
info.IsUnderlined(),
|
||||
info.GetFaceName(),
|
||||
info.GetEncoding());
|
||||
|
||||
if ( info.IsUsingSizeInPixels() )
|
||||
SetPixelSize(info.GetPixelSize());
|
||||
}
|
||||
|
||||
wxFont::wxFont(int size,
|
||||
int family,
|
||||
int style,
|
||||
@@ -555,7 +569,7 @@ wxFont::wxFont(int size,
|
||||
bool wxFont::Create(float pointSize,
|
||||
wxFontFamily family,
|
||||
wxFontStyle style,
|
||||
wxFontWeight weight,
|
||||
int weight,
|
||||
bool underlined,
|
||||
const wxString& faceName,
|
||||
wxFontEncoding encoding)
|
||||
@@ -579,7 +593,9 @@ bool wxFont::Create(int pointSize,
|
||||
AccountForCompatValues(pointSize, style, weight);
|
||||
|
||||
return Create(wxFontInfo::ToFloatPointSize(pointSize),
|
||||
family, style, weight, underlined, faceName, encoding);
|
||||
family, style,
|
||||
GetNumericWeightOf(weight),
|
||||
underlined, faceName, encoding);
|
||||
}
|
||||
|
||||
wxFont::~wxFont()
|
||||
|
Reference in New Issue
Block a user