@@ -2,6 +2,7 @@ use cssparser::*;
22use crate :: traits:: { Parse , ToCss } ;
33use crate :: printer:: Printer ;
44use crate :: properties:: font:: { FontFamily , FontStyle , FontWeight , FontStretch } ;
5+ use crate :: values:: size:: Size2D ;
56use crate :: properties:: custom:: CustomProperty ;
67use crate :: macros:: enum_property;
78
@@ -16,8 +17,8 @@ pub enum FontFaceProperty {
1617 Source ( Vec < Source > ) ,
1718 FontFamily ( FontFamily ) ,
1819 FontStyle ( FontStyle ) ,
19- FontWeight ( FontWeight ) ,
20- FontStretch ( FontStretch ) ,
20+ FontWeight ( Size2D < FontWeight > ) ,
21+ FontStretch ( Size2D < FontStretch > ) ,
2122 Custom ( CustomProperty )
2223}
2324
@@ -258,8 +259,8 @@ impl<'i> cssparser::DeclarationParser<'i> for FontFaceDeclarationParser {
258259 input : & mut cssparser:: Parser < ' i , ' t > ,
259260 ) -> Result < Self :: Declaration , cssparser:: ParseError < ' i , Self :: Error > > {
260261 macro_rules! property {
261- ( $property: ident, $type: ident ) => {
262- if let Ok ( c) = $type:: parse( input) {
262+ ( $property: ident, $type: ty ) => {
263+ if let Ok ( c) = < $type> :: parse( input) {
263264 return Ok ( FontFaceProperty :: $property( c) )
264265 }
265266 } ;
@@ -273,9 +274,9 @@ impl<'i> cssparser::DeclarationParser<'i> for FontFaceDeclarationParser {
273274 }
274275 } ,
275276 "font-family" => property!( FontFamily , FontFamily ) ,
276- "font-weight" => property!( FontWeight , FontWeight ) ,
277+ "font-weight" => property!( FontWeight , Size2D < FontWeight > ) ,
277278 "font-style" => property!( FontStyle , FontStyle ) ,
278- "font-stretch" => property!( FontStretch , FontStretch ) ,
279+ "font-stretch" => property!( FontStretch , Size2D < FontStretch > ) ,
279280 _ => { }
280281 }
281282
0 commit comments