Update wxNativeFontInfo::{To,From}String() after wxFont changes
Handle fractional point sizes and numeric weights in the custom string formats in the ports using those.
This commit is contained in:
@@ -635,9 +635,32 @@ bool wxNativeFontInfo::FromString(const wxString& s)
|
||||
|
||||
// first the version
|
||||
wxString token = tokenizer.GetNextToken();
|
||||
if ( token != wxS('0') )
|
||||
if ( !token.ToLong(&l) )
|
||||
return false;
|
||||
|
||||
switch ( l )
|
||||
{
|
||||
case 0:
|
||||
// Fractional point size is not present in this version.
|
||||
pointSize = 0.0f;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
{
|
||||
double d;
|
||||
if ( !tokenizer.GetNextToken().ToCDouble(&d) )
|
||||
return false;
|
||||
pointSize = static_cast<float>(d);
|
||||
if ( static_cast<double>(pointSize) != d )
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
// Unknown version.
|
||||
return false;
|
||||
}
|
||||
|
||||
token = tokenizer.GetNextToken();
|
||||
if ( !token.ToLong(&l) )
|
||||
return false;
|
||||
@@ -716,8 +739,9 @@ wxString wxNativeFontInfo::ToString() const
|
||||
{
|
||||
wxString s;
|
||||
|
||||
s.Printf(wxS("%d;%ld;%ld;%ld;%ld;%ld;%d;%d;%d;%d;%d;%d;%d;%d;%s"),
|
||||
0, // version, in case we want to change the format later
|
||||
s.Printf(wxS("%d;%f;%ld;%ld;%ld;%ld;%ld;%d;%d;%d;%d;%d;%d;%d;%d;%s"),
|
||||
1, // version
|
||||
pointSize,
|
||||
lf.lfHeight,
|
||||
lf.lfWidth,
|
||||
lf.lfEscapement,
|
||||
|
||||
Reference in New Issue
Block a user