I think the best way would be to use the HTML5 API and then using the HTMLCanvasElement.toDataURL() function to convert the canvas to a image.
In this link you can see how select a font family, size and color and add it to a canvas. - w3schools.com/canvas/canvas_text.asp
Here is a quick example in JsFiddle of what you want