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