Ответ 1
Здесь, как рисовать шрифты Awsome шрифта на холсте html5:
-
Ссылка в шрифте Awesome:
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
-
Задайте шрифт контекста шрифтом Awesome:
// set the canvas context font-size and font-face context.font='14px FontAwesome';
-
Нарисуйте один из символов шрифта Awesome на холсте:
// specify the desired character code with the Unicode prefix (\u) context.fillText('\uF047',20,50);
Здесь пример кода и демонстрационный пример:
var canvas=document.getElementById("canvas");
var ctx=canvas.getContext("2d");
ctx.font='12px verdana';
ctx.fillText('Please wait for Font Awesome to load...',20,30);
// give font awesome time to load
setTimeout(start,2000);
function start(){
ctx.clearRect(0,0,canvas.width,canvas.height);
ctx.font='30px FontAwesome';
ctx.fillText('\uF047',20,50);
}
body{ background-color: ivory; }
#canvas{border:1px solid red; margin:0 auto; }
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
<script src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
<h4>Font Awesome glyph drawn onto html5 canvas</h4>
<canvas id="canvas" width=300 height=100></canvas>