style: Use a user defined type for font weight everywhere.

Bug: 1436048
Reviewed-by: emilio
This commit is contained in:
Jonathan Watt 2018-04-13 20:34:37 +01:00 committed by Emilio Cobos Álvarez
parent 156ef81878
commit 245d848508
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
4 changed files with 18 additions and 7 deletions

View file

@ -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