js canvas text custom font
<html>
<head>
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap" rel="stylesheet">
</head>
<body>
<p>to use external fonts you must have them linked to the dom</p>
<canvas id="c" width="500" height="300"></canvas>
<script>
var c = document.getElementById("c");
var ctx = c.getContext("2d");
ctx.font = "40px Roboto";//notice that behind the px comes the font family name
ctx.fillText("hello world",40,40);
</script>
</body>
</html>
Also in HTML:
- js canvas text custom font
- how to make form not reload page
- excel number format hide values cheat sheet
- html create drop down list
- styled components attrs
- html to pdf react
- js variable html
- position property
- get city from location html
- button onclick
- chrome clear cache for one site
- jupyter notebook download as html without code
- html how to add jquery
- html div
- slider bar with value
- html video preload
- glyphicon in bootstrap 4.4
- how to insert a line in html
- foundation dropdown direction
- html set icon
- html disable drag image
- how to create a tab image gallery
- ul li html
- how to align text beside image in html