[vte] fonts: Relax font sanitisation



commit 357f8d066703700df2b4d4b69fd13f7ee5d70745
Author: Christian Persch <chpe src gnome org>
Date:   Sat Oct 9 20:16:05 2021 +0200

    fonts: Relax font sanitisation
    
    Allow specifying a font weight, but cap it so that emboldening it does
    not overflow the maximum weight.
    
    Fixes: https://gitlab.gnome.org/GNOME/vte/-/issues/323
    f# bricht den Commit ab.

 src/vte.cc | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/src/vte.cc b/src/vte.cc
index e6af1e75..742e73b8 100644
--- a/src/vte.cc
+++ b/src/vte.cc
@@ -7339,12 +7339,12 @@ Terminal::update_font_desc()
         pango_font_description_unset_fields(desc.get(),
                                             PangoFontMask(PANGO_FONT_MASK_GRAVITY |
                                                           PANGO_FONT_MASK_STYLE));
+
+        auto const max_weight = 1000 - VTE_FONT_WEIGHT_BOLDENING;
         if ((pango_font_description_get_set_fields(desc.get()) & PANGO_FONT_MASK_WEIGHT) &&
-            (pango_font_description_get_weight(desc.get()) > PANGO_WEIGHT_MEDIUM) &&
+            (pango_font_description_get_weight(desc.get()) > max_weight) &&
             !m_bold_is_bright) {
-                pango_font_description_set_weight(desc.get(),
-                                                  std::min(pango_font_description_get_weight(desc.get()),
-                                                           PANGO_WEIGHT_MEDIUM));
+                    pango_font_description_set_weight(desc.get(), PangoWeight(max_weight));
         }
 
         bool const same_desc = m_unscaled_font_desc &&


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