Parse legacy weight in string font descriptions
Preserve compatiblity font descriptions serialized using wxNativeFontInfo::ToString() in older versions of wxWidgets and load them correctly, instead of asserting.aedf89b098
originally did this, thend355af3420
reversed it as "not needed". Turns out it is, for old serializations. Reversed355af3420
and implement the same backward compatible logic in wxOSX. wxMSW uses win32-native description and doesn't need this.
This commit is contained in:
committed by
Václav Slavík
parent
ac6766c2fc
commit
1cf981e243
@@ -776,9 +776,9 @@ bool wxNativeFontInfo::FromString(const wxString& s)
|
||||
token = tokenizer.GetNextToken();
|
||||
if ( !token.ToLong(&l) )
|
||||
return false;
|
||||
if ( l <= wxFONTWEIGHT_INVALID || l > wxFONTWEIGHT_MAX )
|
||||
weight = wxFont::ConvertFromLegacyWeightIfNecessary(l);
|
||||
if ( weight <= wxFONTWEIGHT_INVALID || weight > wxFONTWEIGHT_MAX )
|
||||
return false;
|
||||
weight = static_cast<int>(l);
|
||||
|
||||
token = tokenizer.GetNextToken();
|
||||
if ( !token.ToLong(&l) )
|
||||
|
@@ -929,7 +929,7 @@ bool wxNativeFontInfo::FromString(const wxString& s)
|
||||
token = tokenizer.GetNextToken();
|
||||
if ( !token.ToLong(&l) )
|
||||
return false;
|
||||
m_ctWeight = WXWeightToCT(l);
|
||||
m_ctWeight = WXWeightToCT(wxFont::ConvertFromLegacyWeightIfNecessary(l));
|
||||
|
||||
token = tokenizer.GetNextToken();
|
||||
if ( !token.ToLong(&l) )
|
||||
|
Reference in New Issue
Block a user