webfont 12.3.0 → 12.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -3
- package/dist/cli.mjs +266 -255
- package/dist/index.js +1 -1
- package/dist/index.mjs +142 -132
- package/dist/src/lib/ttfEncode.d.mts +3 -0
- package/dist/src/lib/ttfEncode.d.ts +3 -0
- package/dist/src/standalone/inputMode.d.mts +1 -1
- package/dist/src/standalone/inputMode.d.ts +1 -1
- package/dist/src/types/TranscodedFont.d.mts +1 -0
- package/dist/src/types/TranscodedFont.d.ts +1 -0
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -16,7 +16,7 @@ See **[FEATURES.md](./FEATURES.md)** for the canonical capability list (what is
|
|
|
16
16
|
## Features
|
|
17
17
|
|
|
18
18
|
- **SVG icon pipeline** (default): `.svg` icons → `svg`, `ttf`, `eot`, `woff`, `woff2` (not `otf`);
|
|
19
|
-
- **TTF encoding**: one or more `.ttf` files → `ttf` (pass-through), `eot`, `woff`, and/or `woff2` (auto-detected — no extra flag);
|
|
19
|
+
- **TTF encoding**: one or more `.ttf` files → `ttf` (pass-through), `svg` (SVG font), `eot`, `woff`, and/or `woff2` (auto-detected — no extra flag);
|
|
20
20
|
- **Webfont decompression**: one `.woff` or `.woff2` file → `ttf` and/or `otf` matching the **embedded SFNT flavor** (decompress only — not TTF ↔ OTF transcoding);
|
|
21
21
|
- Config files: `JavaScript`, `JSON`, or `YAML` via [cosmiconfig](https://github.com/cosmiconfig/cosmiconfig);
|
|
22
22
|
- Built-in and custom CSS templates (`css`, `scss`, [`styl`](https://github.com/itgalaxy/webfont/pull/164/));
|
|
@@ -30,7 +30,7 @@ webfont runs one of three pipelines depending on matched input files. They canno
|
|
|
30
30
|
| Mode | Input | Outputs | Notes |
|
|
31
31
|
|------|--------|---------|--------|
|
|
32
32
|
| **SVG icons** | One or more `.svg` files | `svg`, `ttf`, `eot`, `woff`, `woff2` | Default. Builds TrueType via `svg2ttf`. **`otf` is rejected** — use `ttf`. |
|
|
33
|
-
| **TTF encoding** | One or more `.ttf` files | `ttf`, `eot`, `woff`, and/or `woff2` per input | Auto-detected. Default when SVG-pipeline `formats` are still configured: `woff` + `woff2
|
|
33
|
+
| **TTF encoding** | One or more `.ttf` files | `ttf`, `svg` (SVG font), `eot`, `woff`, and/or `woff2` per input | Auto-detected. Default when SVG-pipeline `formats` are still configured: `woff` + `woff2` (`svg` is opt-in). No templates. |
|
|
34
34
|
| **Webfont decompress** | One or more `.woff` / `.woff2` paths, globs, or `http(s)` URLs | `ttf` and/or `otf` per input | One output file per source (basename from filename; collisions get `-woff`/`-woff2`). Not a single merged font. |
|
|
35
35
|
|
|
36
36
|
**Not supported today**
|
|
@@ -157,6 +157,13 @@ const subset = await webfont({
|
|
|
157
157
|
formats: ["woff2"],
|
|
158
158
|
});
|
|
159
159
|
|
|
160
|
+
// TTF → SVG font (legacy format; opt-in, pure JS via fonteditor-core)
|
|
161
|
+
const svgFont = await webfont({
|
|
162
|
+
files: "path/to/font.ttf",
|
|
163
|
+
formats: ["svg"],
|
|
164
|
+
});
|
|
165
|
+
// svgFont.svg → SVG font as a string
|
|
166
|
+
|
|
160
167
|
// Batch: multiple TTF files in one run
|
|
161
168
|
const batch = await webfont({
|
|
162
169
|
files: ["fonts/Inter-Regular.ttf", "fonts/Inter-Bold.ttf"],
|
|
@@ -292,7 +299,7 @@ Notes:
|
|
|
292
299
|
- Possible values: `svg`, `ttf`, `otf`, `eot`, `woff`, `woff2`
|
|
293
300
|
- Description: Font file types to generate.
|
|
294
301
|
- **SVG input**: `svg`, `ttf`, `eot`, `woff`, `woff2` only. **`otf` is not supported** (pipeline uses TrueType outlines).
|
|
295
|
-
- **TTF input**: `ttf`, `eot`, `woff`, and/or `woff2`
|
|
302
|
+
- **TTF input**: `svg` (SVG font), `ttf`, `eot`, `woff`, and/or `woff2`. `svg` is **opt-in** (not in the default `woff` + `woff2` set); **`otf` is not produced** in this mode.
|
|
296
303
|
- **WOFF/WOFF2 input**: `ttf` and/or `otf` only — must match the decompressed SFNT flavor inside the file (not arbitrary transcoding). `eot`, `woff`, `woff2`, and `svg` are not produced in this mode.
|
|
297
304
|
- CLI: pass `-f` / `--formats` as a JSON array (for example `'["woff2"]'`) or as a comma-separated list (for example `woff2` or `svg, ttf, woff2`). Invalid format names throw an error.
|
|
298
305
|
- API and config files: `formats` must be an array of the values above; unknown names (for example `icon`) throw before the pipeline runs.
|