In Font Awesome 4x I managed to set the cursor as an icon by changing it into a base-64 image url. Now in Font Awesome 5 it does not work any more.
I've found this solution, but it's not working here.
This is what I've tried.
var canvas = document.createElement("canvas");
canvas.width = 20;
canvas.height = 20;
var ctx = canvas.getContext("2d");
document.fonts.ready.then(function() {
ctx.font = "400 20px Font Awesome 5 Pro";
ctx.fillStyle = "red";
ctx.textAlign = "center";
ctx.textBaseline = "middle";
setTimeout(function() {
ctx.fillText("\uf2ed", 10, 10)
var dataURL = canvas.toDataURL('image/png')
$('#foo').css('cursor', 'url(' + dataURL + '), auto');
}, 200)
})
All I get is a black square 20x20
Is there anyone who knows how to get it done?