I am trying to use the print command, mentioned in the documentation for Raphael, to, well, print text with a nice font. [I see that this can be done nicely using the "text" function, and I see examples on the web using fonts generated by Cufon with the print function (as in these examples for 'text' and 'print'), but what I'm doing is as close as I can make it to the example in the documentation and does not work for me, and I'd like to know why.]
Here's my code:
<html>
<head>
<title>Raphael Print Test</title>
<script src="raphael.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" charset="utf-8">
window.onload = function() {
var paper = new Raphael('holder', 640, 480);
paper.ellipse(320, 240, 320, 240).attr({stroke: "grey"});
paper.print(100, 100, "Test string", paper.getFont("Times", 800), 30);
paper.text(50, 50, "Raphaël\nkicks\nbutt!");
}
</script>
<style type="text/css">
#holder { width: 640px; height: 480px; border: 2px solid #aaa; }
</style>
</head>
<body>
<div id="holder"></div>
</body>
</html>
The important line is:
paper.print(100, 100, "Test string", paper.getFont("Times", 800), 30);
When I try it (in Chrome and Opera on OS X, so far) I get:
- a white area to draw on
- a grey ellipse
- the text "Raphaël\nkicks\nbutt!"
but I do not see: "Test string" anywhere.
I am using Raphael v 1.4.7 (which I thought was current as of yesterday, but I see that a version 1.5.2 is now out).