Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to antialias SVG text in Firefox

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)

like image 586
Martin Capodici Avatar asked Jan 19 '13 00:01

Martin Capodici


2 Answers

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/

like image 179
Tieme Avatar answered Sep 17 '22 15:09

Tieme


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

like image 45
defghi1977 Avatar answered Sep 17 '22 15:09

defghi1977