- 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;
- }
-
- // transfer all the data to LOGFONT
- logFont->lfHeight = nHeight;
- logFont->lfWidth = 0;
- logFont->lfEscapement = 0;
- logFont->lfOrientation = 0;
- logFont->lfWeight = ff_weight;
- logFont->lfItalic = ff_italic;
- logFont->lfUnderline = (BYTE)font->GetUnderlined();
- logFont->lfStrikeOut = 0;
- logFont->lfCharSet = info.charset;
- logFont->lfOutPrecision = OUT_DEFAULT_PRECIS;
- logFont->lfClipPrecision = CLIP_DEFAULT_PRECIS;
- logFont->lfQuality = PROOF_QUALITY;
- logFont->lfPitchAndFamily = DEFAULT_PITCH | ff_family;
- wxStrncpy(logFont->lfFaceName, ff_face, WXSIZEOF(logFont->lfFaceName));
-}
-
-wxFont wxCreateFontFromLogFont(const LOGFONT *logFont)
-{
- // extract family from pitch-and-family
- int lfFamily = logFont->lfPitchAndFamily;
- if ( lfFamily & FIXED_PITCH )
- lfFamily -= FIXED_PITCH;
- if ( lfFamily & VARIABLE_PITCH )
- lfFamily -= VARIABLE_PITCH;
-
- int fontFamily;
- switch ( lfFamily )
- {
- case FF_ROMAN:
- fontFamily = wxROMAN;