View Full Version : HTML5 Text Canvas in variable

11-22-2012, 10:08 PM
I am writing text on Canvas. I want to know if the font can be placed in variable?

For example you want the text to be italic, 30pt in size and Arial as font family, so the code is like this:

context.font = 'italic 30pt Arial';

What I want is to place the font-style, size and family in variables, so I tried this:

var style = 'italic';
var size = '30pt';
var family = 'Arial'

context.font = 'style size family';

It does not work I think...

11-22-2012, 10:35 PM
Already tackled. Forgot to remove quotes.