X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/886dd7d28e50c003cc88b81b968d487a3c17b0d7..d223107206e4dfa6768e0bc2455325dd49e4d2bb:/src/msw/fontutil.cpp diff --git a/src/msw/fontutil.cpp b/src/msw/fontutil.cpp index b05fabe17c..a74885be8a 100644 --- a/src/msw/fontutil.cpp +++ b/src/msw/fontutil.cpp @@ -17,7 +17,7 @@ // headers // ---------------------------------------------------------------------------- -#ifdef __GNUG__ +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) #pragma implementation "fontutil.h" #endif @@ -32,6 +32,7 @@ #include "wx/string.h" #include "wx/log.h" #include "wx/intl.h" + #include "wx/encinfo.h" #endif //WX_PRECOMP #include "wx/msw/private.h" @@ -118,7 +119,7 @@ bool wxGetNativeFontEncoding(wxFontEncoding encoding, encoding = wxFont::GetDefaultEncoding(); } - extern WXDLLEXPORT_BASE long wxEncodingToCharset(wxFontEncoding encoding); + extern WXDLLIMPEXP_BASE long wxEncodingToCharset(wxFontEncoding encoding); info->charset = wxEncodingToCharset(encoding); if ( info->charset == -1 ) return FALSE; @@ -233,36 +234,20 @@ wxFontEncoding wxGetFontEncFromCharSet(int cs) void wxFillLogFont(LOGFONT *logFont, const wxFont *font) { + wxNativeFontInfo fi; + // maybe we already have LOGFONT for this font? - wxNativeFontInfo *fontinfo = font->GetNativeFontInfo(); - if ( !fontinfo ) + const wxNativeFontInfo *pFI = font->GetNativeFontInfo(); + if ( !pFI ) { // use wxNativeFontInfo methods to build a LOGFONT for this font - fontinfo = new wxNativeFontInfo; - - // translate all font parameters - fontinfo->SetStyle((wxFontStyle)font->GetStyle()); - fontinfo->SetWeight((wxFontWeight)font->GetWeight()); - fontinfo->SetUnderlined(font->GetUnderlined()); - fontinfo->SetPointSize(font->GetPointSize()); - - // set the family/facename - fontinfo->SetFamily((wxFontFamily)font->GetFamily()); - wxString facename = font->GetFaceName(); - if ( !facename.empty() ) - { - fontinfo->SetFaceName(facename); - } + fi.InitFromFont(*font); - // deal with encoding now (it may override the font family and facename - // so do it after setting them) - fontinfo->SetEncoding(font->GetEncoding()); + pFI = &fi; } // transfer all the data to LOGFONT - *logFont = fontinfo->lf; - - delete fontinfo; + *logFont = pFI->lf; } wxFont wxCreateFontFromLogFont(const LOGFONT *logFont)