diff options
Diffstat (limited to 'components/gfx/platform/macos/font.rs')
-rw-r--r-- | components/gfx/platform/macos/font.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/components/gfx/platform/macos/font.rs b/components/gfx/platform/macos/font.rs index ca719ddf5b7..6dad917d1fe 100644 --- a/components/gfx/platform/macos/font.rs +++ b/components/gfx/platform/macos/font.rs @@ -210,12 +210,14 @@ impl FontHandleMethods for FontHandle { fn boldness(&self) -> FontWeight { let normalized = self.ctfont.all_traits().normalized_weight(); // [-1.0, 1.0] + // TODO(emilio): It may make sense to make this range [.01, 10.0], to + // align with css-fonts-4's range of [1, 1000]. let normalized = if normalized <= 0.0 { 4.0 + normalized * 3.0 // [1.0, 4.0] } else { 4.0 + normalized * 5.0 // [4.0, 9.0] }; // [1.0, 9.0], centered on 4.0 - FontWeight::from_int(normalized.round() as i32 * 100).unwrap() + FontWeight(normalized as f32 * 100.) } fn stretchiness(&self) -> FontStretch { |