From ae46d3a0bbc5102f8a81972f5dee9bc81c65a6f5 Mon Sep 17 00:00:00 2001 From: Huy Phung Date: Sat, 29 Aug 2026 07:16:36 -0700 Subject: [PATCH] =?UTF-8?q?fonts:=20Improve=20weight=20defaults:=20normal?= =?UTF-8?q?=E2=86=92dim/bold=20is=20more=20visible=20(#8097)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit refs: #8049 (with examples) --------- Co-authored-by: Benoit de Chezelles --- config/src/font.rs | 13 +++++++++++-- docs/changelog.md | 2 ++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/config/src/font.rs b/config/src/font.rs index a25863bb7..8c340e859 100644 --- a/config/src/font.rs +++ b/config/src/font.rs @@ -201,6 +201,15 @@ impl Default for FontWeight { } impl FontWeight { + /// The amount by which to shift the weight when synthesizing dim font variant. + /// See issue #8049 for examples. + const WEIGHT_STEP_LIGHTER: u16 = 300; + /// The amount by which to shift the weight when synthesizing bold font variant. + /// For 'bolder' we use a bigger step because 'regular vs bold' is usually less + /// obvious than 'regular vs light' (above) at the same step differences. + /// See issue #8049 for examples. + const WEIGHT_STEP_BOLDER: u16 = 400; + pub const fn from_opentype_weight(w: u16) -> Self { Self(w) } @@ -210,11 +219,11 @@ impl FontWeight { } pub fn lighter(self) -> Self { - Self::from_opentype_weight(self.to_opentype_weight().saturating_sub(200)) + Self::from_opentype_weight(self.to_opentype_weight().saturating_sub(Self::WEIGHT_STEP_LIGHTER)) } pub fn bolder(self) -> Self { - Self::from_opentype_weight(self.to_opentype_weight() + 200) + Self::from_opentype_weight(self.to_opentype_weight() + Self::WEIGHT_STEP_BOLDER) } } diff --git a/docs/changelog.md b/docs/changelog.md index 8fd7f116d..dc4f7d2bb 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -22,6 +22,8 @@ usually the best available version. As features stabilize some brief notes about them will accumulate here. #### Changed +* fonts: Default dim/bold text now looks more contrasting, see #8049 for examples. + Thanks to @bfoersterling (testing) & @hphng for his first OSS contribution! #8097 * DECRQCRA is now disabled by default to prevent silent screen scraping. Set `enable_checksum_rectangular_area = true` to re-enable it. Thanks to @jquast! #7701