Matthew James Davis
Matthew James Davis

Reputation: 12295

UTF8 icons in canvas

I would like to render

http://www.utf8icons.com/character/61505/UTF-8-character

Onto a canvas context. Is this an option?

Upvotes: 0

Views: 1327

Answers (2)

user663031
user663031

Reputation:

What's the problem? It's just another character. There's no need to use fromCharCode at all. Just put the character in your code:

ctx.fillText(""...

Or, maybe if your editor doesn't support entry or display of such characters, then you'd prefer

ctx.filltext("\uF041",

Upvotes: 1

Loktar
Loktar

Reputation: 35319

One method is to use String.fromCharCode

var canvas = document.getElementById("canvas"),
    ctx = canvas.getContext("2d");

canvas.width = canvas.height = 200;

ctx.font="100px Arial";
ctx.fillText(String.fromCharCode(61505), 50,100);

Live Demo

Upvotes: 0

Related Questions