purplebamboo / font-carrier

font-carrier是一个功能强大的字体操作库,使用它你可以随心所欲的操作字体。让你可以在svg的维度改造字体的展现形状。
http://purplebamboo.github.io/font-carrier/
MIT License
1.61k stars 194 forks source link

部分 svg 图标生成字体后,页面引用不显示 #57

Closed Baiang closed 3 years ago

Baiang commented 3 years ago

SVG 图标代码

<svg class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"><path d="M93.1 201.4h187.1v202.1H93.1z" fill="#2E97FF"></path><path d="M295.2 171.4H78.1c-8.3 0-15 6.7-15 15v651.3c0 8.3 6.7 15 15 15h121.8c0.4 0 0.8 0 1.3-0.1 0.2 0 0.5-0.1 0.7-0.1 0.2 0 0.5-0.1 0.7-0.1 0.2 0 0.5-0.1 0.7-0.2 0.2-0.1 0.5-0.1 0.7-0.2 0.2-0.1 0.4-0.2 0.6-0.2 0.2-0.1 0.5-0.2 0.7-0.3l0.6-0.3c0.3-0.1 0.5-0.2 0.8-0.4 0.2-0.1 0.3-0.2 0.5-0.3 0.3-0.1 0.5-0.3 0.8-0.4 0.2-0.1 0.4-0.3 0.6-0.5 0.2-0.1 0.4-0.3 0.6-0.4 0.4-0.3 0.8-0.6 1.1-1l95.6-95.5c2.3-2.3 3.8-5.3 4.2-8.4 0-0.2 0-0.3 0.1-0.5 0-0.2 0-0.4 0.1-0.6v-0.9-555.9c-0.1-8.3-6.8-15-15.1-15z m-80.6 630V757H259l-44.4 44.4zM93.1 403.5V201.4h187.1v525.7h-80.6c-8.3 0-15 6.7-15 15v80.6H93.1V403.5z" fill=""></path><path d="M419 202.6h187.1v202.1H419z" fill="#2E97FF"></path><path d="M621.2 172.6H404c-8.3 0-15 6.7-15 15v651.3c0 8.3 6.7 15 15 15h121.8c0.4 0 0.9 0 1.3-0.1 0.2 0 0.5-0.1 0.7-0.1 0.3 0 0.5-0.1 0.8-0.1 0.2 0 0.5-0.1 0.7-0.2 0.2-0.1 0.5-0.1 0.7-0.2 0.2-0.1 0.4-0.1 0.6-0.2 0.3-0.1 0.5-0.2 0.8-0.3 0.2-0.1 0.4-0.2 0.5-0.2 0.3-0.1 0.5-0.2 0.8-0.4 0.2-0.1 0.3-0.2 0.5-0.3 0.3-0.1 0.5-0.3 0.8-0.5 0.2-0.1 0.4-0.3 0.6-0.5 0.2-0.1 0.4-0.3 0.5-0.4 0.4-0.3 0.8-0.6 1.1-1l95.6-95.5c2.3-2.3 3.8-5.3 4.2-8.4 0-0.2 0.1-0.3 0.1-0.5s0-0.4 0.1-0.6v-0.9-555.9c0-8.2-6.8-15-15-15z m-80.6 630.1v-44.4H585l-44.4 44.4zM419 404.8V202.6h187.1v525.7h-80.6c-8.3 0-15 6.7-15 15v80.6H419V404.8z" fill=""></path><path d="M743.4 202.6h187.1v202.1H743.4z" fill="#2E97FF"></path><path d="M960.5 744.5v-0.9-556c0-8.3-6.7-15-15-15H728.4c-8.3 0-15 6.7-15 15v651.3c0 8.3 6.7 15 15 15h121.8c0.4 0 0.9 0 1.3-0.1 0.2 0 0.5-0.1 0.7-0.1 0.3 0 0.5-0.1 0.8-0.1 0.2 0 0.5-0.1 0.7-0.2 0.2-0.1 0.5-0.1 0.7-0.2 0.2-0.1 0.4-0.1 0.6-0.2 0.3-0.1 0.5-0.2 0.8-0.3 0.2-0.1 0.4-0.2 0.5-0.2 0.3-0.1 0.5-0.2 0.8-0.4 0.2-0.1 0.3-0.2 0.5-0.3 0.3-0.1 0.5-0.3 0.8-0.5 0.2-0.1 0.4-0.3 0.6-0.5 0.2-0.1 0.4-0.3 0.5-0.4 0.4-0.3 0.8-0.6 1.1-1l95.6-95.5c2.3-2.3 3.8-5.3 4.2-8.4 0-0.2 0.1-0.3 0.1-0.5v-0.5zM865 802.7v-44.4h44.4L865 802.7zM743.4 404.8V202.6h187.1v525.7H850c-8.3 0-15 6.7-15 15v80.6h-91.5V404.8z" fill=""></path></svg>

Jietu20210717-213748

生成字体


.iconfont {
    font-family: "iconfont";
    font-size: 16px;
    font-style: normal;
}
.icon-other:before {
    content: "\6c7e0";
}

<span class="iconfont icon-other"> aaa</span>
Baiang commented 3 years ago

问题找到了,String.fromCodePoint() 这个方法在处理比较大的数字时候,处理的有问题。是不是可以进行这样的判断,如果是纯数字直接转 16 进制,如果是汉字,再进行使用 String.fromCodePoint() 进行转换到 unicode