webfont 12.0.0 → 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 +14 -2
- package/README.md +176 -15
- package/dist/browser.js +4 -0
- package/dist/cli.mjs +518 -253
- package/dist/index.js +1 -1
- 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 +2 -0
- package/dist/src/lib/applyOptimizeSvgToGlyphs.d.ts +3 -0
- package/dist/src/lib/evenoddFillRule.d.ts +2 -0
- package/dist/src/lib/inputSource.d.ts +1 -4
- 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/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/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 +5 -0
- package/dist/src/lib/svgicons2svgfont/metadataFromSrcPath.d.ts +11 -0
- package/dist/src/lib/templateUnicodeRange.d.ts +4 -0
- package/dist/src/lib/ttfEncode.d.ts +5 -0
- package/dist/src/standalone/convertTtfInput.d.ts +3 -0
- package/dist/src/standalone/defaultOptions.d.ts +3 -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 +1 -1
- package/dist/src/standalone/index.d.ts +5 -0
- package/dist/src/standalone/inputMode.d.ts +3 -1
- 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/validateWebfontOptions.d.ts +6 -0
- package/dist/src/standalone/webfontFromGlyphs.d.ts +3 -0
- package/dist/src/types/GlyphContentTransformFn.d.ts +2 -0
- package/dist/src/types/GlyphInput.d.ts +6 -0
- package/dist/src/types/InitialOptions.d.ts +2 -0
- package/dist/src/types/OptionsBase.d.ts +9 -1
- package/dist/src/types/RenderedTemplate.d.ts +7 -0
- package/dist/src/types/Result.d.ts +8 -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 +12 -2
- package/dist/src/types/index.d.ts +2 -1
- package/package.json +16 -3
- 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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "webfont",
|
|
3
|
-
"version": "12.
|
|
3
|
+
"version": "12.1.0",
|
|
4
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",
|
|
@@ -16,12 +16,23 @@
|
|
|
16
16
|
"NOTICE.md"
|
|
17
17
|
],
|
|
18
18
|
"main": "dist/index.js",
|
|
19
|
+
"browser": "dist/browser.js",
|
|
19
20
|
"bin": "dist/cli.mjs",
|
|
20
21
|
"source": "src/index.ts",
|
|
21
22
|
"types": "dist/src/index.d.ts",
|
|
22
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
|
+
},
|
|
23
34
|
"scripts": {
|
|
24
|
-
"build": "vite build --mode library && vite build --mode cli",
|
|
35
|
+
"build": "vite build --mode library && vite build --mode browser && vite build --mode cli",
|
|
25
36
|
"clean": "rm -rf dist/ temp/",
|
|
26
37
|
"demo": "node dist/cli.mjs './src/fixtures/svg-icons/*.svg' -d demo -t html --normalize --center-horizontally",
|
|
27
38
|
"lint": "biome check .",
|
|
@@ -35,7 +46,8 @@
|
|
|
35
46
|
"test": "vitest run src",
|
|
36
47
|
"testc": "vitest run src --coverage",
|
|
37
48
|
"test-debug": "vitest run src --no-file-parallelism",
|
|
38
|
-
"testu": "vitest run src -u"
|
|
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'"
|
|
39
51
|
},
|
|
40
52
|
"dependencies": {
|
|
41
53
|
"cosmiconfig": "9.0.2",
|
|
@@ -48,6 +60,7 @@
|
|
|
48
60
|
"resolve-from": "^5.0.0",
|
|
49
61
|
"svg2ttf": "^6.1.0",
|
|
50
62
|
"svgicons2svgfont": "^16.0.0",
|
|
63
|
+
"svgo": "4.0.1",
|
|
51
64
|
"ttf2eot": "3.1.0",
|
|
52
65
|
"ttf2woff": "^3.0.0",
|
|
53
66
|
"wawoff2": "2.0.0",
|
|
@@ -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;
|