Initialize point size correctly from v0 native font info strings
Reading native font info strings in v0 format, used by the previous wxWidgets versions, resulted in creation of fonts with 0 point size, which resulted in suboptimal user experience when such a font was used to display text. Fix this by initializing point size to the value corresponding to the font height in pixels using the default DPI, just as we already do when creating wxNativeFontInfo from a LOGFONT.
This commit is contained in:
parent
5507f8eebc
commit
228cd926e2
@ -658,11 +658,13 @@ bool wxNativeFontInfo::FromString(const wxString& s)
|
||||
if ( !token.ToLong(&l) )
|
||||
return false;
|
||||
|
||||
bool setPointSizeFromHeight = false;
|
||||
switch ( l )
|
||||
{
|
||||
case 0:
|
||||
// Fractional point size is not present in this version.
|
||||
pointSize = 0.0f;
|
||||
// Fractional point size is not present in this version, it will be
|
||||
// set from lfHeight below in this case.
|
||||
setPointSizeFromHeight = true;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
@ -685,6 +687,8 @@ bool wxNativeFontInfo::FromString(const wxString& s)
|
||||
if ( !token.ToLong(&l) )
|
||||
return false;
|
||||
lf.lfHeight = l;
|
||||
if ( setPointSizeFromHeight )
|
||||
pointSize = GetPointSizeFromLogFontHeight(l);
|
||||
|
||||
token = tokenizer.GetNextToken();
|
||||
if ( !token.ToLong(&l) )
|
||||
|
Loading…
Reference in New Issue
Block a user