keychord.py/fonts/convert_font.py

16 lines
526 B
Python

import os, sys
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import characters
import fontforge
font = fontforge.open("VictorMonoNerdFont-SemiBoldItalic.ttf")
font.selection.none()
for char in characters.get_character_set():
font.selection.select(("more",), ord(char))
font.selection.invert()
font.clear()
size = 32
font.selection.all()
font.bitmapSizes = ((size,),)
font.regenBitmaps((size,))
font.generate(f"VictorMonoNerdFont-SemiBoldItalic.bdf", bitmap_type="bdf", bitmap_resolution=96)