expressionToFontFeatureSettings static method
Implementation
static List<FontFeature> expressionToFontFeatureSettings(
List<css.Expression> value) {
List<FontFeature> fontFeatures = [];
for (int i = 0; i < value.length; i++) {
css.Expression exp = value[i];
if (exp is css.LiteralTerm) {
if (exp.text != "on" &&
exp.text != "off" &&
exp.text != "1" &&
exp.text != "0") {
if (i < value.length - 1) {
css.Expression nextExp = value[i + 1];
if (nextExp is css.LiteralTerm &&
(nextExp.text == "on" ||
nextExp.text == "off" ||
nextExp.text == "1" ||
nextExp.text == "0")) {
fontFeatures.add(FontFeature(exp.text,
nextExp.text == "on" || nextExp.text == "1" ? 1 : 0));
} else {
fontFeatures.add(FontFeature.enable(exp.text));
}
} else {
fontFeatures.add(FontFeature.enable(exp.text));
}
}
}
}
List<FontFeature> finalFontFeatures = fontFeatures.toSet().toList();
return finalFontFeatures;
}