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.

Closes https://github.com/wxWidgets/wxWidgets/pull/312
This commit is contained in:
Scott Talbert
2016-08-09 21:12:58 -04:00
committed by Vadim Zeitlin
parent b078e348b7
commit dbe2a1c2fd

View File

@@ -230,6 +230,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());
@@ -255,6 +258,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