The current canvas context font and characteristics, in the manner of the CSS font property.
Property of apis/canvas/CanvasRenderingContext2Dapis/canvas/CanvasRenderingContext2D
Syntaxvar result = CanvasRenderingContext2D.font;
CanvasRenderingContext2D.font = value;
Return Value
Returns an object of type StringString
The font string can consist of any CSS font description and is analogous to the CSS font property. The default font is 10px sans-serif
. Values that are not CSS font values are ignored.
The following exaple write a sample string in the canvas
function draw() {
var ctx = document.getElementById('MyCanvas').getContext('2d');
ctx.font = "16px Times New Roman";
ctx.fillText("Lorem ipsum", 0, 30);
}
Related specifications
Microsoft Developer Network: Windows Internet Explorer API reference Article
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4