gpt4 book ai didi

javascript - 使用 icomoon 将 SVG 转换为字体图标

转载 作者:行者123 更新时间:2023-12-01 15:54:43 26 4
gpt4 key购买 nike

我有一个 svg,当它在任何浏览器中打开时都很好。我正在尝试使用 http://icomoon.io/ 将它们转换为字体图标但是导入后它没有正确显示。我尝试使用 http://fontastic.me/也一样,但没有运气。

这是 SVG 图像标记 -

 <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="Layer_1" x="0px" y="0px" width="400px" height="400px" viewBox="0 0 400 400" enable-background="new 0 0 400 400" xml:space="preserve" style="
color: red;
">
<path fill="none" stroke="#231F20" stroke-width="15" stroke-miterlimit="10" d="M323.41,321.664c0,0.457-0.371,0.828-0.828,0.828 H88.835c-0.458,0-0.829-0.371-0.829-0.828V87.918c0-0.459,0.371-0.829,0.829-0.829h233.747c0.457,0,0.828,0.37,0.828,0.829V321.664z " style="
color: red;
"/>
<path fill="none" stroke="#231F20" stroke-width="15" stroke-miterlimit="10" d="M215.311,196.935"/>
<path fill="none" stroke="#231F20" stroke-width="15" stroke-miterlimit="10" d="M250.935,277.399 c25.36-14.769,42.409-42.247,42.409-73.71c0-47.078-38.164-85.242-85.242-85.242s-85.242,38.164-85.242,85.242 c0,31.463,17.048,58.941,42.408,73.71"/>
<g>
<path fill="#231F20" d="M173.653,282.14l-4.741-48.439c-0.059-0.58-0.327-1.092-0.715-1.482l-47.088,54.471 c0.48,0.449,1.127,0.714,1.82,0.676l48.578-2.721C172.82,284.568,173.783,283.448,173.653,282.14z"/>
</g>
<text transform="matrix(1 0 0 1 175.665 231.1914)" fill="#231F20" stroke="#231F20" stroke-width="2" stroke-miterlimit="10" font-family="'Helvetica'" font-size="99.4919">A</text>
</svg>

我猜这与图像的创建方式有关,但找不到太多关于如何解决问题的资源。任何帮助都是极好的!

谢谢。

最佳答案

IcoMoon 将忽略笔画属性和文本对象。它只对填充的形状感兴趣。在您的情况下,这意味着它只会在圆形曲线的末端导入三 Angular 形。

您需要将路径和文本转换为填充形状。在 Inkscape 中,尝试选择您的作品并按 CtrlShiftC。在 Illustrator 中,路径菜单中的某处有一个轮廓描边选项,如果我没记错的话,用于将文本转换为轮廓的命令是 Mac 上的 ⌘ShiftC(否则可能是 ControlShiftC)。

如果您有任何重叠的对象,它们可能也必须合并在一起。

不要期望完美的结果。 IcoMoon 做得很合理,但在某些情况下它可能会将曲线转换为直线。

关于javascript - 使用 icomoon 将 SVG 转换为字体图标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24252209/

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