Last active
December 15, 2015 05:29
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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
PUA: http://en.wikipedia.org/wiki/Mapping_of_Unicode_characters#Private_use_characters