131
rated 0 times
[
135]
[
4]
/ answers: 1 / hits: 19480
/ 16 Years ago, sun, april 5, 2009, 12:00:00
I've been experimenting with using the <canvas>
tag for drawing simple diagrams and charts, and so far it's pretty easy to work with. I have one issue thought. I can't figure out how to draw text on a <canvas>
in Safari. In Firefox 3.0, I can do this:
Chart.prototype.drawTextCentered = function(context, text, x, y, font, color) {
if (context.mozDrawText) {
context.save();
context.fillStyle = color;
context.mozTextStyle = font;
x -= 0.5 * context.mozMeasureText(text);
context.translate(x, y);
context.mozDrawText(text);
context.restore();
}
}
I've seen reference to a fillText()
method in Apple's Safari docs, but it doesn't appear to be supported in Safari 3.2. Is this just something that's currently missing, or is it some well-kept secret?
More From » safari