jaywcjlove / svgtofont

Read a set of SVG icons and ouput a TTF/EOT/WOFF/WOFF2/SVG font.
https://jaywcjlove.github.io/svgtofont
MIT License
580 stars 87 forks source link

v3.20.0 报错,麻烦帮忙看看什么问题,谢谢 #187

Closed lecykx closed 2 years ago

lecykx commented 2 years ago

A fontHeight of at least than 1000 is recommended, otherwise further steps (rounding in svg2ttf) could lead to ugly results. Use the fontHeight option to scale icons. Font created SUCCESS SVG font successfully created! ╰┈▶ /Users/lecykx/Documents/code/digital-diy/packages/service/storage/diy/iconfont/1/dlifeFont.svg SUCCESS TTF font successfully created! ╰┈▶ /Users/lecykx/Documents/code/digital-diy/packages/service/storage/diy/iconfont/1/dlifeFont.ttf SUCCESS EOT font successfully created! ╰┈▶ /Users/lecykx/Documents/code/digital-diy/packages/service/storage/diy/iconfont/1/dlifeFont.eot SUCCESS WOFF font successfully created! ╰┈▶ /Users/lecykx/Documents/code/digital-diy/packages/service/storage/diy/iconfont/1/dlifeFont.woff SUCCESS WOFF2 font successfully created! ╰┈▶ /Users/lecykx/Documents/code/digital-diy/packages/service/storage/diy/iconfont/1/dlifeFont.woff2 SvgToFont:CLI:ERR: Error: Unmatched selector: ="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">

编组 24
<g id="页面-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
    <g id="侧边栏图标切图" transform="translate(-31.000000, -338.000000)">

        <g id="Rectangle-8-Copy-2备份-12">
            <use fill="#303133" xlink:href="#path-1"></use>
            <use fill-opacity="0.04" fill="#FFFFFF" xlink:href="#path-1"></use>
        </g>
        <g id="编组-24" transform="translate(31.000000, 338.000000)">

            <g id="编组-10" transform="translate(0.500000, 0.000000)" fill="#FFFFFF">
                <path d="M14,1.09090909 C14.5522847,1.09090909 15,1.53862434 15,2.09090909 L15,15 C15,15.5522847 14.5522847,16 14,16 L1,16 C0.44771525,16 -1.5440923e-16,15.5522847 0,15 L0,2.09090909 C-6.76353751e-17,1.53862434 0.44771525,1.09090909 1,1.09090909 L4.125,1.09090909 L4.125,2.36290909 L1.3125,2.36363636 L1.3125,14.7272727 L13.6875,14.7272727 L13.6875,2.36363636 L10.875,2.36290909 L10.875,1.09090909 L14,1.09090909 Z" id="形状结合" fill-rule="nonzero"></path>
                <path d="M10.875,1 L10.875,2.63636364 C10.875,3.18864839 10.4272847,3.63636364 9.875,3.63636364 L5.125,3.63636364 C4.57271525,3.63636364 4.125,3.18864839 4.125,2.63636364 L4.125,1 C4.125,0.44771525 4.57271525,1.01453063e-16 5.125,0 L9.875,0 C10.4272847,-1.01453063e-16 10.875,0.44771525 10.875,1 Z M9.5625,1.27272727 L5.4375,1.27272727 L5.4375,2.36363636 L9.5625,2.36363636 L9.5625,1.27272727 Z" id="矩形" fill-rule="nonzero"></path>
                <path d="M6.421875,12 L3.65917969,9.30367505 C3.40493642,9.05553966 3.399985,8.64828129 3.64812039,8.39403802 C3.65176187,8.39030691 3.65544857,8.3866202 3.65917969,8.38297872 C3.92151587,8.12694485 4.34020288,8.12694485 4.60253906,8.38297872 L6.421875,10.1586074 L6.421875,10.1586074 L10.3974609,6.27852998 C10.6597971,6.02249611 11.0784841,6.02249611 11.3408203,6.27852998 C11.5950636,6.52666537 11.600015,6.93392374 11.3518796,7.18816701 C11.3482381,7.19189812 11.3445514,7.19558483 11.3408203,7.19922631 L6.421875,12 L6.421875,12 Z" id="路径"></path>
            </g>
        </g>
    </g>
</g>

at parse (/Users/lecykx/Documents/code/digital-diy/packages/service/node_modules/css-what/lib/commonjs/parse.js:85:15) at Object.select (/Users/lecykx/Documents/code/digital-diy/packages/service/node_modules/cheerio-select/lib/https:/raw.githubusercontent.com/cheeriojs/cheerio-select/ef063a6ca4c3f0d02d2fc3505e750b6fb81c448d/src/index.ts:213:51) at LoadedCheerio.find (/Users/lecykx/Documents/code/digital-diy/packages/service/node_modules/cheerio/lib/api/https:/raw.githubusercontent.com/cheeriojs/cheerio/d1cbc66d53392ce8bf6cd0068f675836372d2bf3/src/api/traversing.ts:82:28) at initialize (/Users/lecykx/Documents/code/digital-diy/packages/service/node_modules/cheerio/lib/https:/raw.githubusercontent.com/cheeriojs/cheerio/d1cbc66d53392ce8bf6cd0068f675836372d2bf3/src/load.ts:219:28) at /Users/lecykx/Documents/code/digital-diy/packages/service/node_modules/svgtofont/src/utils.ts:232:23 at Array.forEach () at /Users/lecykx/Documents/code/digital-diy/packages/service/node_modules/svgtofont/src/utils.ts:229:33 at new Promise () at createSvgSymbol (/Users/lecykx/Documents/code/digital-diy/packages/service/node_modules/svgtofont/src/utils.ts:228:10) at exports.default (/Users/lecykx/Documents/code/digital-diy/packages/service/node_modules/svgtofont/src/index.ts:246:26) node:internal/process/promises:288 triggerUncaughtException(err, true / fromPromise /); ^

[UnhandledPromiseRejection: This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason "undefined".] { code: 'ERR_UNHANDLED_REJECTION' }

Node.js v18.12.1

lecykx commented 2 years ago

解决了,因为svg格式的问题,需去掉<?xml version="1.0" standalone="no"?>

jaywcjlove commented 2 years ago

@lecykx ok

zhangxiaochuZXC commented 7 months ago

我也遇到了同样的报错,具体是什么格式问题造成的呢?

jaywcjlove commented 7 months ago

@zhangxiaochuZXC 排除法排除一下