X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/db16cab4610b294c3412f6508754b55ef4a42895..eddb32504316bfc92624a2a9b7cc62fd4543face:/include/wx/fontutil.h diff --git a/include/wx/fontutil.h b/include/wx/fontutil.h index 26369c39d2..1f4f5c3c34 100644 --- a/include/wx/fontutil.h +++ b/include/wx/fontutil.h @@ -6,7 +6,7 @@ // Created: 05.11.99 // RCS-ID: $Id$ // Copyright: (c) wxWindows team -// Licence: wxWindows license +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// // General note: this header is private to wxWindows and is not supposed to be @@ -16,7 +16,7 @@ #ifndef _WX_FONTUTIL_H_ #define _WX_FONTUTIL_H_ -#ifdef __GNUG__ +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) #pragma interface "fontutil.h" #endif @@ -27,10 +27,11 @@ #include "wx/font.h" // for wxFont and wxFontEncoding #if defined(__WXMSW__) - #include - #include "wx/msw/winundef.h" + #include "wx/msw/wrapwin.h" #endif +struct WXDLLEXPORT wxNativeEncodingInfo; + #if defined(_WX_X_FONTLIKE) // the symbolic names for the XLFD fields (with examples for their value) @@ -72,7 +73,9 @@ enum wxXLFDField // further it might make sense to make it a real class with virtual methods struct WXDLLEXPORT wxNativeFontInfo { -#if defined(_WX_X_FONTLIKE) +#if wxUSE_PANGO + PangoFontDescription *description; +#elif defined(_WX_X_FONTLIKE) // the members can't be accessed directly as we only parse the // xFontName on demand private: @@ -113,8 +116,6 @@ public: FATTRS fa; FONTMETRICS fm; FACENAMEDESC fn; -#elif defined(__WXGTK20__) - PangoFontDescription *description; #else // other platforms // // This is a generic implementation that should work on all ports @@ -137,6 +138,28 @@ public: // reset to the default state void Init(); + // init with the parameters of the given font + void InitFromFont(const wxFont& font) + { + // translate all font parameters + SetStyle((wxFontStyle)font.GetStyle()); + SetWeight((wxFontWeight)font.GetWeight()); + SetUnderlined(font.GetUnderlined()); + SetPointSize(font.GetPointSize()); + + // set the family/facename + SetFamily((wxFontFamily)font.GetFamily()); + const wxString& facename = font.GetFaceName(); + if ( !facename.empty() ) + { + SetFaceName(facename); + } + + // deal with encoding now (it may override the font family and facename + // so do it after setting them) + SetEncoding(font.GetEncoding()); + } + // accessors and modifiers for the font elements int GetPointSize() const; wxFontStyle GetStyle() const;