151
edits
(→API) |
(add my humble opinion, some minor wiki markup changes.) |
||
Line 1: | Line 1: | ||
= Text in Canvas = | = Text in Canvas = | ||
The < | The <code><canvas></code> spec currently lacks any methods for drawing text; this was done to simplify initial implementation. | ||
=== API === | === API === | ||
Line 11: | Line 11: | ||
Do we need measureText? (myk: yes, so that you can resize the canvas to the size of the text, which is useful when you're using the canvas as an object representation of some text, f.e. in the microsummary editor, about which read more below) | Do we need measureText? (myk: yes, so that you can resize the canvas to the size of the text, which is useful when you're using the canvas as an object representation of some text, f.e. in the microsummary editor, about which read more below) | ||
textStyle: [http://www.w3.org/TR/CSS21/fonts.html#font-shorthand CSS 2.1 "font" shorthand], e.g. "12pt bold Helvetica". Reading textStyle just returns the last string that was passed in. Defaults to whatever the user's default sans serif font is (maybe serif font? what's the default for text if no font is specified?). | <code>textStyle</code>: [http://www.w3.org/TR/CSS21/fonts.html#font-shorthand CSS 2.1 "font" shorthand], e.g. "12pt bold Helvetica". Reading textStyle just returns the last string that was passed in. Defaults to whatever the user's default sans serif font is (maybe serif font? what's the default for text if no font is specified?). | ||
drawText: draws textToDraw relative to the current origin transformation matrix, and fills with the current fillStyle. The current origin is the origin of the text baseline. | <code>drawText</code>: draws textToDraw relative to the current origin transformation matrix, and fills with the current fillStyle. The current origin is the origin of the text baseline. | ||
pathText: adds the glyphs of the given text to the current path. They can then be stroked/filled/clipped as normal. | <code>pathText</code>: adds the glyphs of the given text to the current path. They can then be stroked/filled/clipped as normal. | ||
* roc: You will be able to create a hidden IFRAME full of properly laid-out text with full CSS styling (plus MathML and whatever else), and draw that to a canvas --- but that won't use canvas fill/stroke. | * roc: You will be able to create a hidden IFRAME full of properly laid-out text with full CSS styling (plus MathML and whatever else), and draw that to a canvas --- but that won't use canvas fill/stroke. | ||
Line 40: | Line 40: | ||
* hixie: is drawing-text-along-a-path a requirement? | * hixie: is drawing-text-along-a-path a requirement? | ||
* taken: IMHO, if implements this as not a part of spec, mozilla should use custom context like opera, such as moz-2dtext. --[[User:Taken|Taken]] 04:56, 22 April 2006 (PDT) |
edits