Canvas:Text: Difference between revisions

From MozillaWiki
Jump to navigation Jump to search
No edit summary
 
Line 11: Line 11:
Do we need measureText?
Do we need measureText?


fontStyle: <tt>"Helvetica,Arial,sans" 12pt bold</tt>, <tt>Courier 16pt bold italic</tt>.  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?).
fontStyle: <tt>"Helvetica,Arial,sans" 12pt bold</tt>, <tt>Courier 16pt bold italic</tt>.  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?).
 
* 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.

Revision as of 05:10, 4 March 2006

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?).

  • 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.