fonts: Improve weight defaults: normal→dim/bold is more visible (#8097)

refs: #8049 (with examples)

---------
Co-authored-by: Benoit de Chezelles <benoit.dechezelles@gmail.com>
This commit is contained in:
Huy PhungandBenoit de Chezelles authored and GitHub committed 2026-08-29 16:16:36 +02:00
1 parent 135baeab0f
commit ae46d3a0bb
2 files changed
+13 -2

No files matched your search

+11 -2
View File
@@ -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)
}
}
+2
View File
@@ -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