Lets say I have camera-retro icon with unicode: '\uf083'. Now camera-retro icon in FontAwesome has unicode of '\f083'. How would I get the original unicode of camera-retro icon from FontAwesome icon?
Here is the example that shows generating SVG element with font-awesome. As you can see it only works with original unicode. That's why I need to get the original unicode, not the font-awesome one DEMO
I am able to get the FontAwesome unicode with this function:
function faUnicode(name) {
var testI = document.createElement('i');
var char;
testI.className = 'fa ' + name;
document.body.appendChild(testI);
char = window.getComputedStyle( testI, ':before' )
.content.replace(/'|"/g, '');
testI.remove();
return char.charCodeAt(0);
}
But as I said, I need to get the original unicode of that icon. Any ideas? Basically in return I want String like '\uf083';
replace the last line with:
return "\\u" + char.charCodeAt(0).toString(16)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With