- bool ff_underline = font->GetUnderlined();
-
- ff_face = font->GetFaceName();
-
- logFont->lfHeight = nHeight;
- logFont->lfWidth = 0;
- logFont->lfEscapement = 0;
- logFont->lfOrientation = 0;
- logFont->lfWeight = ff_weight;
- logFont->lfItalic = ff_italic;
- logFont->lfUnderline = (BYTE)ff_underline;
- logFont->lfStrikeOut = 0;
- logFont->lfCharSet = ANSI_CHARSET;
- logFont->lfOutPrecision = OUT_DEFAULT_PRECIS;
- logFont->lfClipPrecision = CLIP_DEFAULT_PRECIS;
- logFont->lfQuality = PROOF_QUALITY;
- logFont->lfPitchAndFamily = DEFAULT_PITCH | ff_family;
- strcpy(logFont->lfFaceName, ff_face);
-}
-
-wxFont wxCreateFontFromLogFont(LOGFONT *logFont) // , bool createNew)
-{
- int fontFamily = wxSWISS;
- int fontStyle = wxNORMAL;
- int fontWeight = wxNORMAL;
- int fontPoints = 10;
- bool fontUnderline = FALSE;
- char *fontFace = NULL;
-
-// int lfFamily = logFont->lfPitchAndFamily & 0xF0;
- int lfFamily = logFont->lfPitchAndFamily;
- if (lfFamily & FIXED_PITCH)
- lfFamily -= FIXED_PITCH;
- if (lfFamily & VARIABLE_PITCH)
- lfFamily -= VARIABLE_PITCH;
-
- switch (lfFamily)
- {
- case FF_ROMAN:
- fontFamily = wxROMAN;
- break;
- case FF_SWISS:
- fontFamily = wxSWISS;
- break;
- case FF_SCRIPT:
- fontFamily = wxSCRIPT;
- break;
- case FF_MODERN:
- fontFamily = wxMODERN;
- break;
- case FF_DECORATIVE:
- fontFamily = wxDECORATIVE;
- break;
- default:
- fontFamily = wxSWISS;
- break;
- }
- switch (logFont->lfWeight)
- {
- case FW_LIGHT:
- fontWeight = wxLIGHT;
- break;
- case FW_NORMAL:
- fontWeight = wxNORMAL;
- break;
- case FW_BOLD:
- fontWeight = wxBOLD;
- break;
- default:
- fontWeight = wxNORMAL;
- break;
- }
- if (logFont->lfItalic)
- fontStyle = wxITALIC;
- else
- fontStyle = wxNORMAL;
-
- if (logFont->lfUnderline)
- fontUnderline = TRUE;
-
- if (logFont->lfFaceName)
- fontFace = logFont->lfFaceName;
-
- HDC dc2 = ::GetDC(NULL);
-
- if ( logFont->lfHeight < 0 )
- logFont->lfHeight = - logFont->lfHeight;
- fontPoints = abs(72*logFont->lfHeight/GetDeviceCaps(dc2, LOGPIXELSY));
- ::ReleaseDC(NULL, dc2);
-
-// if ( createNew )
- return wxFont(fontPoints, fontFamily, fontStyle, fontWeight, fontUnderline, fontFace);
-// else
-// return wxTheFontList->FindOrCreateFont(fontPoints, fontFamily, fontStyle, fontWeight, fontUnderline, fontFace);