From 47d58db2fbd7f80c6770665c7e61375b3f8f5d00 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 30 Jul 2019 02:18:57 +0200 Subject: [PATCH] Restore, but deprecate, LOGFONT conversion functions in wxMSW Even though these functions were declared in a header called private.h, some code outside the library still used them, notably the popular wxPdfDocument library. So partially revert 72a225924dbd590a674f30ca93d4efd54447cdb6 and these functions back, and just mark them as deprecated for now. --- include/wx/msw/private.h | 7 +++++++ src/msw/fontutil.cpp | 18 ++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/include/wx/msw/private.h b/include/wx/msw/private.h index a1bdd9d5f4..61197650e7 100644 --- a/include/wx/msw/private.h +++ b/include/wx/msw/private.h @@ -965,6 +965,13 @@ extern const wxCursor *wxGetGlobalCursor(); // from msw/cursor.cpp // GetCursorPos can fail without populating the POINT. This falls back to GetMessagePos. WXDLLIMPEXP_CORE void wxGetCursorPosMSW(POINT* pt); +#if WXWIN_COMPATIBILITY_3_0 +wxDEPRECATED_MSG("Use wxNativeFontInfo::lf directly instead of this private function") +WXDLLIMPEXP_CORE void wxFillLogFont(LOGFONT *logFont, const wxFont *font); +wxDEPRECATED_MSG("Use wxNativeFontInfo(LOGFONT) ctor instead of this private function") +WXDLLIMPEXP_CORE wxFont wxCreateFontFromLogFont(const LOGFONT *logFont); +#endif // WXWIN_COMPATIBILITY_3_0 + WXDLLIMPEXP_CORE void wxGetCharSize(WXHWND wnd, int *x, int *y, const wxFont& the_font); WXDLLIMPEXP_CORE wxFontEncoding wxGetFontEncFromCharSet(int charset); diff --git a/src/msw/fontutil.cpp b/src/msw/fontutil.cpp index 975ba52a02..b55222a874 100644 --- a/src/msw/fontutil.cpp +++ b/src/msw/fontutil.cpp @@ -264,3 +264,21 @@ wxFontEncoding wxGetFontEncFromCharSet(int cs) return fontEncoding; } + +// ---------------------------------------------------------------------------- +// Deprecated wxFont <-> LOGFONT conversion functions +// ---------------------------------------------------------------------------- + +#if WXWIN_COMPATIBILITY_3_0 + +void wxFillLogFont(LOGFONT *logFont, const wxFont *font) +{ + *logFont = font->GetNativeFontInfo()->lf; +} + +wxFont wxCreateFontFromLogFont(const LOGFONT *logFont) +{ + return wxFont(wxNativeFontInfo(*logFont)); +} + +#endif // WXWIN_COMPATIBILITY_3_0