Skip to content

Instantly share code, notes, and snippets.

@rocktronica
Last active December 15, 2015 05:29
Show Gist options
  • Save rocktronica/5209316 to your computer and use it in GitHub Desktop.
Save rocktronica/5209316 to your computer and use it in GitHub Desktop.
Makes Fontello's "Edit Codes" start at the beginning-ish of the PUA
// Referencing http://en.wikibooks.org/wiki/Unicode/Character_reference/E000-EFFF
var getPuaUnicode = (function() {
var PUA = [];
var get0toF = function(i) {
return "0123456789abcdef"[i];
};
for (var i = 0; i <= 15; i++) {
for (var ii = 0; ii <= 15; ii++) {
for (var iii = 0; iii <= 15; iii++) {
PUA.push("e" + get0toF(i) + get0toF(ii) + get0toF(iii));
}
}
}
return function(i) {
return PUA[i];
}
}());
// And then run this in Fontello > Customize Codes
(function() {
var count = 0,
offset = 100; // avoids mapping over Apple emoji
$(".result-glyph").find("[data-bind='value: customHex']").each(function(i) {
$(this).val(getPuaUnicode(offset + i)).trigger("change");
count++;
});
alert("Done, thanks. Changed " + count + " codes.");
}());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment