Gildas 7 лет назад
Родитель
Сommit
6e603b4c3a
1 измененных файлов с 6 добавлено и 2 удалено
  1. 6 2
      lib/single-file/util/doc-helper.js

+ 6 - 2
lib/single-file/util/doc-helper.js

@@ -126,8 +126,8 @@ this.docHelper = this.docHelper || (() => {
 		styles.forEach(style => {
 			const fontFamilyNames = style.fontFamily.split(",");
 			fontFamilyNames.forEach(fontFamilyName => {
-				fontFamilyName = removeQuotes(fontFamilyName.trim()).toLowerCase();
-				if (!loadedFonts || loadedFonts.find(font => font.family.toLowerCase() == fontFamilyName && font.style == style.fontStyle && font.variant == style.fontVariant)) {
+				fontFamilyName = normalizeFontFamily(fontFamilyName);
+				if (!loadedFonts || loadedFonts.find(font => normalizeFontFamily(font.family) == fontFamilyName && font.style == style.fontStyle && font.variant == style.fontVariant)) {
 					const { fontWeight, fontStyle, fontVariant } = style;
 					usedFonts.add([fontFamilyName, fontWeight, fontStyle, fontVariant]);
 				}
@@ -136,6 +136,10 @@ this.docHelper = this.docHelper || (() => {
 		return Array.from(usedFonts);
 	}
 
+	function normalizeFontFamily(fontFamilyName) {
+		return removeQuotes(fontFamilyName.trim()).toLowerCase();
+	}
+
 	function getElementsInfo(win, element, elementsInfo = new Map()) {
 		const elements = Array.from(element.childNodes).filter(node => !win || node instanceof win.Element);
 		elements.forEach(element => {