summaryrefslogtreecommitdiff
path: root/patches/unifont@0.1.7.patch
blob: 625a623d912c8183e4f11169a6a1215da812c071 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
diff --git a/dist/index.js b/dist/index.js
index a8d7acc843a641e4797d69b897fc66fbddbd31a9..93c3e63a1a238505ccf8f6b12767a2acdcb0d183 100644
--- a/dist/index.js
+++ b/dist/index.js
@@ -383,7 +383,7 @@ const fontsource = defineFontProvider("fontsource", async (_options, ctx) => {
     const fontFaceData = [];
     for (const subset of subsets) {
       for (const style of styles) {
-        if (font.variable) {
+        if (options.weights.some(weight => weight.includes(" ")) && font.variable) {
           try {
             const variableAxes = await ctx.storage.getItem(`fontsource:${font.family}-axes.json`, () => fontAPI(`/variable/${font.id}`, { responseType: "json" }));
             if (variableAxes && variableAxes.axes.wght) {
@@ -441,7 +441,7 @@ const google = defineFontProvider("google", async (_options = {}, ctx) => {
   async function getFontDetails(family, options) {
     const font = googleFonts.find((font2) => font2.family === family);
     const styles = [...new Set(options.styles.map((i) => styleMap[i]))].sort();
-    const variableWeight = font.axes.find((a) => a.tag === "wght");
+    const variableWeight = options.weights.some(weight => weight.includes(" ")) && font.axes.find((a) => a.tag === "wght");
     const weights = variableWeight ? [`${variableWeight.min}..${variableWeight.max}`] : options.weights.filter((weight) => weight in font.fonts);
     if (weights.length === 0 || styles.length === 0)
       return [];