@@ -23,6 +23,9 @@ Style declarationsToStyle(Map<String, List<css.Expression>> declarations) {
2323 case 'font-family' :
2424 style.fontFamily = ExpressionMapping .expressionToFontFamily (value.first);
2525 break ;
26+ case 'font-feature-settings' :
27+ style.fontFeatureSettings = ExpressionMapping .expressionToFontFeatureSettings (value);
28+ break ;
2629 case 'font-size' :
2730 style.fontSize = ExpressionMapping .expressionToFontSize (value.first);
2831 break ;
@@ -116,6 +119,29 @@ class ExpressionMapping {
116119 return Display .INLINE ;
117120 }
118121
122+ static List <FontFeature > expressionToFontFeatureSettings (List <css.Expression > value) {
123+ List <FontFeature > fontFeatures = [];
124+ for (int i = 0 ; i < value.length; i++ ) {
125+ css.Expression exp = value[i];
126+ if (exp is css.LiteralTerm ) {
127+ if (exp.text != "on" && exp.text != "off" && exp.text != "1" && exp.text != "0" ) {
128+ if (i < value.length - 1 ) {
129+ css.Expression nextExp = value[i+ 1 ];
130+ if (nextExp is css.LiteralTerm && (nextExp.text == "on" || nextExp.text == "off" || nextExp.text == "1" || nextExp.text == "0" )) {
131+ fontFeatures.add (FontFeature (exp.text, nextExp.text == "on" || nextExp.text == "1" ? 1 : 0 ));
132+ } else {
133+ fontFeatures.add (FontFeature .enable (exp.text));
134+ }
135+ } else {
136+ fontFeatures.add (FontFeature .enable (exp.text));
137+ }
138+ }
139+ }
140+ }
141+ fontFeatures.toSet ().toList ();
142+ return fontFeatures;
143+ }
144+
119145 static FontSize expressionToFontSize (css.Expression value) {
120146 if (value is css.NumberTerm ) {
121147 return FontSize (double .tryParse (value.text), "" );
0 commit comments