|
|
@@ -337,27 +337,35 @@ this.fontsMinifier = this.fontsMinifier || (() => {
|
|
|
if (fontWeight >= 400 && fontWeight <= 500) {
|
|
|
foundWeight = fontWeights.find(weight => weight >= fontWeight && weight <= 500);
|
|
|
if (!foundWeight) {
|
|
|
- foundWeight = fontWeights.slice().reverse().find(weight => weight < fontWeight);
|
|
|
+ foundWeight = findDescendingFontWeight(fontWeight, fontWeights);
|
|
|
}
|
|
|
if (!foundWeight) {
|
|
|
- foundWeight = fontWeights.find(weight => weight > fontWeight);
|
|
|
+ foundWeight = findAscendingFontWeight(fontWeight, fontWeights);
|
|
|
}
|
|
|
}
|
|
|
if (fontWeight < 400) {
|
|
|
foundWeight = fontWeights.slice().reverse().find(weight => weight <= fontWeight);
|
|
|
if (!foundWeight) {
|
|
|
- foundWeight = fontWeights.find(weight => weight > fontWeight);
|
|
|
+ foundWeight = findAscendingFontWeight(fontWeight, fontWeights);
|
|
|
}
|
|
|
}
|
|
|
if (fontWeight > 500) {
|
|
|
foundWeight = fontWeights.find(weight => weight >= fontWeight);
|
|
|
if (!foundWeight) {
|
|
|
- foundWeight = fontWeights.slice().reverse().find(weight => weight < fontWeight);
|
|
|
+ foundWeight = findDescendingFontWeight(fontWeight, fontWeights);
|
|
|
}
|
|
|
}
|
|
|
return foundWeight;
|
|
|
}
|
|
|
|
|
|
+ function findDescendingFontWeight(fontWeight, fontWeights) {
|
|
|
+ return fontWeights.slice().reverse().find(weight => weight < fontWeight);
|
|
|
+ }
|
|
|
+
|
|
|
+ function findAscendingFontWeight(fontWeight, fontWeights) {
|
|
|
+ return fontWeights.find(weight => weight > fontWeight);
|
|
|
+ }
|
|
|
+
|
|
|
function getPseudoElementsContent(doc, rules) {
|
|
|
if (rules) {
|
|
|
return Array.from(rules).map(rule => {
|