From: Marc Foley Date: Mon, 12 May 2025 12:09:17 +0000 (+0100) Subject: tags: sort tag axes GF way X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F9436%2Fhead;p=thirdparty%2Fgoogle%2Ffonts.git tags: sort tag axes GF way --- diff --git a/.ci/tags.html b/.ci/tags.html index b128a196c..6dc5e7c7a 100644 --- a/.ci/tags.html +++ b/.ci/tags.html @@ -425,12 +425,25 @@ function axesCombos(axes) { let results = []; for (k in this.familyData) { const family = this.familyData[k]; - // to do bullshit aplhabetical sorting let path = `https://fonts.googleapis.com/css2?family=${family.family.replaceAll(" ", "+")}` + // GF api wants the axes in sorted alphabetical order. However, axes with + // caps are last + const sortedUpperCaseAxes = [] + const sortedLowerCaseAxes = [] + for (let a of family.axes) { + if (a.tag.toUpperCase() === a.tag) { + sortedUpperCaseAxes.push(a); + } else { + sortedLowerCaseAxes.push(a); + } + } + sortedLowerCaseAxes.sort((a, b) => a.tag.localeCompare(b.tag)); + sortedUpperCaseAxes.sort((a, b) => a.tag.localeCompare(b.tag)); + const sortedAxes = [...sortedLowerCaseAxes, ...sortedUpperCaseAxes] if (family.axes.length > 0) { - path += ":" + family.axes.map(a => {return a.tag}).join(",") + path += ":" + sortedAxes.map(a => {return a.tag}).join(",") path += "@"; - path += family.axes.map(a => {return `${Number(a.min)}..${Number(a.max)}`}).join(",") + path += sortedAxes.map(axis => {return `${Number(axis.min)}..${Number(axis.max)}`}).join(",") } results.push(path); }