summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Persch <chpe@src.gnome.org>2021-10-09 20:16:05 +0200
committerChristian Persch <chpe@src.gnome.org>2021-10-09 20:16:05 +0200
commit357f8d066703700df2b4d4b69fd13f7ee5d70745 (patch)
tree2d6a2743efea0b1e90244f2e2a911ff0b67b5a4f
parent05fb6061fb962fee09085f5d7c9f9fd27202e2c6 (diff)
downloadvte-357f8d066703700df2b4d4b69fd13f7ee5d70745.tar.gz
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.
-rw-r--r--src/vte.cc8
1 files 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 &&