modm-io / modm

modm: a C++23 library generator for AVR and ARM Cortex-M devices
https://modm.io
Mozilla Public License 2.0
720 stars 128 forks source link

[tools] Font generation with Python 3 #1154

Closed becseya closed 3 months ago

becseya commented 3 months ago

Script was not working with Python 3

Before

$ python2 font_export.py fonts/all_caps_3x5.font test
$ python font_export.py fonts/all_caps_3x5.font test
Traceback (most recent call last):
  File "/home/akos/repos/modm/tools/font_creator/font_export.py", line 229, in <module>
    font = read_font_file(filename)
  File "/home/akos/repos/modm/tools/font_creator/font_export.py", line 157, in read_font_file
    char.data[offset + index] |= 1 << (char_line_index % 8)
TypeError: list indices must be integers or slices, not float

After

$ python2 font_export.py fonts/all_caps_3x5.font test
$ python font_export.py fonts/all_caps_3x5.font test
salkinium commented 3 months ago

Actually: Could you add this script to here so that the CI will execute it with Python 3 and make sure it doesn't break again?

https://github.com/modm-io/modm/blob/d72efc71b4cd677e56bb8608214071d425c46a6d/.github/workflows/linux.yml#L120

becseya commented 3 months ago

@salkinium Sure thing