34 lines
933 B
Python
34 lines
933 B
Python
import string
|
|
import glob
|
|
import csv
|
|
import fontforge
|
|
|
|
|
|
if __name__ == '__main__':
|
|
letters = string.ascii_letters
|
|
letters += string.digits
|
|
# letters += string.punctuation
|
|
# letters += 'абвгдеёжзийклмнопрстуфхцчшщъыьэюя'
|
|
# letters += 'АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ'
|
|
|
|
files = glob.glob('icons/*.svg')
|
|
|
|
font = fontforge.font()
|
|
font.encoding = 'UnicodeBMP'
|
|
font.familyname = 'Feather'
|
|
|
|
icon_index = 0
|
|
for letter in letters:
|
|
if icon_index < len(files):
|
|
print(letter, '\t', files[icon_index])
|
|
|
|
glyph = font.createMappedChar(letter)
|
|
# glyph = font.createChar(int(letter, 16))
|
|
glyph.importOutlines(files[icon_index])
|
|
# print(symbol[0], files[icon_index])
|
|
icon_index += 1
|
|
|
|
font.generate('testfont.ttf')
|
|
|
|
print('Total icons:', len(letters))
|