Getting the helloworld example from the Cairo FAQ going was reletivly simple. But JSEXT provides something better, an OO wrapper for the Cairo library. Granted I did have to check the source out from SVN and compile it to get them, and then sort out a couple of minor bugs in the wrapper.
Anyway the following code is a slight modification of the basic example. This script is intended to be accessed from a web browser as title.jsx?"Insert your text here" and yes it works perfectly fine if you set the src attribute of an img tag.
this.responseHeaders.contentType = "image/png";
var surf = new JSEXT1.Cairo.Surface.image("ARGB32", 800, 80);
var cr = surf.context();
selectFontFace("serif", "normal", "bold");
fontSize = 32;
source = [0, 0, 1];