full site update

This commit is contained in:
2025-07-24 18:46:24 +02:00
parent bfe2b90d8d
commit 37a6e0ab31
6912 changed files with 540482 additions and 361712 deletions

21
node_modules/fontace/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2025 Chris Swithinbank
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

91
node_modules/fontace/README.md generated vendored Normal file
View File

@@ -0,0 +1,91 @@
<h1 align="center">fontace</h1>
<p align="center">Extract useful information from font files</p>
<p align="center">
<a href="https://www.npmjs.com/package/fontace"><img alt="fontace on NPM" src="https://img.shields.io/npm/v/fontace"></a>
<a href="https://github.com/delucis/fontace/actions/workflows/ci.yml"><img src="https://github.com/delucis/fontace/actions/workflows/ci.yml/badge.svg" alt="CI status"></a>
</p>
## Installation
```sh
npm install fontace
```
## Import
```js
import { fontace } from 'fontace';
```
## Why `fontace`?
`fontace` is a small library, which intends to extract data specifically to help generate CSS `@font-face` declarations based on font files.
`fontace` returns the following CSS-compatible values intended for use with `font-family`, `font-style`, `unicode-range`, and `font-weight`:
- `family`: The font family name as stored in the font file, e.g. `"Inter"`.
- `style`: The style of this font file, e.g. `"normal"` or `"italic"`.
- `unicodeRange`: The range of Unicode code points this font file contains, e.g. `"U+0-10FFFF"`.
- `weight`: The font weight(s) this file supports, which can be a range for variable fonts, e.g. `"400"` or `"100 900"`.
In addition it returns:
- `format`: The font file format for use in [`format()`](https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/src#format), e.g.`"woff2"` or `"truetype"`.
- `isVariable`: `true` if the font file contains variable axes of some kind.
- `unicodeRangeArray`: An array of the Unicode code point ranges this font file contains, e.g. `["U+0-10FFFF"]`, equivalent to `unicodeRange.split(', ')`. Useful if you need to iterate through the available ranges instead of inlining them directly in CSS.
## Usage
Pass a buffer containing font file data to `fontace()` and get useful information back.
### Example: local font file
Use file-system APIs to read a local font file and then pass it to `fontace()`:
```js
import { fontace } from 'fontace';
import fs from 'node:fs';
const fontBuffer = fs.readFileSync('./Inter.woff2');
const metadata = fontace(fontBuffer);
// { family: "Inter", format: 'woff2', style: "normal", weight: "400", isVariable: false, unicodeRange: "U+0, U+20-7E...", unicodeRangeArray: ["U+0", "U+20-7E", ...] }
```
### Example: remote font file
Fetch a font file over the network and then pass it to `fontace()`:
```js
import { fontace } from 'fontace';
const response = await fetch('https://example.com/Inter-Variable.woff2');
const fontBuffer = Buffer.from(await response.arrayBuffer());
const metadata = fontace(fontBuffer);
// { family: "Inter", format: 'woff2', style: "normal", weight: "100 900", isVariable: true, unicodeRange: "U+0, U+20-7E...", unicodeRangeArray: ["U+0", "U+20-7E", ...] }
```
### Example: using `fontace` data to create CSS
```js
const { family, format, isVariable, style, unicodeRange, weight } = fontace(fontBuffer);
let src = `url(/MyFont.woff2) format('${format}')`;
if (isVariable) src += ' tech(variations)';
const fontFaceDeclaration = `@font-face {
font-family: ${family};
font-style: ${style};
font-weight: ${weight};
font-display: swap;
unicode-range: ${unicodeRange};
src: ${src};
}`;
```
## Acknowledgements
`fontace` uses the [`fontkit`](https://www.npmjs.com/package/fontkit) package to extract data from font files.
## License
[MIT](LICENSE)

37
node_modules/fontace/dist/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,37 @@
type FontStyle = 'auto' | 'normal' | 'italic' | 'oblique' | `oblique ${number}deg` | `oblique ${number}deg ${number}deg`;
type FontWeightAbsolute = 'normal' | 'bold' | `${number}`;
type FontWeight = 'auto' | FontWeightAbsolute | `${FontWeightAbsolute} ${FontWeightAbsolute}`;
interface FontMetadata {
/** The font family name as stored in the font file, e.g. `"Inter"`. */
family: string;
/** The range of Unicode code points this font file contains, e.g. `"U+0-10FFFF"`. */
unicodeRange: string;
/**
* Array of Unicode code point ranges this font file contains, e.g. `["U+0-10FFFF"]`,
* equivalent to `unicodeRange.split(', ')`.
*/
unicodeRangeArray: string[];
/** The style of this font file, e.g. `"normal"` or `"italic"`. */
style: FontStyle;
/** The font weight(s) this file supports, which can be a range for variable fonts, e.g. `"400"` or `"100 900"`. */
weight: FontWeight;
/** Font format compatible with `format()` values in `@font-face` `src` properties. */
format: 'truetype' | 'woff' | 'woff2';
/** Whether or not this font is variable. */
isVariable: boolean;
}
/**
* Infer font-face properties from a buffer containing font file data.
* @param fontBuffer Buffer containing font file data.
* @example
* import { fontace } from 'fontace';
* import fs from 'node:fs';
*
* const fontBuffer = fs.readFileSync('./Inter.ttf');
* const fontMetaData = fontace(fontBuffer);
* // { family: "Inter", style: "normal", weight: "400", unicodeRange: "U+0, U+20-7E...
*/
declare function fontace(fontBuffer: Buffer): FontMetadata;
export { fontace };

57
node_modules/fontace/dist/index.js generated vendored Normal file
View File

@@ -0,0 +1,57 @@
// src/index.ts
import { create } from "fontkit";
function getWeight(font) {
if (font.variationAxes.wght) {
return `${font.variationAxes.wght.min} ${font.variationAxes.wght.max}`;
}
const weight = font["OS/2"]?.usWeightClass || (font["OS/2"]?.fsSelection?.["bold"] ? 700 : 400);
return `${weight}`;
}
function getStyle(font) {
return font["OS/2"]?.fsSelection?.italic || font.italicAngle !== 0 ? "italic" : "normal";
}
function fontace(fontBuffer) {
const font = create(fontBuffer);
if (font.type === "TTC") {
throw new Error("TrueType Collection (TTC) files are not supported.");
} else if (font.type === "DFont") {
throw new Error("DFONT files are not supported.");
} else if (font.type !== "TTF" && font.type !== "WOFF" && font.type !== "WOFF2") {
throw new Error(`Unknown font type: ${font.type}`);
}
return {
...getUnicodeRange(font),
family: font.familyName,
style: getStyle(font),
weight: getWeight(font),
format: { TTF: "truetype", WOFF: "woff", WOFF2: "woff2" }[font.type],
isVariable: Object.keys(font.variationAxes).length > 0
};
}
function getUnicodeRange({ characterSet }) {
if (!characterSet || characterSet.length === 0) {
const defaultRange = "U+0-10FFFF";
return { unicodeRange: defaultRange, unicodeRangeArray: [defaultRange] };
}
characterSet.sort((a, b) => a - b);
const ranges = [];
let start = characterSet[0];
let end = start;
for (let i = 1; i < characterSet.length; i++) {
if (characterSet[i] === end + 1) {
end = characterSet[i];
} else {
ranges.push(formatRange(start, end));
start = characterSet[i];
end = start;
}
}
ranges.push(formatRange(start, end));
return { unicodeRange: ranges.join(", "), unicodeRangeArray: ranges };
}
function formatRange(start, end) {
return start === end ? `U+${start.toString(16).toUpperCase()}` : `U+${start.toString(16).toUpperCase()}-${end.toString(16).toUpperCase()}`;
}
export {
fontace
};

51
node_modules/fontace/package.json generated vendored Normal file
View File

@@ -0,0 +1,51 @@
{
"name": "fontace",
"version": "0.3.0",
"description": "Extract useful information from font files",
"type": "module",
"sideEffects": false,
"exports": {
".": "./dist/index.js"
},
"files": [
"dist"
],
"keywords": [
"font",
"fontkit",
"opentype",
"truetype",
"woff",
"woff2",
"css",
"font-face"
],
"author": "delucis",
"repository": {
"type": "git",
"url": "git+https://github.com/delucis/fontace.git"
},
"bugs": "https://github.com/delucis/fontace/issues",
"homepage": "https://github.com/delucis/fontace#readme",
"license": "MIT",
"dependencies": {
"@types/fontkit": "^2.0.8",
"fontkit": "^2.0.4"
},
"devDependencies": {
"@changesets/changelog-github": "^0.5.1",
"@changesets/cli": "^2.28.1",
"@fontsource-variable/inter": "^5.2.5",
"@fontsource/roboto": "^5.2.5",
"tsup": "^8.4.0",
"typescript": "^5.8.2",
"vite": "^6.2.3",
"vitest": "^3.0.9"
},
"scripts": {
"build": "tsup src/index.ts --format esm --dts --clean",
"test": "vitest",
"ci-version": "changeset version && pnpm install --no-frozen-lockfile",
"ci-publish": "changeset publish"
}
}