Fix arbitrary numeric weights in the generic wxNativeFontInfo

Store the weight as int, not wxFontWeight, and rely on the same wrappers
as all the other ports in the port not having native wxNativeFontInfo.

This is a prerequisite for fixing wxDFB and other Unix ports not using
Pango.
This commit is contained in:
Vadim Zeitlin
2018-09-07 02:29:14 +02:00
parent 8955b4b2fb
commit 1f95a041e9
2 changed files with 7 additions and 7 deletions

View File

@@ -188,7 +188,7 @@ public :
float pointSize; float pointSize;
wxFontFamily family; wxFontFamily family;
wxFontStyle style; wxFontStyle style;
wxFontWeight weight; int weight;
bool underlined; bool underlined;
bool strikethrough; bool strikethrough;
wxString faceName; wxString faceName;
@@ -229,7 +229,7 @@ public:
#else #else
// translate all font parameters // translate all font parameters
SetStyle((wxFontStyle)font.GetStyle()); SetStyle((wxFontStyle)font.GetStyle());
SetWeight((wxFontWeight)font.GetWeight()); SetNumericWeight(font.GetNumericWeight());
SetUnderlined(font.GetUnderlined()); SetUnderlined(font.GetUnderlined());
SetStrikethrough(font.GetStrikethrough()); SetStrikethrough(font.GetStrikethrough());
#if defined(__WXMSW__) #if defined(__WXMSW__)

View File

@@ -390,7 +390,7 @@ void wxFontBase::DoSetNativeFontInfo(const wxNativeFontInfo& info)
SetFractionalPointSize(info.pointSize); SetFractionalPointSize(info.pointSize);
SetFamily(info.family); SetFamily(info.family);
SetStyle(info.style); SetStyle(info.style);
SetWeight(info.weight); SetNumericWeight(info.weight);
SetUnderlined(info.underlined); SetUnderlined(info.underlined);
SetStrikethrough(info.strikethrough); SetStrikethrough(info.strikethrough);
SetFaceName(info.faceName); SetFaceName(info.faceName);
@@ -819,7 +819,7 @@ void wxNativeFontInfo::Init()
encoding = wxFONTENCODING_DEFAULT; encoding = wxFONTENCODING_DEFAULT;
} }
float wxNativeFontInfo::GetFractionalPointSize() float wxNativeFontInfo::GetFractionalPointSize() const
{ {
return pointSize; return pointSize;
} }
@@ -829,7 +829,7 @@ wxFontStyle wxNativeFontInfo::GetStyle() const
return style; return style;
} }
wxFontWeight wxNativeFontInfo::GetWeight() const int wxNativeFontInfo::GetNumericWeight() const
{ {
return weight; return weight;
} }
@@ -869,7 +869,7 @@ void wxNativeFontInfo::SetStyle(wxFontStyle style_)
style = style_; style = style_;
} }
void wxNativeFontInfo::SetWeight(wxFontWeight weight_) void wxNativeFontInfo::SetNumericWeight(int weight_)
{ {
weight = weight_; weight = weight_;
} }
@@ -1311,7 +1311,7 @@ bool wxNativeFontInfo::FromUserString(const wxString& s)
// set point size to default value if size was not given // set point size to default value if size was not given
if ( !pointsizefound ) if ( !pointsizefound )
SetPointSize(wxNORMAL_FONT->GetPointSize()); SetFractionalPointSize(wxNORMAL_FONT->GetFractionalPointSize());
// set font weight to default value if weight was not given // set font weight to default value if weight was not given
if ( !weightfound ) if ( !weightfound )