canvas draw text problem
If I execute the following code the text is shown bad (it seems not aliased) and not ri开发者_如何学JAVAght aligned why?
context.textBaseline = "top";
context.textAlign = "right";
context.fillStyle = "#F00";
context.font = "italic 30tpx sans-serif";
context.fillText("Lorem ipsum dolor sit amet", 50, 50);
I'm using FF 3.6...
I think Firefox doesn't know what you mean by "30tpx" and is ignoring your style. Also if you align right most of the text will be off the left of the screen -- maybe you mean to align right? Try this
contexto.textAlign = "left";
contexto.fillStyle = "#F00";
contexto.font = "italic 30px sans-serif";
When you align right it draws the text from right to left, with the text ending at the x coordinate.
I you look at this example you can see how the different text align settings draw text in relation to the x coordinate. I've included you code as well.
精彩评论