commit 9df4f752f172b0b9598fefcb4c347e1c7d801ffb Author: Dreaded_X Date: Thu Jan 14 02:30:15 2021 +0100 Created tool diff --git a/convert-font.py b/convert-font.py new file mode 100755 index 0000000..743b504 --- /dev/null +++ b/convert-font.py @@ -0,0 +1,27 @@ +#!/usr/bin/env python3 +import imageio +import math + +asci = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~" +font = "font.png" + +im = imageio.imread(font) + +for c in asci: + + base_x = (ord(c) % 16) * 16 + base_y = math.floor(ord(c)/16) * 16 + + n = 0 + for y in range(16): + n = n << 16 + k = 0 + for x in range(16): + d = im[base_y + y][base_x + x][0] + k = k << 1 + if d == 255: + k = k + 1 + + n = n + k + + print("assign char_data[{:2}] = 256'h{:064x}; // {}".format(ord(c)-32, n, c)) diff --git a/font.png b/font.png new file mode 100644 index 0000000..4ef4e2a Binary files /dev/null and b/font.png differ