[vte] lib: Sanitise the passed-in font description



commit 11cb693c816b241e8660885dc48f2f5a1c6047ff
Author: Christian Persch <chpe src gnome org>
Date:   Fri Nov 13 17:53:57 2020 +0100

    lib: Sanitise the passed-in font description
    
    Remove weight and style if set, so that SGR attributes can work.

 src/vte.cc | 8 ++++++++
 1 file changed, 8 insertions(+)
---
diff --git a/src/vte.cc b/src/vte.cc
index bb311a08..deb64fc7 100644
--- a/src/vte.cc
+++ b/src/vte.cc
@@ -7246,6 +7246,14 @@ Terminal::set_font_desc(PangoFontDescription const* font_desc)
                                "Using default monospace font.\n");
        }
 
+        /* Sanitise the  font description. Style and weight need to be default here,
+         * since those are set via SGR attributes; and gravity makes no sense in vte.
+         */
+        pango_font_description_unset_fields(desc.get(),
+                                            PangoFontMask(PANGO_FONT_MASK_GRAVITY |
+                                                          PANGO_FONT_MASK_STYLE |
+                                                          PANGO_FONT_MASK_WEIGHT));
+
         bool const same_desc = m_unscaled_font_desc &&
                 pango_font_description_equal(m_unscaled_font_desc.get(), desc.get());
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]