Last active
May 31, 2016 06:34
-
-
Save yaquawa/f8ba98f2c538f4511666de5b80f421d8 to your computer and use it in GitHub Desktop.
This file contains 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
function extract_characters_by_font(font_name) { | |
var allElems = document.querySelectorAll('*'); | |
var characters = Array.prototype | |
.filter.call(allElems, function (elem) { | |
var fonts = getComputedStyle(elem)['font-family'].split(',').map(function(font){ | |
return font.trim().replace(/'/g,''); | |
}); | |
return fonts.indexOf(font_name) > -1; | |
}) | |
.map(function (elem) { | |
return elem.innerText.trim(); | |
}) | |
.join('') | |
.replace(/\s/g, '') | |
.split(''); | |
var charactersString = Array.from(new Set(characters)).join(''); | |
return charactersString; | |
} | |
var font_name = '07YasashisaAntique'; | |
copy(extract_characters_by_font(font_name)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment