fontmin-rs 0.1.0 → 0.1.1
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 +1 -4
- package/bin/fontmin-rs.mjs +206 -30
- package/dist/{compat-BxDug9v3.mjs → compat-BzwWTy_g.mjs} +2 -2
- package/dist/compat.mjs +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -3,13 +3,10 @@
|
|
|
3
3
|
Fast font subsetting and conversion tooling powered by Rust, with CLI, Node.js,
|
|
4
4
|
and browser WASM APIs.
|
|
5
5
|
|
|
6
|
-
> `fontmin-rs` is in the `0.1.0` release-candidate cycle. Install the `rc`
|
|
7
|
-
> dist-tag until the first stable release.
|
|
8
|
-
|
|
9
6
|
## Install
|
|
10
7
|
|
|
11
8
|
```sh
|
|
12
|
-
pnpm add fontmin-rs
|
|
9
|
+
pnpm add fontmin-rs
|
|
13
10
|
```
|
|
14
11
|
|
|
15
12
|
## Quick start
|
package/bin/fontmin-rs.mjs
CHANGED
|
@@ -53,7 +53,7 @@ const DEFAULT_CONFIG_FILES = [
|
|
|
53
53
|
const MODULE_CONFIG_EXTENSIONS = new Set(['.ts', '.mts', '.mjs', '.cjs'])
|
|
54
54
|
const INIT_CONFIG_FILE = 'fontmin.config.jsonc'
|
|
55
55
|
const CACHE_SCHEMA_VERSION = 'v1'
|
|
56
|
-
const FONTMIN_VERSION = '0.1.
|
|
56
|
+
const FONTMIN_VERSION = '0.1.1'
|
|
57
57
|
const DEFAULT_CACHE_DIR = 'node_modules/.cache/fontmin-rs'
|
|
58
58
|
let emitWarnings = true
|
|
59
59
|
let temporaryFileCounter = 0
|
|
@@ -276,6 +276,12 @@ async function runBuildCommand(args) {
|
|
|
276
276
|
const noOriginal = readFlag(args, ['--no-original'])
|
|
277
277
|
readFlag(args, ['-d', '--deflate-woff'])
|
|
278
278
|
const cssGlyph = readFlag(args, ['--css-glyph'])
|
|
279
|
+
const cssUnicodeRanges = parseUnicodeRanges(
|
|
280
|
+
readOptions(args, ['--css-unicode-range']),
|
|
281
|
+
)
|
|
282
|
+
const deliverySlices = parseDeliverySlices(
|
|
283
|
+
readOptions(args, ['--delivery-slice']),
|
|
284
|
+
)
|
|
279
285
|
const outDir = readOption(args, ['-o', '--out-dir'])
|
|
280
286
|
const formats = readOption(args, ['--formats'])
|
|
281
287
|
const preset = readOption(args, ['--preset'])
|
|
@@ -302,6 +308,8 @@ async function runBuildCommand(args) {
|
|
|
302
308
|
formats,
|
|
303
309
|
inputs: [...args],
|
|
304
310
|
cacheOverride,
|
|
311
|
+
cssUnicodeRanges,
|
|
312
|
+
deliverySlices,
|
|
305
313
|
outDir,
|
|
306
314
|
variationCoordinates,
|
|
307
315
|
})
|
|
@@ -312,6 +320,8 @@ async function runBuildCommand(args) {
|
|
|
312
320
|
basicText,
|
|
313
321
|
cacheOverride,
|
|
314
322
|
cssGlyph,
|
|
323
|
+
cssUnicodeRanges,
|
|
324
|
+
deliverySlices,
|
|
315
325
|
fontFamily,
|
|
316
326
|
fontPath,
|
|
317
327
|
formats,
|
|
@@ -334,6 +344,8 @@ async function runBuildCommand(args) {
|
|
|
334
344
|
fontPath,
|
|
335
345
|
formats,
|
|
336
346
|
cacheOverride,
|
|
347
|
+
cssUnicodeRanges,
|
|
348
|
+
deliverySlices,
|
|
337
349
|
outDir,
|
|
338
350
|
variationCoordinates,
|
|
339
351
|
})
|
|
@@ -344,6 +356,8 @@ async function runBuildCommand(args) {
|
|
|
344
356
|
basicText,
|
|
345
357
|
cacheOverride,
|
|
346
358
|
cssGlyph,
|
|
359
|
+
cssUnicodeRanges,
|
|
360
|
+
deliverySlices,
|
|
347
361
|
fontFamily,
|
|
348
362
|
fontPath,
|
|
349
363
|
formats,
|
|
@@ -382,6 +396,7 @@ async function runBuildCommand(args) {
|
|
|
382
396
|
[],
|
|
383
397
|
{},
|
|
384
398
|
cacheOptions,
|
|
399
|
+
cssUnicodeRanges,
|
|
385
400
|
)
|
|
386
401
|
return
|
|
387
402
|
}
|
|
@@ -407,6 +422,8 @@ async function runBuildCommand(args) {
|
|
|
407
422
|
basicText,
|
|
408
423
|
cacheOptions,
|
|
409
424
|
cssGlyph,
|
|
425
|
+
cssUnicodeRanges,
|
|
426
|
+
deliverySlices,
|
|
410
427
|
fontFamily,
|
|
411
428
|
fontPath,
|
|
412
429
|
outputFormats,
|
|
@@ -423,6 +440,8 @@ async function buildDirectInput(
|
|
|
423
440
|
basicText,
|
|
424
441
|
cacheOptions,
|
|
425
442
|
cssGlyph,
|
|
443
|
+
cssUnicodeRanges,
|
|
444
|
+
deliverySlices,
|
|
426
445
|
fontFamily,
|
|
427
446
|
fontPath,
|
|
428
447
|
outputFormats,
|
|
@@ -441,6 +460,8 @@ async function buildDirectInput(
|
|
|
441
460
|
options: {
|
|
442
461
|
basicText,
|
|
443
462
|
cssGlyph,
|
|
463
|
+
cssUnicodeRanges,
|
|
464
|
+
deliverySlices,
|
|
444
465
|
fontFamily,
|
|
445
466
|
fontPath,
|
|
446
467
|
outputFormats,
|
|
@@ -471,19 +492,35 @@ async function buildDirectInput(
|
|
|
471
492
|
unicodes: subsetOptions.unicodes,
|
|
472
493
|
})
|
|
473
494
|
const cssGlyphs = cssGlyph ? cssGlyphsFromSubset(subsetOptions) : []
|
|
495
|
+
const fontSources =
|
|
496
|
+
deliverySlices.length === 0
|
|
497
|
+
? [{ baseName, contents: source }]
|
|
498
|
+
: deliverySlices.map(slice => ({
|
|
499
|
+
baseName: `${baseName}-${slice.name}`,
|
|
500
|
+
contents: subsetTtf(source, {
|
|
501
|
+
missingGlyphs: 'ignore',
|
|
502
|
+
unicodeRanges: slice.unicodeRanges,
|
|
503
|
+
}),
|
|
504
|
+
unicodeRanges: slice.unicodeRanges,
|
|
505
|
+
}))
|
|
474
506
|
const cssSources = []
|
|
475
507
|
const outputs = []
|
|
476
508
|
|
|
477
|
-
for (const
|
|
478
|
-
const
|
|
479
|
-
|
|
509
|
+
for (const fontSource of fontSources) {
|
|
510
|
+
for (const format of outputFormats.filter(format => format !== 'css')) {
|
|
511
|
+
const fileName = `${fontSource.baseName}.${format}`
|
|
512
|
+
const output = convertFont(fontSource.contents, format)
|
|
480
513
|
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
514
|
+
outputs.push({ contents: output, fileName })
|
|
515
|
+
cssSources.push({
|
|
516
|
+
...(cssGlyphs.length > 0 && { glyphs: cssGlyphs }),
|
|
517
|
+
...(fontSource.unicodeRanges !== undefined && {
|
|
518
|
+
unicodeRanges: fontSource.unicodeRanges,
|
|
519
|
+
}),
|
|
520
|
+
fileName,
|
|
521
|
+
format,
|
|
522
|
+
})
|
|
523
|
+
}
|
|
487
524
|
}
|
|
488
525
|
|
|
489
526
|
if (outputFormats.includes('css')) {
|
|
@@ -497,9 +534,10 @@ async function buildDirectInput(
|
|
|
497
534
|
fontFamily: fontFamily ?? baseName,
|
|
498
535
|
fontPath: fontPath ?? './',
|
|
499
536
|
glyph: cssGlyph,
|
|
537
|
+
unicodeRanges: cssUnicodeRanges,
|
|
500
538
|
}),
|
|
501
539
|
),
|
|
502
|
-
fileName: `${baseName}.css`,
|
|
540
|
+
fileName: `${fontSources[0].baseName}.css`,
|
|
503
541
|
})
|
|
504
542
|
}
|
|
505
543
|
|
|
@@ -530,6 +568,7 @@ async function buildIconfontCommand(
|
|
|
530
568
|
outputs = [],
|
|
531
569
|
css = {},
|
|
532
570
|
cacheOptions = normalizeCacheOptions(undefined, process.cwd()),
|
|
571
|
+
cssUnicodeRanges = css.unicodeRanges ?? [],
|
|
533
572
|
) {
|
|
534
573
|
if (inputs.length === 0) {
|
|
535
574
|
throw new Error('build requires at least one input font')
|
|
@@ -602,6 +641,7 @@ async function buildIconfontCommand(
|
|
|
602
641
|
glyph: true,
|
|
603
642
|
iconPrefix: css.iconPrefix,
|
|
604
643
|
local: css.local,
|
|
644
|
+
unicodeRanges: cssUnicodeRanges,
|
|
605
645
|
},
|
|
606
646
|
),
|
|
607
647
|
),
|
|
@@ -622,6 +662,8 @@ async function buildConfigCommand(
|
|
|
622
662
|
basicText,
|
|
623
663
|
cacheOverride,
|
|
624
664
|
cssGlyph,
|
|
665
|
+
cssUnicodeRanges = [],
|
|
666
|
+
deliverySlices = [],
|
|
625
667
|
fontFamily,
|
|
626
668
|
fontPath,
|
|
627
669
|
formats,
|
|
@@ -659,14 +701,25 @@ async function buildConfigCommand(
|
|
|
659
701
|
|
|
660
702
|
const inputPaths = await expandInputPaths(inputs, cwd)
|
|
661
703
|
|
|
662
|
-
if (
|
|
704
|
+
if (
|
|
705
|
+
fontFamily !== undefined ||
|
|
706
|
+
fontPath !== undefined ||
|
|
707
|
+
cssGlyph === true ||
|
|
708
|
+
cssUnicodeRanges.length > 0
|
|
709
|
+
) {
|
|
663
710
|
config.css = {
|
|
664
711
|
...config.css,
|
|
665
712
|
...(cssGlyph === true && { glyph: true }),
|
|
713
|
+
...(cssUnicodeRanges.length > 0 && {
|
|
714
|
+
unicodeRanges: cssUnicodeRanges,
|
|
715
|
+
}),
|
|
666
716
|
...(fontFamily !== undefined && { fontFamily }),
|
|
667
717
|
...(fontPath !== undefined && { fontPath }),
|
|
668
718
|
}
|
|
669
719
|
}
|
|
720
|
+
if (deliverySlices.length > 0) {
|
|
721
|
+
config.delivery = { slices: deliverySlices }
|
|
722
|
+
}
|
|
670
723
|
|
|
671
724
|
applySubsetOverrides(config, { basicText, subsetOptions })
|
|
672
725
|
|
|
@@ -693,6 +746,8 @@ async function buildIconfontConfigCommand(
|
|
|
693
746
|
configPath,
|
|
694
747
|
{
|
|
695
748
|
cacheOverride,
|
|
749
|
+
cssUnicodeRanges = [],
|
|
750
|
+
deliverySlices = [],
|
|
696
751
|
fontFamily,
|
|
697
752
|
fontPath,
|
|
698
753
|
formats,
|
|
@@ -718,6 +773,13 @@ async function buildIconfontConfigCommand(
|
|
|
718
773
|
const css = config.css ?? {}
|
|
719
774
|
const cacheOptions = normalizeCacheOptions(config.cache, cwd, cacheOverride)
|
|
720
775
|
|
|
776
|
+
if (cssUnicodeRanges.length > 0) {
|
|
777
|
+
css.unicodeRanges = cssUnicodeRanges
|
|
778
|
+
}
|
|
779
|
+
if (deliverySlices.length > 0) {
|
|
780
|
+
config.delivery = { slices: deliverySlices }
|
|
781
|
+
}
|
|
782
|
+
|
|
721
783
|
if (config.clean === true) {
|
|
722
784
|
await cleanOutputDirectory(cwd, outDir, [resolvedConfigPath, ...inputs])
|
|
723
785
|
}
|
|
@@ -730,6 +792,7 @@ async function buildIconfontConfigCommand(
|
|
|
730
792
|
config.outputs ?? [],
|
|
731
793
|
css,
|
|
732
794
|
cacheOptions,
|
|
795
|
+
css.unicodeRanges,
|
|
733
796
|
)
|
|
734
797
|
}
|
|
735
798
|
|
|
@@ -806,6 +869,7 @@ async function buildConfigInput(
|
|
|
806
869
|
const ttfContents = convertFont(contents, 'ttf', { variationCoordinates })
|
|
807
870
|
const subset = await resolveSubsetTextFile(config.subset ?? {}, cwd)
|
|
808
871
|
const unicodes = subset.unicodes ?? []
|
|
872
|
+
const deliverySlices = normalizeDeliverySlices(config.delivery?.slices ?? [])
|
|
809
873
|
const cacheKey = cacheOptions.enabled
|
|
810
874
|
? cacheKeyForBuildInput({
|
|
811
875
|
contents,
|
|
@@ -813,6 +877,7 @@ async function buildConfigInput(
|
|
|
813
877
|
kind: 'config',
|
|
814
878
|
options: {
|
|
815
879
|
css: config.css,
|
|
880
|
+
deliverySlices,
|
|
816
881
|
outputFormats,
|
|
817
882
|
outputs: config.outputs,
|
|
818
883
|
subset,
|
|
@@ -844,21 +909,41 @@ async function buildConfigInput(
|
|
|
844
909
|
const baseName = basename(input, extname(input))
|
|
845
910
|
const css = config.css ?? {}
|
|
846
911
|
const cssGlyphs = css.glyph === true ? cssGlyphsFromSubset(subset) : []
|
|
912
|
+
const fontSources =
|
|
913
|
+
deliverySlices.length === 0
|
|
914
|
+
? [{ baseName, contents: source }]
|
|
915
|
+
: deliverySlices.map(slice => ({
|
|
916
|
+
baseName: `${baseName}-${slice.name}`,
|
|
917
|
+
contents: subsetTtf(source, {
|
|
918
|
+
missingGlyphs: 'ignore',
|
|
919
|
+
unicodeRanges: slice.unicodeRanges,
|
|
920
|
+
}),
|
|
921
|
+
unicodeRanges: slice.unicodeRanges,
|
|
922
|
+
}))
|
|
847
923
|
const cssSources = []
|
|
848
924
|
const outputs = config.outputs ?? []
|
|
849
925
|
const buildOutputs = []
|
|
850
926
|
|
|
851
|
-
for (const
|
|
852
|
-
const
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
927
|
+
for (const fontSource of fontSources) {
|
|
928
|
+
for (const format of outputFormats.filter(format => format !== 'css')) {
|
|
929
|
+
const fileName = outputFileName(
|
|
930
|
+
outputs,
|
|
931
|
+
format,
|
|
932
|
+
`${fontSource.baseName}.${format}`,
|
|
933
|
+
)
|
|
934
|
+
const output = convertFont(fontSource.contents, format)
|
|
935
|
+
|
|
936
|
+
buildOutputs.push({ contents: output, fileName })
|
|
937
|
+
cssSources.push({
|
|
938
|
+
...(css.base64 === true && { contents: output }),
|
|
939
|
+
...(cssGlyphs.length > 0 && { glyphs: cssGlyphs }),
|
|
940
|
+
...(fontSource.unicodeRanges !== undefined && {
|
|
941
|
+
unicodeRanges: fontSource.unicodeRanges,
|
|
942
|
+
}),
|
|
943
|
+
fileName,
|
|
944
|
+
format,
|
|
945
|
+
})
|
|
946
|
+
}
|
|
862
947
|
}
|
|
863
948
|
|
|
864
949
|
if (outputFormats.includes('css')) {
|
|
@@ -884,6 +969,7 @@ async function buildConfigInput(
|
|
|
884
969
|
glyph: css.glyph,
|
|
885
970
|
iconPrefix: css.iconPrefix,
|
|
886
971
|
local: css.local,
|
|
972
|
+
unicodeRanges: css.unicodeRanges,
|
|
887
973
|
}),
|
|
888
974
|
),
|
|
889
975
|
fileName: cssFileName,
|
|
@@ -1556,6 +1642,97 @@ function filterOriginalOutput(formats, noOriginal) {
|
|
|
1556
1642
|
return noOriginal ? formats.filter(format => format !== 'ttf') : formats
|
|
1557
1643
|
}
|
|
1558
1644
|
|
|
1645
|
+
function parseUnicodeRanges(values) {
|
|
1646
|
+
return values.map(value => parseUnicodeRange(value))
|
|
1647
|
+
}
|
|
1648
|
+
|
|
1649
|
+
function formatUnicodeEndpoint(codePoint) {
|
|
1650
|
+
return codePoint.toString(16).toUpperCase().padStart(4, '0')
|
|
1651
|
+
}
|
|
1652
|
+
|
|
1653
|
+
function parseUnicodeRange(value) {
|
|
1654
|
+
const match =
|
|
1655
|
+
/^u\+(?<start>[0-9a-f]{1,6})(?:-(?<end>[0-9a-f]{1,6}))?$/iu.exec(value)
|
|
1656
|
+
|
|
1657
|
+
if (match?.groups === undefined) {
|
|
1658
|
+
throw new Error(`invalid Unicode range: ${value}`)
|
|
1659
|
+
}
|
|
1660
|
+
|
|
1661
|
+
const start = Number.parseInt(match.groups.start, 16)
|
|
1662
|
+
const end = Number.parseInt(match.groups.end ?? match.groups.start, 16)
|
|
1663
|
+
|
|
1664
|
+
if (start > end || end > 0x10_ff_ff || (start <= 0xdf_ff && end >= 0xd8_00)) {
|
|
1665
|
+
throw new Error(`invalid Unicode range: ${value}`)
|
|
1666
|
+
}
|
|
1667
|
+
|
|
1668
|
+
return start === end
|
|
1669
|
+
? `U+${formatUnicodeEndpoint(start)}`
|
|
1670
|
+
: `U+${formatUnicodeEndpoint(start)}-${formatUnicodeEndpoint(end)}`
|
|
1671
|
+
}
|
|
1672
|
+
|
|
1673
|
+
function parseDeliverySlices(values) {
|
|
1674
|
+
const slices = []
|
|
1675
|
+
|
|
1676
|
+
for (const value of values) {
|
|
1677
|
+
const separator = value.indexOf(':')
|
|
1678
|
+
|
|
1679
|
+
if (separator === -1) {
|
|
1680
|
+
throw new Error(`delivery slice must use NAME:RANGE[,RANGE...]: ${value}`)
|
|
1681
|
+
}
|
|
1682
|
+
|
|
1683
|
+
const name = value.slice(0, separator)
|
|
1684
|
+
const unicodeRanges = value.slice(separator + 1).split(',')
|
|
1685
|
+
const existing = slices.find(slice => slice.name === name)
|
|
1686
|
+
|
|
1687
|
+
if (existing === undefined) {
|
|
1688
|
+
slices.push({ name, unicodeRanges })
|
|
1689
|
+
} else {
|
|
1690
|
+
existing.unicodeRanges.push(...unicodeRanges)
|
|
1691
|
+
}
|
|
1692
|
+
}
|
|
1693
|
+
|
|
1694
|
+
return normalizeDeliverySlices(slices)
|
|
1695
|
+
}
|
|
1696
|
+
|
|
1697
|
+
function normalizeDeliverySlices(values) {
|
|
1698
|
+
if (!Array.isArray(values)) {
|
|
1699
|
+
throw new TypeError('delivery slices must be an array')
|
|
1700
|
+
}
|
|
1701
|
+
|
|
1702
|
+
const names = new Set()
|
|
1703
|
+
|
|
1704
|
+
return values.map((value, index) => {
|
|
1705
|
+
if (typeof value !== 'object' || value === null || Array.isArray(value)) {
|
|
1706
|
+
throw new Error(`delivery slice ${index + 1} must be an object`)
|
|
1707
|
+
}
|
|
1708
|
+
|
|
1709
|
+
const { name, unicodeRanges } = value
|
|
1710
|
+
|
|
1711
|
+
if (
|
|
1712
|
+
typeof name !== 'string' ||
|
|
1713
|
+
name.length === 0 ||
|
|
1714
|
+
!/^[A-Za-z0-9_-]+$/u.test(name)
|
|
1715
|
+
) {
|
|
1716
|
+
throw new Error(`invalid delivery slice name: ${name}`)
|
|
1717
|
+
}
|
|
1718
|
+
if (names.has(name)) {
|
|
1719
|
+
throw new Error(`duplicate delivery slice name: ${name}`)
|
|
1720
|
+
}
|
|
1721
|
+
if (!Array.isArray(unicodeRanges) || unicodeRanges.length === 0) {
|
|
1722
|
+
throw new Error(
|
|
1723
|
+
`delivery slice \`${name}\` requires at least one Unicode range`,
|
|
1724
|
+
)
|
|
1725
|
+
}
|
|
1726
|
+
|
|
1727
|
+
names.add(name)
|
|
1728
|
+
|
|
1729
|
+
return {
|
|
1730
|
+
name,
|
|
1731
|
+
unicodeRanges: parseUnicodeRanges(unicodeRanges),
|
|
1732
|
+
}
|
|
1733
|
+
})
|
|
1734
|
+
}
|
|
1735
|
+
|
|
1559
1736
|
function parseUnicodes(value) {
|
|
1560
1737
|
if (value === undefined) {
|
|
1561
1738
|
return []
|
|
@@ -1818,13 +1995,12 @@ async function writeOutput(output, contents) {
|
|
|
1818
1995
|
|
|
1819
1996
|
function usage(stream) {
|
|
1820
1997
|
stream.write(`Usage:
|
|
1821
|
-
fontmin-rs subset <
|
|
1822
|
-
fontmin-rs coverage <
|
|
1823
|
-
fontmin-rs convert <
|
|
1824
|
-
fontmin-rs build <
|
|
1825
|
-
fontmin-rs
|
|
1826
|
-
fontmin-rs
|
|
1827
|
-
fontmin-rs inspect <input.ttf> [--json]
|
|
1998
|
+
fontmin-rs subset <INPUT> -o|--output <OUTPUT> (-t|--text <TEXT> | --text-file <FILE> | --unicodes <LIST> | -b|--basic-text) [--missing-glyphs <ignore|warn|error>]
|
|
1999
|
+
fontmin-rs coverage <INPUT> (-t|--text <TEXT> | --text-file <FILE> | --unicodes <LIST> | -b|--basic-text) [--json]
|
|
2000
|
+
fontmin-rs convert <INPUT> -f|--format <ttf|woff|woff2|eot|svg> -o|--output <OUTPUT> [--variation <TAG=VALUE>]...
|
|
2001
|
+
fontmin-rs build <INPUT...> [-c|--config <CONFIG>] [-o|--out-dir <OUT_DIR>] [-t|--text <TEXT>] [--text-file <FILE>] [--unicodes <LIST>] [-b|--basic-text] [--missing-glyphs <ignore|warn|error>] [-d|--deflate-woff] [-T|--show-time] [--silent] [--cache] [--no-cache] [--css-glyph] [--css-unicode-range <RANGE>]... [--delivery-slice <NAME:RANGE[,RANGE...]>]... [--variation <TAG=VALUE>]... [--formats <FORMATS>] [--preset <compat|modern-web|iconfont>] [--no-original] [--font-family <FONT_FAMILY>] [--font-path <FONT_PATH>]
|
|
2002
|
+
fontmin-rs bench <INPUT> [-t|--text <TEXT>] [--text-file <FILE>] [--unicodes <LIST>] [-b|--basic-text] [--json]
|
|
2003
|
+
fontmin-rs inspect <INPUT> [--json]
|
|
1828
2004
|
fontmin-rs init
|
|
1829
2005
|
fontmin-rs doctor
|
|
1830
2006
|
`)
|
|
@@ -512,7 +512,7 @@ function assertWasmOptionSupported(operation, name, value) {
|
|
|
512
512
|
//#endregion
|
|
513
513
|
//#region src/optimize.ts
|
|
514
514
|
const CACHE_SCHEMA_VERSION = "v1";
|
|
515
|
-
const FONTMIN_VERSION = "0.1.
|
|
515
|
+
const FONTMIN_VERSION = "0.1.1";
|
|
516
516
|
const DEFAULT_CACHE_DIR = "node_modules/.cache/fontmin-rs";
|
|
517
517
|
const DEFAULT_SVG_ICON_START_UNICODE = 57345;
|
|
518
518
|
const CSS_GLYPHS_META_KEY = "cssGlyphs";
|
|
@@ -1044,7 +1044,7 @@ async function runSvgs2Ttf(assets, options, runtime) {
|
|
|
1044
1044
|
const nonSvgAssets = assets.filter((asset) => asset.format !== "svg");
|
|
1045
1045
|
const firstSvg = svgAssets[0];
|
|
1046
1046
|
if (firstSvg === void 0) return assets;
|
|
1047
|
-
const fontName = typeof options["fontName"] === "string" ? options["fontName"] :
|
|
1047
|
+
const fontName = typeof options["fontName"] === "string" ? options["fontName"] : "iconfont";
|
|
1048
1048
|
const icons = svgAssets.map((asset, index) => svgIconFromAsset(asset, index));
|
|
1049
1049
|
const cssGlyphs = cssGlyphsFromSvgIcons(icons, typeof options["startUnicode"] === "number" ? options["startUnicode"] : DEFAULT_SVG_ICON_START_UNICODE);
|
|
1050
1050
|
const ttfAsset = {
|
package/dist/compat.mjs
CHANGED
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as woff2ToTtf, a as generateFontFaceCss, b as defineConfig, c as subsetTtf, d as ttfToEot, f as ttfToSvg, g as validateWoff2, h as ttfToWoff2Async, i as eotToTtf, l as svgFontToTtf, m as ttfToWoff2, n as optimize, o as inspect, p as ttfToWoff, r as analyzeCoverage, s as otfToTtf, t as FontminCompat, u as svgsToTtf, v as woffToTtf, x as loadConfig, y as FontminDiagnosticError } from "./compat-
|
|
1
|
+
import { _ as woff2ToTtf, a as generateFontFaceCss, b as defineConfig, c as subsetTtf, d as ttfToEot, f as ttfToSvg, g as validateWoff2, h as ttfToWoff2Async, i as eotToTtf, l as svgFontToTtf, m as ttfToWoff2, n as optimize, o as inspect, p as ttfToWoff, r as analyzeCoverage, s as otfToTtf, t as FontminCompat, u as svgsToTtf, v as woffToTtf, x as loadConfig, y as FontminDiagnosticError } from "./compat-BzwWTy_g.mjs";
|
|
2
2
|
import { css, definePlugin, deliverySlices, glyph, modernWeb, otf2ttf, svg2ttf, svgs2ttf, ttf2eot, ttf2svg, ttf2woff, ttf2woff2 } from "./plugins.mjs";
|
|
3
3
|
import { fontminCompatPreset } from "./presets.mjs";
|
|
4
4
|
export { FontminDiagnosticError, analyzeCoverage, css, FontminCompat as default, defineConfig, definePlugin, deliverySlices, eotToTtf, fontminCompatPreset, generateFontFaceCss, glyph, inspect, loadConfig, modernWeb, optimize, otf2ttf, otfToTtf, subsetTtf, svg2ttf, svgFontToTtf, svgs2ttf, svgsToTtf, ttf2eot, ttf2svg, ttf2woff, ttf2woff2, ttfToEot, ttfToSvg, ttfToWoff, ttfToWoff2, ttfToWoff2Async, validateWoff2, woff2ToTtf, woffToTtf };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fontmin-rs",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Fast font subsetter and converter written in Rust with Node.js bindings.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"font",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"dependencies": {
|
|
59
59
|
"jsonc-parser": "^3.3.1",
|
|
60
60
|
"tinyglobby": "^0.2.17",
|
|
61
|
-
"@fontmin-rs/wasm": "0.1.
|
|
61
|
+
"@fontmin-rs/wasm": "0.1.1"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
64
|
"@ntnyq/tsconfig": "^3.1.0",
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
"vitest": "^4.1.10"
|
|
71
71
|
},
|
|
72
72
|
"optionalDependencies": {
|
|
73
|
-
"@fontmin-rs/binding": "0.1.
|
|
73
|
+
"@fontmin-rs/binding": "0.1.1"
|
|
74
74
|
},
|
|
75
75
|
"engines": {
|
|
76
76
|
"node": ">=22.0.0"
|