Canvas:Text

From MozillaWiki
Revision as of 09:20, 2 March 2006 by VladVukicevic (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Text in Canvas

The <canvas> spec currently lacks any methods for drawing text; this was done to simplify initial implementation.

...

string fontStyle;
void drawText(in string textToDraw, in float x, in float y);
void measureText(in string textToMeasure, out float width, out float height);

Do we need measureText?

fontStyle: "Helvetica,Arial,sans" 12pt bold, Courier 16pt bold italic. Only options: family, size, bold, italic. Not interested in general CSS; use CSS in conjunction with HTML for that. Reading fontStyle 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?).