|
|
@@ -312,24 +312,13 @@ this.fontsMinifier = this.fontsMinifier || (() => {
|
|
|
if (optionalUsedFonts && optionalUsedFonts.length) {
|
|
|
const fontStyle = rule.style.getPropertyValue("font-style") || "normal";
|
|
|
const fontWeight = getFontWeight(rule.style.getPropertyValue("font-weight")) || "400";
|
|
|
- const fontVariant = rule.style.getPropertyValue("font-variant");
|
|
|
- test = optionalUsedFonts.find(fontInfo => fontInfo.fontStyle == fontStyle);
|
|
|
- if (test) {
|
|
|
- test = optionalUsedFonts.find(fontInfo => testFontVariant(fontInfo, fontVariant));
|
|
|
- }
|
|
|
- if (test) {
|
|
|
- if (isNaN(fontWeight)) {
|
|
|
- test = true;
|
|
|
- } else {
|
|
|
- const usedFontWeights = optionalUsedFonts.map(fontInfo => fontInfo.fontWeight);
|
|
|
- const declaredFontsWeights = declaredFonts
|
|
|
- .filter(fontInfo => fontInfo.familyName == familyName && fontInfo.fontStyle == fontStyle && testFontVariant(fontInfo, fontVariant))
|
|
|
- .map(fontInfo => fontInfo.fontWeight)
|
|
|
- .sort((weight1, weight2) => weight1 - weight2);
|
|
|
- const usedComputedFontWeights = usedFontWeights.map(fontWeight => findFontWeight(fontWeight, declaredFontsWeights));
|
|
|
- test = usedComputedFontWeights.includes(fontWeight);
|
|
|
- }
|
|
|
- }
|
|
|
+ const fontVariant = rule.style.getPropertyValue("font-variant") || "normal";
|
|
|
+ const declaredFontsWeights = declaredFonts
|
|
|
+ .filter(fontInfo => fontInfo.familyName == familyName && fontInfo.fontStyle == fontStyle && testFontVariant(fontInfo, fontVariant))
|
|
|
+ .map(fontInfo => fontInfo.fontWeight)
|
|
|
+ .sort((weight1, weight2) => weight1 - weight2);
|
|
|
+ const usedFontWeights = optionalUsedFonts.map(fontInfo => findFontWeight(fontInfo.fontWeight, declaredFontsWeights));
|
|
|
+ test = usedFontWeights.includes(fontWeight);
|
|
|
} else {
|
|
|
test = true;
|
|
|
}
|