Fix wxNativeFontInfo::InitFromFont() when using Pango

Use pango_font_description_copy() to make a lossless copy of the original font
instead of doing it using wxWidgets API which is less direct and, in addition,
currently is completely broken as SetXXX() methods don't create the Pango font
description if it doesn't exist as they ought to.

See https://github.com/wxWidgets/wxWidgets/pull/312

(cherry picked from commit dbe2a1c2fd)
This commit is contained in:
Scott Talbert
2016-08-09 21:12:58 -04:00
committed by Vadim Zeitlin
parent a19e512e80
commit 238a948ed0

View File

@@ -227,6 +227,9 @@ public:
// init with the parameters of the given font // init with the parameters of the given font
void InitFromFont(const wxFont& font) void InitFromFont(const wxFont& font)
{ {
#if wxUSE_PANGO
Init(*font.GetNativeFontInfo());
#else
// translate all font parameters // translate all font parameters
SetStyle((wxFontStyle)font.GetStyle()); SetStyle((wxFontStyle)font.GetStyle());
SetWeight((wxFontWeight)font.GetWeight()); SetWeight((wxFontWeight)font.GetWeight());
@@ -252,6 +255,7 @@ public:
// deal with encoding now (it may override the font family and facename // deal with encoding now (it may override the font family and facename
// so do it after setting them) // so do it after setting them)
SetEncoding(font.GetEncoding()); SetEncoding(font.GetEncoding());
#endif // !wxUSE_PANGO
} }
// accessors and modifiers for the font elements // accessors and modifiers for the font elements