Blob Blame History Raw
From 238a948ed01f27e05e2c0e08932e8da207590648 Mon Sep 17 00:00:00 2001
From: Scott Talbert <swt@techie.net>
Date: Tue, 9 Aug 2016 21:12:58 -0400
Subject: [PATCH] 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 dbe2a1c2fdba53ad1d08ce36780267217933a876)
---
 include/wx/fontutil.h | 4 ++++
 1 file changed, 4 insertions(+)

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