diff options
Diffstat (limited to 'patches/unifont@0.1.7.patch')
-rw-r--r-- | patches/unifont@0.1.7.patch | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/patches/unifont@0.1.7.patch b/patches/unifont@0.1.7.patch new file mode 100644 index 000000000..625a623d9 --- /dev/null +++ b/patches/unifont@0.1.7.patch @@ -0,0 +1,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 []; |