[whatwg] Canvas lack of drawString method

Gervase Markham gerv at mozilla.org
Wed Oct 25 02:06:19 PDT 2006


Stefan Haustein wrote:
> I think it is very important to be able to determine the rendered size 
> of the text.

Can't you determine the size from the accessible version you are 
doubtless creating inside the <canvas> element? ;-)

(This assumes that if you draw a string in 8px Monaco on a <canvas>, and 
do the same thing in a <span>, the span will have the same size as the 
canvas version. But that seems to make sense to me.)

> context.drawText(x,y,string); context.getFontAscent();
> context.getFontDescent();
> context.getFontLeading();

Hang on; can we even get these for existing text styled with CSS in web 
pages?

Gerv




More information about the whatwg mailing list