🎥 Make videos programmatically with React
Update Google Fonts
Jonny Burger6bcc452a9faf
diff --git a/packages/google-fonts/scripts/extract-info-from-css.ts b/packages/google-fonts/scripts/extract-info-from-css.tsindex 3cbd6b6e70..675deabce0 100644--- a/packages/google-fonts/scripts/extract-info-from-css.ts+++ b/packages/google-fonts/scripts/extract-info-from-css.ts@@ -13,9 +13,9 @@ const getUrl = (line: string) => {const parseFontFace = (block: string) => {const lines = block.split('\n');- const subset = (lines.find((line) => line.trim().startsWith('/*')) as string)- .match(/\/\*(.*)\*\//)![1]- .trim();+ const ss = lines.find((line) => line.trim().startsWith('/*')) as string;++ const preliminarySubset = ss ? ss.match(/\/\*(.*)\*\//)![1].trim() : null;const fontFamily = getValue(lines.find((line) => line.trim().startsWith('font-family')) as string,);@@ -33,6 +33,9 @@ const parseFontFace = (block: string) => {lines.find((line) => line.trim().startsWith('font-style')) as string,);+ const subset =+ preliminarySubset ?? '[' + src?.match(/\.([0-9]+)\.woff/)![1] + ']';+if (!weight) throw Error('no weight');if (!subset) throw Error('no subset');if (!unicodeRange) throw Error('no unicodeRange');@@ -71,14 +74,17 @@ export const extractInfoFromCss = ({let unicodeRanges: Record<string, string> = {};let fonts: Record<string, Record<string, Record<string, string>>> = {};- while (remainingContents.match(/\/\*(.*)/)) {- const startIndex = remainingContents.indexOf('/*');- const endIndex = remainingContents.substring(startIndex + 2).indexOf('/*');+ while (+ remainingContents.match(/^\/\*(.*)/) ||+ remainingContents.match(/^\@font-face/)+ ) {+ const startIndex = 0;+ const endIndex = remainingContents.indexOf('}');const extractedContents = remainingContents.substring(startIndex,endIndex === -1 ? Infinity : endIndex + 2,);- remainingContents = remainingContents.substring(endIndex + 2);+ remainingContents = remainingContents.substring(endIndex + 2).trim();const {subset, unicodeRange, style, src, weight} =parseFontFace(extractedContents);diff --git a/packages/google-fonts/scripts/incompatible-fonts.ts b/packages/google-fonts/scripts/incompatible-fonts.tsindex 0a06d62ed4..2a468b9880 100644--- a/packages/google-fonts/scripts/incompatible-fonts.ts+++ b/packages/google-fonts/scripts/incompatible-fonts.ts@@ -1,4 +1,5 @@export const incompatibleFonts = [+ "Linefont","Material Icons","Material Icons Outlined","Material Icons Round",