webfont 11.2.26 → 12.1.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/NOTICE.md +165 -0
- package/README.md +302 -34
- package/dist/browser.js +4 -0
- package/dist/cli.mjs +893 -0
- package/dist/index.js +1 -507
- package/dist/parseTemplateOption-5T7rSw5J.mjs +20 -0
- package/dist/parseTemplateOption-BmH_pcQh.js +1 -0
- package/dist/renderTemplates-DvRlS58E.mjs +93 -0
- package/dist/renderTemplates-zCYCzeOt.js +1 -0
- package/dist/src/browser.d.ts +2 -0
- package/dist/src/index.d.ts +4 -2
- package/dist/src/lib/applyOptimizeSvgToGlyphs.d.ts +3 -0
- package/dist/src/lib/evenoddFillRule.d.ts +2 -0
- package/dist/src/lib/execCLI/index.d.ts +3 -4
- package/dist/src/lib/inputSource.d.ts +2 -0
- package/dist/src/lib/inputSourceUtils.d.ts +4 -0
- package/dist/src/lib/largeFontLigatures.d.ts +4 -0
- package/dist/src/lib/optimizeSvgGlyphs.d.ts +4 -0
- package/dist/src/lib/p-limit/index.d.ts +2 -0
- package/dist/src/lib/parseFormats.d.ts +4 -0
- package/dist/src/lib/parseTemplateOption.d.ts +2 -0
- package/dist/src/lib/runtimeEnvironment.d.ts +4 -0
- package/dist/src/lib/sfnt/flavor.d.ts +2 -0
- package/dist/src/lib/svgDiagnostics/diagnoseSvgContents.d.ts +12 -0
- package/dist/src/lib/svgFontOutput/emptyGlyphPaths.d.ts +3 -0
- package/dist/src/lib/svgTools/applySvgDiagnostics.d.ts +13 -0
- package/dist/src/lib/svgTools/applySvgTools.d.ts +14 -0
- package/dist/src/lib/svgTools/normalizeSvgToolsOptions.d.ts +2 -0
- package/dist/src/lib/svgicons2svgfont/index.d.ts +14 -0
- package/dist/src/lib/svgicons2svgfont/metadataFromSrcPath.d.ts +11 -0
- package/dist/src/lib/templateUnicodeRange.d.ts +4 -0
- package/dist/src/lib/ttf2eot/index.d.ts +2 -0
- package/dist/src/lib/ttfEncode.d.ts +5 -0
- package/dist/src/standalone/convertTtfInput.d.ts +3 -0
- package/dist/src/standalone/convertWebfontInput.d.ts +3 -0
- package/dist/src/standalone/defaultOptions.d.ts +3 -0
- package/dist/src/standalone/fetchWebfontUrl.d.ts +1 -0
- package/dist/src/standalone/generateSvgFont.d.ts +2 -0
- package/dist/src/standalone/getGlyphsDataFromInputs.d.ts +3 -0
- package/dist/src/standalone/glyphsData.d.ts +2 -2
- package/dist/src/standalone/index.d.ts +8 -3
- package/dist/src/standalone/inputMode.d.ts +9 -0
- package/dist/src/standalone/options.d.ts +3 -3
- package/dist/src/standalone/optionsFromGlyphs.d.ts +3 -0
- package/dist/src/standalone/renderTemplates.d.ts +10 -0
- package/dist/src/standalone/runSvgPipeline.d.ts +3 -0
- package/dist/src/standalone/templateFonts.d.ts +3 -0
- package/dist/src/standalone/toTtf.d.ts +4 -0
- package/dist/src/standalone/validateWebfontOptions.d.ts +6 -0
- package/dist/src/standalone/webfontFromGlyphs.d.ts +3 -0
- package/dist/src/types/DecompressedFont.d.ts +5 -0
- package/dist/src/types/Format.d.ts +4 -4
- package/dist/src/types/GlyphContentTransformFn.d.ts +2 -0
- package/dist/src/types/GlyphData.d.ts +2 -2
- package/dist/src/types/GlyphInput.d.ts +6 -0
- package/dist/src/types/GlyphMetadata.d.ts +1 -1
- package/dist/src/types/GlyphTransformFn.d.ts +2 -2
- package/dist/src/types/InitialOptions.d.ts +7 -4
- package/dist/src/types/MetadataProvider.d.ts +5 -0
- package/dist/src/types/OptionsBase.d.ts +12 -3
- package/dist/src/types/RenderedTemplate.d.ts +7 -0
- package/dist/src/types/Result.d.ts +16 -5
- package/dist/src/types/ResultConfig.d.ts +4 -0
- package/dist/src/types/SvgToolsOptions.d.ts +13 -0
- package/dist/src/types/TranscodedFont.d.ts +7 -0
- package/dist/src/types/WebfontFromGlyphsOptions.d.ts +11 -0
- package/dist/src/types/WebfontOptions.d.ts +39 -3
- package/dist/src/types/index.d.ts +8 -6
- package/package.json +65 -57
- package/templates/template.css.njk +6 -3
- package/templates/template.html.njk +15 -4
- package/templates/template.scss.njk +6 -3
- package/templates/template.styl.njk +6 -3
- package/dist/cli.js +0 -801
- package/dist/jest.config.d.ts +0 -3
- package/dist/src/cli/index.d.ts +0 -1
- package/dist/src/cli/index.test.d.ts +0 -1
- package/dist/src/cli/meow/index.d.ts +0 -104
- package/dist/src/index.test.d.ts +0 -1
- package/dist/src/standalone/index.test.d.ts +0 -1
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "webfont",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "Generator of fonts from
|
|
3
|
+
"version": "12.1.0",
|
|
4
|
+
"description": "Generator of fonts from SVG icons; decompress WOFF/WOFF2 to embedded TTF/OTF (not TTF↔OTF transcoding)",
|
|
5
5
|
"directories": {
|
|
6
6
|
"lib": "dist",
|
|
7
7
|
"source": "src"
|
|
@@ -12,83 +12,91 @@
|
|
|
12
12
|
"templates",
|
|
13
13
|
"!**/__tests__",
|
|
14
14
|
"!**/__mocks__",
|
|
15
|
-
"README.md"
|
|
15
|
+
"README.md",
|
|
16
|
+
"NOTICE.md"
|
|
16
17
|
],
|
|
17
18
|
"main": "dist/index.js",
|
|
18
|
-
"
|
|
19
|
+
"browser": "dist/browser.js",
|
|
20
|
+
"bin": "dist/cli.mjs",
|
|
19
21
|
"source": "src/index.ts",
|
|
20
22
|
"types": "dist/src/index.d.ts",
|
|
21
23
|
"typings": "dist/src/index.d.ts",
|
|
24
|
+
"exports": {
|
|
25
|
+
".": {
|
|
26
|
+
"node": {
|
|
27
|
+
"import": "./dist/index.js",
|
|
28
|
+
"require": "./dist/index.js"
|
|
29
|
+
},
|
|
30
|
+
"default": "./dist/browser.js"
|
|
31
|
+
},
|
|
32
|
+
"./package.json": "./package.json"
|
|
33
|
+
},
|
|
22
34
|
"scripts": {
|
|
23
|
-
"build": "
|
|
35
|
+
"build": "vite build --mode library && vite build --mode browser && vite build --mode cli",
|
|
24
36
|
"clean": "rm -rf dist/ temp/",
|
|
25
|
-
"demo": "node dist/cli.
|
|
26
|
-
"lint": "
|
|
27
|
-
"
|
|
37
|
+
"demo": "node dist/cli.mjs './src/fixtures/svg-icons/*.svg' -d demo -t html --normalize --center-horizontally",
|
|
38
|
+
"lint": "biome check .",
|
|
39
|
+
"depcheck": "knip",
|
|
28
40
|
"prebuild": "npm run clean && npm run lint",
|
|
41
|
+
"prepare": "lefthook install",
|
|
29
42
|
"predemo": "npm run build",
|
|
30
43
|
"prepublishOnly": "npm run build",
|
|
31
|
-
"prerelease": "npm run test",
|
|
32
44
|
"pretest": "npm run build",
|
|
33
|
-
"prettify": "
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"testc": "npm test -- --coverage",
|
|
40
|
-
"test-debug": "npm test --detectOpenHandles --runInBand",
|
|
41
|
-
"testu": "npm test -- -u"
|
|
45
|
+
"prettify": "biome check --write .",
|
|
46
|
+
"test": "vitest run src",
|
|
47
|
+
"testc": "vitest run src --coverage",
|
|
48
|
+
"test-debug": "vitest run src --no-file-parallelism",
|
|
49
|
+
"testu": "vitest run src -u",
|
|
50
|
+
"deprecate-pre-12": "npm deprecate 'webfont@>=10.0.0 <12.0.0' 'Deprecated: upgrade to webfont@12. v10–11 enabled ligatures by default (browser hangs on large fonts, #558). 12.x: ligatures off, Node 12+, named import, unicode-range off, template fixes. See MIGRATION.md'"
|
|
42
51
|
},
|
|
43
52
|
"dependencies": {
|
|
44
|
-
"cosmiconfig": "
|
|
53
|
+
"cosmiconfig": "9.0.2",
|
|
45
54
|
"deepmerge": "^4.2.2",
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"
|
|
55
|
+
"fontverter": "2.0.0",
|
|
56
|
+
"globby": "16.2.0",
|
|
57
|
+
"meow": "14.1.0",
|
|
58
|
+
"nunjucks": "3.2.4",
|
|
59
|
+
"p-limit": "7.3.0",
|
|
51
60
|
"resolve-from": "^5.0.0",
|
|
52
|
-
"svg2ttf": "^6.0
|
|
53
|
-
"svgicons2svgfont": "^
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"
|
|
61
|
+
"svg2ttf": "^6.1.0",
|
|
62
|
+
"svgicons2svgfont": "^16.0.0",
|
|
63
|
+
"svgo": "4.0.1",
|
|
64
|
+
"ttf2eot": "3.1.0",
|
|
65
|
+
"ttf2woff": "^3.0.0",
|
|
66
|
+
"wawoff2": "2.0.0",
|
|
67
|
+
"xml2js": "0.6.2"
|
|
58
68
|
},
|
|
59
69
|
"devDependencies": {
|
|
60
|
-
"@
|
|
61
|
-
"@
|
|
62
|
-
"@
|
|
63
|
-
"@rollup/plugin-commonjs": "latest",
|
|
64
|
-
"@rollup/plugin-typescript": "latest",
|
|
65
|
-
"@types/jest": "26.0.24",
|
|
66
|
-
"@types/node": "15.14.5",
|
|
67
|
-
"@types/nunjucks": "latest",
|
|
70
|
+
"@biomejs/biome": "2.5.2",
|
|
71
|
+
"@types/node": "^22.15.0",
|
|
72
|
+
"@types/nunjucks": "3.2.6",
|
|
68
73
|
"@types/rimraf": "latest",
|
|
69
|
-
"@
|
|
70
|
-
"@
|
|
71
|
-
"
|
|
72
|
-
"
|
|
73
|
-
"
|
|
74
|
-
"
|
|
75
|
-
"
|
|
76
|
-
"eslint-plugin-promise": "latest",
|
|
77
|
-
"eslint-plugin-unicorn": "latest",
|
|
78
|
-
"husky": "latest",
|
|
74
|
+
"@types/svg2ttf": "5.0.3",
|
|
75
|
+
"@types/ttf2eot": "2.0.2",
|
|
76
|
+
"@types/ttf2woff": "2.0.4",
|
|
77
|
+
"@types/wawoff2": "1.0.2",
|
|
78
|
+
"@types/xml2js": "0.4.14",
|
|
79
|
+
"@vitest/coverage-v8": "4.1.9",
|
|
80
|
+
"fast-glob": "3.2.12",
|
|
79
81
|
"is-eot": "latest",
|
|
80
|
-
"is-svg": "
|
|
82
|
+
"is-svg": "6.1.0",
|
|
81
83
|
"is-ttf": "latest",
|
|
82
84
|
"is-woff": "latest",
|
|
83
85
|
"is-woff2": "latest",
|
|
84
|
-
"
|
|
85
|
-
"
|
|
86
|
+
"knip": "6.24.0",
|
|
87
|
+
"lefthook": "2.1.9",
|
|
86
88
|
"rimraf": "latest",
|
|
87
|
-
"
|
|
88
|
-
"
|
|
89
|
-
"
|
|
90
|
-
"
|
|
91
|
-
"
|
|
89
|
+
"typescript": "6.0.3",
|
|
90
|
+
"vite": "8.1.3",
|
|
91
|
+
"vite-plugin-checker": "0.14.4",
|
|
92
|
+
"vite-plugin-dts": "5.0.3",
|
|
93
|
+
"vitest": "4.1.9"
|
|
94
|
+
},
|
|
95
|
+
"overrides": {
|
|
96
|
+
"fast-glob": "3.2.12",
|
|
97
|
+
"minimatch": "10.2.5",
|
|
98
|
+
"test-exclude": "7.0.2",
|
|
99
|
+
"woff2sfnt-sfnt2woff": "1.0.0"
|
|
92
100
|
},
|
|
93
101
|
"repository": {
|
|
94
102
|
"type": "git",
|
|
@@ -113,7 +121,7 @@
|
|
|
113
121
|
},
|
|
114
122
|
"homepage": "https://github.com/itgalaxy/webfont#readme",
|
|
115
123
|
"engines": {
|
|
116
|
-
"node": ">=
|
|
124
|
+
"node": ">= 24.14.0"
|
|
117
125
|
},
|
|
118
126
|
"keywords": [
|
|
119
127
|
"cli",
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
@font-face {
|
|
2
2
|
font-display: auto;
|
|
3
|
-
font-family: "{{
|
|
3
|
+
font-family: "{{ fontFamily }}";
|
|
4
4
|
font-style: normal;
|
|
5
5
|
font-weight: 400;
|
|
6
|
+
{% if unicodeRange %}
|
|
7
|
+
unicode-range: {{ unicodeRange }};
|
|
8
|
+
{% endif %}
|
|
6
9
|
{% if formats.indexOf('eot')>-1 -%}
|
|
7
10
|
src: url("{{ fontPath }}{{ fontName }}.eot?{{ cacheString }}{% if hash %}&v={{ hash }}{% endif %}");
|
|
8
11
|
{%- endif %}
|
|
@@ -32,13 +35,13 @@
|
|
|
32
35
|
{%- if formats.length != 0 -%}, {% else -%}; {% endif -%}
|
|
33
36
|
{%- endif -%}
|
|
34
37
|
{%- if svgIndex != -1 -%}
|
|
35
|
-
url("{{ fontPath }}{{ fontName }}.svg?{{ cacheString }}{% if hash %}&v={{ hash }}{% endif %}#{{
|
|
38
|
+
url("{{ fontPath }}{{ fontName }}.svg?{{ cacheString }}{% if hash %}&v={{ hash }}{% endif %}#{{ svgFontId }}") format("svg");
|
|
36
39
|
{%- endif %}
|
|
37
40
|
}
|
|
38
41
|
|
|
39
42
|
.{{ className }} {
|
|
40
43
|
display: inline-block;
|
|
41
|
-
font-family: "{{
|
|
44
|
+
font-family: "{{ fontFamily }}";
|
|
42
45
|
font-weight: 400;
|
|
43
46
|
font-style: normal;
|
|
44
47
|
font-variant: normal;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<html lang="en">
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="utf-8">
|
|
5
|
-
<title>{{
|
|
5
|
+
<title>{{ fontFamily }}</title>
|
|
6
6
|
<style type="text/css">
|
|
7
7
|
body {
|
|
8
8
|
margin: 0;
|
|
@@ -48,9 +48,13 @@
|
|
|
48
48
|
|
|
49
49
|
@font-face {
|
|
50
50
|
font-display: block;
|
|
51
|
-
font-family: "{{
|
|
51
|
+
font-family: "{{ fontFamily }}";
|
|
52
52
|
font-style: normal;
|
|
53
53
|
font-weight: 400;
|
|
54
|
+
{# Ligature preview types ASCII names; unicode-range limited to PUA blocks the font for those code points. #}
|
|
55
|
+
{% if unicodeRange and not (templateFontLigatures and ligatures) %}
|
|
56
|
+
unicode-range: {{ unicodeRange }};
|
|
57
|
+
{% endif %}
|
|
54
58
|
{% if formats.indexOf('eot')>-1 -%}
|
|
55
59
|
src: url("{{ fontPath }}{{ fontName }}.eot?{{ cacheString }}{% if hash %}&v={{ hash }}{% endif %}");
|
|
56
60
|
{%- endif %}
|
|
@@ -80,13 +84,13 @@
|
|
|
80
84
|
{%- if formats.length != 0 -%}, {% else -%}; {% endif -%}
|
|
81
85
|
{%- endif -%}
|
|
82
86
|
{%- if svgIndex != -1 -%}
|
|
83
|
-
url("{{ fontPath }}{{ fontName }}.svg?{{ cacheString }}{% if hash %}&v={{ hash }}{% endif %}#{{
|
|
87
|
+
url("{{ fontPath }}{{ fontName }}.svg?{{ cacheString }}{% if hash %}&v={{ hash }}{% endif %}#{{ svgFontId }}") format("svg");
|
|
84
88
|
{%- endif %}
|
|
85
89
|
}
|
|
86
90
|
|
|
87
91
|
.{{ className }} {
|
|
88
92
|
display: inline-block;
|
|
89
|
-
font-family: "{{
|
|
93
|
+
font-family: "{{ fontFamily }}";
|
|
90
94
|
font-weight: 400;
|
|
91
95
|
font-style: normal;
|
|
92
96
|
font-variant: normal;
|
|
@@ -177,6 +181,13 @@
|
|
|
177
181
|
margin-left: 0.3em;
|
|
178
182
|
}
|
|
179
183
|
|
|
184
|
+
{% if templateFontLigatures %}
|
|
185
|
+
#icon-ligatures .{{ className }} {
|
|
186
|
+
font-feature-settings: "liga" 1;
|
|
187
|
+
font-variant-ligatures: common-ligatures;
|
|
188
|
+
}
|
|
189
|
+
{% endif %}
|
|
190
|
+
|
|
180
191
|
{% for glyph in glyphs %}
|
|
181
192
|
.{{ className }}-{{ glyph.name }}::before {
|
|
182
193
|
content: "\{{ glyph.unicode[0].charCodeAt(0).toString(16) }}";
|
|
@@ -4,9 +4,12 @@
|
|
|
4
4
|
|
|
5
5
|
@font-face {
|
|
6
6
|
font-display: block;
|
|
7
|
-
font-family: "{{
|
|
7
|
+
font-family: "{{ fontFamily }}";
|
|
8
8
|
font-style: normal;
|
|
9
9
|
font-weight: 400;
|
|
10
|
+
{% if unicodeRange %}
|
|
11
|
+
unicode-range: {{ unicodeRange }};
|
|
12
|
+
{% endif %}
|
|
10
13
|
{% if formats.indexOf('eot')>-1 -%}
|
|
11
14
|
src: url("{{ fontPath }}{{ fontName }}.eot?{{ cacheString }}{% if hash %}&v={{ hash }}{% endif %}");
|
|
12
15
|
{%- endif -%}
|
|
@@ -36,13 +39,13 @@
|
|
|
36
39
|
{%- if formats.length != 0 -%}, {% else -%}; {% endif -%}
|
|
37
40
|
{%- endif -%}
|
|
38
41
|
{%- if svgIndex != -1 -%}
|
|
39
|
-
url("{{ fontPath }}{{ fontName }}.svg?{{ cacheString }}{% if hash %}&v={{ hash }}{% endif %}#{{
|
|
42
|
+
url("{{ fontPath }}{{ fontName }}.svg?{{ cacheString }}{% if hash %}&v={{ hash }}{% endif %}#{{ svgFontId }}") format("svg");
|
|
40
43
|
{%- endif %}
|
|
41
44
|
}
|
|
42
45
|
|
|
43
46
|
%{{ className }} {
|
|
44
47
|
display: inline-block;
|
|
45
|
-
font-family: "{{
|
|
48
|
+
font-family: "{{ fontFamily }}";
|
|
46
49
|
font-weight: 400;
|
|
47
50
|
font-style: normal;
|
|
48
51
|
font-variant: normal;
|
|
@@ -2,7 +2,10 @@
|
|
|
2
2
|
%}${{ className }}-{{ glyph.name }} = "\{{ glyph.unicode[0].charCodeAt(0).toString(16) }}";
|
|
3
3
|
{% endfor %}
|
|
4
4
|
@font-face {
|
|
5
|
-
font-family: {{
|
|
5
|
+
font-family: {{ fontFamily }};
|
|
6
|
+
{% if unicodeRange %}
|
|
7
|
+
unicode-range: {{ unicodeRange }};
|
|
8
|
+
{% endif %}
|
|
6
9
|
{% if formats.indexOf('eot')>-1 -%}
|
|
7
10
|
src: url("{{ fontPath }}{{ fontName }}.eot{% if hash %}?v={{ hash }}{% endif %}");
|
|
8
11
|
{%- endif -%}
|
|
@@ -32,7 +35,7 @@
|
|
|
32
35
|
{%- if formats.length != 0 -%}, {% else -%}; {% endif -%}
|
|
33
36
|
{%- endif -%}
|
|
34
37
|
{%- if svgIndex != -1 -%}
|
|
35
|
-
url("{{ fontPath }}{{ fontName }}.svg{% if hash %}?v={{ hash }}{% endif %}#{{
|
|
38
|
+
url("{{ fontPath }}{{ fontName }}.svg{% if hash %}?v={{ hash }}{% endif %}#{{ svgFontId }}") format("svg");
|
|
36
39
|
{%- endif %}
|
|
37
40
|
font-display: block;
|
|
38
41
|
font-style: normal;
|
|
@@ -43,7 +46,7 @@
|
|
|
43
46
|
display: inline-block;
|
|
44
47
|
transform: translate(0, 0);
|
|
45
48
|
text-rendering: auto;
|
|
46
|
-
font: normal normal 400 14px/1 {{
|
|
49
|
+
font: normal normal 400 14px/1 {{ fontFamily }};
|
|
47
50
|
font-size: inherit;
|
|
48
51
|
-moz-osx-font-smoothing: grayscale;
|
|
49
52
|
-webkit-font-smoothing: antialiased;
|