简体   繁体   English

SVG圈子中的React-FontAwesome Unicode值

[英]React-FontAwesome unicode values in svg circle

I am trying to embed a font awesome icon inside svg circles via unicode values from the font awesome website inside <text> , but they fail to appear: 我试图通过<text>内真棒字体网站的unicode值在svg圈子中嵌入真棒字体图标,但它们无法显示:

在此处输入图片说明

for some reason which I don't understand, when I am using this unicode value( &#x2713 ) it does appear(but it's not the icon I need): 由于某些我不了解的原因,当我使用此unicode值( &#x2713 )时,它确实出现了(但不是我需要的图标):

在此处输入图片说明

Some code: 一些代码:

from the react component: 来自react组件:

       <g>
            <circle className="circle test-circle"
                key={index}
                cx={xScale(node.x)}
                cy={yScale(node.y)}
                r={node.r}
                fill={node.done === true ? colour : "grey"}
            />
            {node.done === true ? 
                <text id="chk" style={{fontFamily:'Font Awesome'}} x={xScale(node.x)-10} y={yScale(node.y)+10}>&#xf00c;</text>
                :
                <text id="chk" style={{fontFamily:'Font Awesome'}} x={xScale(node.x)-10} y={yScale(node.y)+10}>&#xf00c;</text>
            }

        </g>         

from the scss: 从scss:

text#chk {
    font-family: 'Font Awesome';
    content: "\f00c";
    font-size: 30px; 
}

What can cause this? 是什么原因造成的?

我发现了问题,字体家族是font-family='fontawesome'而不是'Font Awesome'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM