How to antialias SVG text in Firefox

时间秒杀一切 提交于 2019-12-20 14:06:06

问题


Does anyone know the best way to anti-alias svg text that will work in Firefox?

I tried text-antialias:true but this has no effect, and also I tried using a stroke paint but this just thickens up the font and is not what I like.

Example:

<!DOCTYPE html>
<html>
<body>
<svg height="100" width="500">
<text y="50" x="250" text-anchor="middle" style="font-size: 40px" >Hello</text>
</svg>
</body>
</html>

I have uploaded this to http://jsfiddle.net/KJhrY/

This example appears antialiased in IE9 on my PC (Windows)


回答1:


Firefox 25 will have support for the mox-osx-font-smoothing attribute!

So for firefox 25 you can use:

.yourclass{
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

Firefox 25 will probably be released somewhere at the end of Oktober was released on 2013-10-29.
Nightly builds can be found at http://nightly.mozilla.org/




回答2:


Try "text-rendering" attribute.
text-rendering = "optimizeLegibility"



来源:https://stackoverflow.com/questions/14409647/how-to-antialias-svg-text-in-firefox

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!