how to set font-size font-family

coure2011 picture coure2011 · Sep 20, 2010 · Viewed 16.7k times · Source

i have code like this but its not working

var t = r.text(100, 100, 'test');
t.attr({font-size: 16});

giving me error

missing : after property id

here is documentation for raphael.js http://raphaeljs.com/reference.html

Answer

C-Mo picture C-Mo · Sep 20, 2010

For attributes with a hyphen in the name, you need to use a string literal.

var t = r.text(100, 100, 'test');
t.attr({ "font-size": 16, "font-family": "Arial, Helvetica, sans-serif" });