gpt4 book ai didi

SVG 图标在转换为 woff 后看起来不同

转载 作者:行者123 更新时间:2023-12-04 00:11:18 28 4
gpt4 key购买 nike

我正在使用 gulp-iconfont将一组 svg 图标转换为 woff 字体。

在图标转换为字体之前,它看起来如下:

enter image description here

它在 woff 文件中的显示方式:

enter image description here

我的 gulp 任务如下:

gulp.task('icon-font', function() {
gulp.src([paths.icons + '*.svg'])
.pipe(iconfont({
fontName: 'icons',
formats: ['woff'],
timestamp: timestamp,
appendUnicode: true
}))
.on('glyphs', function(glyphs, options) {
gulp.src(paths.templates + '/_icons.scss')
.pipe(template({ glyphs: glyphs, timestamp: timestamp }))
.pipe(gulp.dest(paths.styles));
})
.pipe(gulp.dest(paths.fonts + 'icons/')
);
});

My Illustrator 导出设置:

enter image description here

SVG代码:

<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 19.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="-183 185 32 32" style="enable-background:new -183 185 32 32;" xml:space="preserve">
<g>
<path d="M-175.6,190.5c-0.3-0.3-0.9-0.3-1.3,0c-4.7,4.7-4.7,12.4,0,17.1c0.2,0.2,0.5,0.5,0.7,0.7c0,0.1-0.1,0.2-0.1,0.3v6.7h-2.9
c-0.5,0-0.9,0.4-0.9,0.9s0.4,0.9,0.9,0.9h7.6c0.5,0,0.9-0.4,0.9-0.9c0-0.5-0.4-0.9-0.9-0.9h-2.9v-5.7c1.8,1.1,3.9,1.6,6.1,1.6
c3.2,0,6.3-1.3,8.5-3.5c0.2-0.2,0.3-0.4,0.3-0.6c0-0.2-0.1-0.5-0.3-0.6L-175.6,190.5z M-168.3,209.3c-2.7,0-5.3-1.1-7.3-3
c-3.8-3.8-4-9.8-0.6-13.9l14.5,14.5C-163.5,208.5-165.9,209.3-168.3,209.3z"/>
<path d="M-168,192.8c3.6,0,6.6,3,6.6,6.6c0,0.5,0.4,0.9,0.9,0.9c0.5,0,0.9-0.4,0.9-0.9c0-4.6-3.8-8.4-8.4-8.4
c-0.5,0-0.9,0.4-0.9,0.9C-168.9,192.4-168.5,192.8-168,192.8z"/>
<path d="M-157.8,189.1c-2.7-2.7-6.2-4.1-10-4.1c-0.5,0-0.9,0.4-0.9,0.9c0,0.5,0.4,0.9,0.9,0.9c3.3,0,6.4,1.3,8.7,3.6
c2.3,2.3,3.6,5.4,3.6,8.7c0,0.5,0.4,0.9,0.9,0.9c0.5,0,0.9-0.4,0.9-0.9C-153.6,195.3-155.1,191.8-157.8,189.1z"/>
</g>
</svg>

欢迎任何想法。

更新:

根据@nfroidure 中的一些建议,我将它们全部设为 300px x 300px,现在我得到了这个并添加了以下选项 fontHeight: 16normalize: true。产生以下内容:

enter image description here

最佳答案

您的 SVG 似乎太小了。尝试增加它们的大小或使用 fontHeight (> 1000) + normalize 选项来拉伸(stretch)它们。

关于SVG 图标在转换为 woff 后看起来不同,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34666129/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com