X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c9f7896861f734ce044ee8601ba2d8a6959c9d9e..e5ef1cae0f424be0bffbd651cb10052dfb208396:/src/msw/font.cpp?ds=sidebyside diff --git a/src/msw/font.cpp b/src/msw/font.cpp index a457798069..f2ff677d8a 100644 --- a/src/msw/font.cpp +++ b/src/msw/font.cpp @@ -39,6 +39,10 @@ #include "wx/fontutil.h" #include "wx/fontmap.h" +#ifndef __WXWINCE__ + #include "wx/sysopt.h" +#endif + #include "wx/tokenzr.h" #if wxUSE_EXTENDED_RTTI @@ -318,7 +322,12 @@ public: { return m_nativeFontInfo; } void SetNativeFontInfo(const wxNativeFontInfo& nativeFontInfo) - { Free(); m_nativeFontInfo = nativeFontInfo; } + { + Free(); + + m_nativeFontInfo = nativeFontInfo; + m_nativeFontInfoOk = true; + } protected: // common part of all ctors @@ -448,12 +457,16 @@ void wxNativeFontInfo::Init() { wxZeroMemory(lf); - // we get better font quality if we use this instead of DEFAULT_QUALITY - // apparently without any drawbacks + // we get better font quality if we use PROOF_QUALITY instead of + // DEFAULT_QUALITY but some fonts (e.g. "Terminal 6pt") are not available + // then so we allow to set a global option to choose between quality and + // wider font selection #ifdef __WXWINCE__ lf.lfQuality = CLEARTYPE_QUALITY; #else - lf.lfQuality = PROOF_QUALITY; + lf.lfQuality = wxSystemOptions::GetOptionInt(_T("msw.font.no-proof-quality")) + ? DEFAULT_QUALITY + : PROOF_QUALITY; #endif } @@ -463,13 +476,14 @@ int wxNativeFontInfo::GetPointSize() const // for printing! const int ppInch = ::GetDeviceCaps(ScreenHDC(), LOGPIXELSY); - return (int) (((72.0*(double)abs(lf.lfHeight)) / (double) ppInch) + 0.5); + // BC++ 2007 doesn't provide abs(long) overload, hence the cast + return (int) (((72.0*abs((int)lf.lfHeight)) / (double) ppInch) + 0.5); } wxSize wxNativeFontInfo::GetPixelSize() const { wxSize ret; - ret.SetHeight(lf.lfHeight); + ret.SetHeight(abs((int)lf.lfHeight)); ret.SetWidth(lf.lfWidth); return ret; } @@ -881,12 +895,12 @@ wxFont::~wxFont() // real implementation // ---------------------------------------------------------------------------- -wxObjectRefData *wxFont::CreateRefData() const +wxGDIRefData *wxFont::CreateGDIRefData() const { return new wxFontRefData(); } -wxObjectRefData *wxFont::CloneRefData(const wxObjectRefData *data) const +wxGDIRefData *wxFont::CloneGDIRefData(const wxGDIRefData *data) const { return new wxFontRefData(*wx_static_cast(const wxFontRefData *, data)); }