diff options
author | Christian Persch <chpe@src.gnome.org> | 2021-10-09 20:16:05 +0200 |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2021-10-09 20:16:05 +0200 |
commit | 05fb6061fb962fee09085f5d7c9f9fd27202e2c6 (patch) | |
tree | 6d50b9e0e9281d8c992a30cb99d30b06125bc619 | |
parent | 64b333b11b840d2fad6643516d5b0116ef82dba4 (diff) | |
download | vte-05fb6061fb962fee09085f5d7c9f9fd27202e2c6.tar.gz |
fonts: Improve font bolding
Embolden the font by adding to its weight, not just overwriting the
weight with PANGO_WEIGHT_BOLD.
-rw-r--r-- | src/drawing-cairo.cc | 8 | ||||
-rw-r--r-- | src/vtedefines.hh | 2 |
2 files changed, 9 insertions, 1 deletions
diff --git a/src/drawing-cairo.cc b/src/drawing-cairo.cc index a606fd46..0a1cdae1 100644 --- a/src/drawing-cairo.cc +++ b/src/drawing-cairo.cc @@ -152,7 +152,13 @@ DrawingContext::set_text_font(GtkWidget* widget, /* calculate bold font desc */ bolddesc = pango_font_description_copy (fontdesc); - pango_font_description_set_weight (bolddesc, PANGO_WEIGHT_BOLD); + if (pango_font_description_get_set_fields(bolddesc) & PANGO_FONT_MASK_WEIGHT) { + auto const weight = pango_font_description_get_weight(bolddesc); + auto const bold_weight = std::min(1000, weight + VTE_FONT_WEIGHT_BOLDENING); + pango_font_description_set_weight(bolddesc, PangoWeight(bold_weight)); + } else { + pango_font_description_set_weight (bolddesc, PANGO_WEIGHT_BOLD); + } /* calculate italic font desc */ italicdesc = pango_font_description_copy (fontdesc); diff --git a/src/vtedefines.hh b/src/vtedefines.hh index fe8d6e97..7f2e478a 100644 --- a/src/vtedefines.hh +++ b/src/vtedefines.hh @@ -154,3 +154,5 @@ #define VTE_MIN_GRID_WIDTH (2) /* space for one wide character */ #define VTE_MIN_GRID_HEIGHT (1) + +#define VTE_FONT_WEIGHT_BOLDENING (PANGO_WEIGHT_BOLD - PANGO_WEIGHT_NORMAL) |