Store fractional point size in wxMSW wxNativeFontInfo
We can't losslessly recover the fractional point size from LOGFONT, so store it in parallel.
This commit is contained in:
@@ -118,9 +118,14 @@ public:
|
|||||||
// set the XFLD
|
// set the XFLD
|
||||||
void SetXFontName(const wxString& xFontName);
|
void SetXFontName(const wxString& xFontName);
|
||||||
#elif defined(__WXMSW__)
|
#elif defined(__WXMSW__)
|
||||||
wxNativeFontInfo(const LOGFONT& lf_) : lf(lf_) { }
|
wxNativeFontInfo(const LOGFONT& lf_) : lf(lf_), pointSize(0.0f) { }
|
||||||
|
|
||||||
LOGFONT lf;
|
LOGFONT lf;
|
||||||
|
|
||||||
|
// MSW only has limited support for fractional point sizes and we need to
|
||||||
|
// store the fractional point size separately if it was initially specified
|
||||||
|
// as we can't losslessly recover it from LOGFONT later.
|
||||||
|
float pointSize;
|
||||||
#elif defined(__WXOSX__)
|
#elif defined(__WXOSX__)
|
||||||
public:
|
public:
|
||||||
wxNativeFontInfo(const wxNativeFontInfo& info) { Init(info); }
|
wxNativeFontInfo(const wxNativeFontInfo& info) { Init(info); }
|
||||||
|
@@ -440,10 +440,15 @@ void wxNativeFontInfo::Init()
|
|||||||
lf.lfQuality = wxSystemOptions::GetOptionInt("msw.font.no-proof-quality")
|
lf.lfQuality = wxSystemOptions::GetOptionInt("msw.font.no-proof-quality")
|
||||||
? DEFAULT_QUALITY
|
? DEFAULT_QUALITY
|
||||||
: PROOF_QUALITY;
|
: PROOF_QUALITY;
|
||||||
|
|
||||||
|
pointSize = 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
float wxNativeFontInfo::GetFractionalPointSize() const
|
float wxNativeFontInfo::GetFractionalPointSize() const
|
||||||
{
|
{
|
||||||
|
if ( pointSize != 0.0f )
|
||||||
|
return pointSize;
|
||||||
|
|
||||||
// FIXME: using the screen here results in incorrect font size calculation
|
// FIXME: using the screen here results in incorrect font size calculation
|
||||||
// for printing!
|
// for printing!
|
||||||
const int ppInch = ::GetDeviceCaps(ScreenHDC(), LOGPIXELSY);
|
const int ppInch = ::GetDeviceCaps(ScreenHDC(), LOGPIXELSY);
|
||||||
@@ -531,6 +536,10 @@ wxFontEncoding wxNativeFontInfo::GetEncoding() const
|
|||||||
|
|
||||||
void wxNativeFontInfo::SetFractionalPointSize(float pointsize)
|
void wxNativeFontInfo::SetFractionalPointSize(float pointsize)
|
||||||
{
|
{
|
||||||
|
// Store it to be able to return it from GetFractionalPointSize() later
|
||||||
|
// exactly.
|
||||||
|
pointSize = pointsize;
|
||||||
|
|
||||||
// FIXME: using the screen here results in incorrect font size calculation
|
// FIXME: using the screen here results in incorrect font size calculation
|
||||||
// for printing!
|
// for printing!
|
||||||
const int ppInch = ::GetDeviceCaps(ScreenHDC(), LOGPIXELSY);
|
const int ppInch = ::GetDeviceCaps(ScreenHDC(), LOGPIXELSY);
|
||||||
|
Reference in New Issue
Block a user