render icon font glyphs on a canvas element? - Javascript Canvas

Javascript examples for Canvas:Example

Description

render icon font glyphs on a canvas element?

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript" src="https://code.jquery.com/jquery-1.4.2.js"></script> 
      <style id="compiled-css" type="text/css">

@font-face {
   font-family: 'KulminoituvaRegular';
   src: url('http://www.miketaylr.com/f/kulminoituva.ttf');
}


      </style> 
      <script type="text/javascript">
    $(function(){/*w  w  w .  j  a  va 2 s. c  om*/
var ctx = document.getElementById('c').getContext('2d');
  ctx.font = '36px KulminoituvaRegular';
  ctx.fillStyle = 'black';
  ctx.textBaseline = 'top';
  ctx.fillText  ('Kulminoituva Regular', 10, 10);
    });

      </script> 
   </head> 
   <body> 
      <canvas id="c" width="500" height="500"></canvas>  
   </body>
</html>

Related Tutorials