-
-
Save tzurbaev/14325ecf140c657c216dddc22a5f15e6 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
const opentype = require('opentype.js') | |
opentype.load('fonts/a106a7f0-cd46-4110-81ed-417957a52738.otf', (err, font) => { | |
if (err) { | |
console.error('Unable to load font!', { err }) | |
return | |
} | |
const map = { | |
one: 1, | |
two: 2, | |
three: 3, | |
four: 4, | |
five: 5, | |
six: 6, | |
seven: 7, | |
eight: 8, | |
nine: 9, | |
zero: 0, | |
} | |
const strings = [ | |
'ЩDTн', | |
'nЮR', | |
'УDЩ', | |
'SнC', | |
'УDR', | |
] | |
strings.forEach(item => { | |
const glyphs = font.stringToGlyphs(item) | |
const names = glyphs.map(glyph => glyph.name) | |
const value = names.map(value => map[value]) | |
console.log(`Original: "${item}", glyphs: "${names.join(', ')}", value: "${value.join('')}"`) | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment