mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Use integer for specified and computed font-weight
This commit is contained in:
parent
4f0f2fb13e
commit
8b842f5417
11 changed files with 111 additions and 194 deletions
|
@ -217,17 +217,7 @@ impl FontHandleMethods for FontHandle {
|
|||
} else {
|
||||
4.0 + normalized * 5.0 // [4.0, 9.0]
|
||||
}; // [1.0, 9.0], centered on 4.0
|
||||
match normalized.round() as u32 {
|
||||
1 => font_weight::T::Weight100,
|
||||
2 => font_weight::T::Weight200,
|
||||
3 => font_weight::T::Weight300,
|
||||
4 => font_weight::T::Weight400,
|
||||
5 => font_weight::T::Weight500,
|
||||
6 => font_weight::T::Weight600,
|
||||
7 => font_weight::T::Weight700,
|
||||
8 => font_weight::T::Weight800,
|
||||
_ => font_weight::T::Weight900,
|
||||
}
|
||||
font_weight::T::from_int(normalized.round() as i32 * 100).unwrap()
|
||||
}
|
||||
|
||||
fn stretchiness(&self) -> font_stretch::T {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue