Search code examples
jquerysvgjquery-svg

Using Font Awesome with jQuery SVG


With a little help from this question, I was able to show font awesome icons in static SVG. But our app uses jQuery SVG, and it doesn't seem to be allowing SVG escape characters. Here's a demo showing both running side by side:

http://jsfiddle.net/scruffles/m6Z7Y/4/

<text x="30" y="30">&#xf040</text>

Renders as a pencil, but

svg.text(g, 30, 30, '&#xf040');

renders as &#xf040


Solution

  • As per this answer, you should use svg.text(g, 30, 30, '\uf040'); instead.

    http://jsfiddle.net/mblase75/m6Z7Y/6/