- int ff_weight;
- switch ( font->GetWeight() )
- {
- default:
- wxFAIL_MSG(_T("unknown font weight"));
- // fall through
-
- case wxNORMAL:
- ff_weight = FW_NORMAL;
- break;
-
- case wxLIGHT:
- ff_weight = FW_LIGHT;
- break;
-
- case wxBOLD:
- ff_weight = FW_BOLD;
- break;
- }
-
-#if wxUSE_SCREEN_DPI
- HDC dc = ::GetDC(NULL);
- static const int ppInch = ::GetDeviceCaps(dc, LOGPIXELSY);
- ::ReleaseDC(NULL, dc);
-#else
- // New behaviour: apparently ppInch varies according to Large/Small Fonts
- // setting in Windows. This messes up fonts. So, set ppInch to a constant
- // 96 dpi.
- static const int ppInch = 96;
-#endif // 0/1
-
-#if wxFONT_SIZE_COMPATIBILITY
- // Incorrect, but compatible with old wxWindows behaviour
- int nHeight = (font->GetPointSize()*ppInch/72);
-#else
- // Correct for Windows compatibility
-// int nHeight = - (font->GetPointSize()*ppInch/72);
- int nHeight = - (int) ( (font->GetPointSize()*((double)ppInch)/72.0) + 0.5);
-#endif
-
- wxString facename = font->GetFaceName();
- if ( !!facename )
- {
- ff_face = facename;
- }
- //else: ff_face is a reasonable default facename for this font family
-
- // deal with encoding now
- wxNativeEncodingInfo info;
- wxFontEncoding encoding = font->GetEncoding();
- if ( !wxGetNativeFontEncoding(encoding, &info) )
- {
- if ( !wxTheFontMapper->GetAltForEncoding(encoding, &info) )
- {
- // unsupported encoding, replace with the default
- info.charset = ANSI_CHARSET;
- }
- }
-
- if ( !info.facename.IsEmpty() )
- {
- // the facename determined by the encoding overrides everything else
- ff_face = info.facename;