mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
style: Use a user defined type for font weight everywhere.
Bug: 1436048 Reviewed-by: emilio
This commit is contained in:
parent
156ef81878
commit
245d848508
4 changed files with 18 additions and 7 deletions
|
@ -75,10 +75,12 @@ impl FontWeight {
|
|||
}
|
||||
|
||||
/// Convert from an Gecko weight
|
||||
pub fn from_gecko_weight(weight: u16) -> Self {
|
||||
#[cfg(feature = "gecko")]
|
||||
pub fn from_gecko_weight(weight: structs::FontWeight) -> Self {
|
||||
// we allow a wider range of weights than is parseable
|
||||
// because system fonts may provide custom values
|
||||
FontWeight(weight)
|
||||
let weight = unsafe { bindings::Gecko_FontWeight_ToFloat(weight) };
|
||||
FontWeight(weight as u16)
|
||||
}
|
||||
|
||||
/// Weither this weight is bold
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue