Saturday, 27 July 2013

How to use Font, Size, and Style in your HTML page through Canvas tag in html5 ?



<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
<style type="text/css">
    body {
        margin: 0px;
        padding: 0px;
      }
    </style>
</head>

<body>
     <canvas id="myCanvas" width="600" height="300"></canvas>
    <script>
      var canvas = document.getElementById('myCanvas');
      var context = canvas.getContext('2d');

      context.font = 'bold 40px Calibri';
      context.fillText('JUSTEFFECTS.com!', 150, 100);
    </script>
</body>
</html>