[whatwg] Text APIs on <canvas>

Ian Hickson ian at hixie.ch
Tue May 6 14:27:51 PDT 2008


On Tue, 6 May 2008, Mathieu HENRI wrote:
>
> I can't see any mention that support for Text is optional. Is it 
> reasonable with browsers approaching major releases ?

I don't understand.


> The TextMetrics MUST return have 2 Float readonly properties : the width 
> and height. The width alone is not enough.

The width isn't even the bounding box width, swo in fact even the width 
isn't what you typically want unless you're just laying out text side by 
side or doing something like centering it, which is what the current API 
is for. There is a note in the spec to the effect that the current metrics 
aren't enough; we'll add something in due course, once we know what people 
really need. (For typography purposes, what you want is the em box, the 
nominal layout width, and the font's default line-height. Currently the 
first two of these are available, but not the third.)


> The methods fillText() and strokeText() could have a 5th optional 
> boolean argument called wrapText ( false by default ) to specify if the 
> text should wrap or the font-size be decrease in case the text is wider 
> than maxWidth.

There is a note in the spec specifically indicating that multiline text 
will never be provided in this API. We will provide drawElement()-like 
APIs in preference at some point, if ever.


> It is unclear whether the transformations affect the text.

Step 6 says "Paint the hypothetical inline box as the shape given by the 
text's glyphs, as transformed by the current transformation matrix", do 
you have a suggestion for hwo to make it clearer?

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'



More information about the whatwg mailing list