e712f1c
From 238a948ed01f27e05e2c0e08932e8da207590648 Mon Sep 17 00:00:00 2001
e712f1c
From: Scott Talbert <swt@techie.net>
e712f1c
Date: Tue, 9 Aug 2016 21:12:58 -0400
e712f1c
Subject: [PATCH] Fix wxNativeFontInfo::InitFromFont() when using Pango
e712f1c
e712f1c
Use pango_font_description_copy() to make a lossless copy of the original font
e712f1c
instead of doing it using wxWidgets API which is less direct and, in addition,
e712f1c
currently is completely broken as SetXXX() methods don't create the Pango font
e712f1c
description if it doesn't exist as they ought to.
e712f1c
e712f1c
See https://github.com/wxWidgets/wxWidgets/pull/312
e712f1c
e712f1c
(cherry picked from commit dbe2a1c2fdba53ad1d08ce36780267217933a876)
e712f1c
---
e712f1c
 include/wx/fontutil.h | 4 ++++
e712f1c
 1 file changed, 4 insertions(+)
e712f1c
e712f1c
diff --git a/include/wx/fontutil.h b/include/wx/fontutil.h
e712f1c
index 60bb874..9e4d023 100644
e712f1c
--- a/include/wx/fontutil.h
e712f1c
+++ b/include/wx/fontutil.h
e712f1c
@@ -227,6 +227,9 @@ public :
e712f1c
     // init with the parameters of the given font
e712f1c
     void InitFromFont(const wxFont& font)
e712f1c
     {
e712f1c
+#if wxUSE_PANGO
e712f1c
+        Init(*font.GetNativeFontInfo());
e712f1c
+#else
e712f1c
         // translate all font parameters
e712f1c
         SetStyle((wxFontStyle)font.GetStyle());
e712f1c
         SetWeight((wxFontWeight)font.GetWeight());
e712f1c
@@ -252,6 +255,7 @@ public :
e712f1c
         // deal with encoding now (it may override the font family and facename
e712f1c
         // so do it after setting them)
e712f1c
         SetEncoding(font.GetEncoding());
e712f1c
+#endif // !wxUSE_PANGO
e712f1c
     }
e712f1c
 
e712f1c
     // accessors and modifiers for the font elements