This class enables the use of (proportional) Adafruit_GFX library fonts with daggers micropython-ili9341 display driver.
Simply replace xglcd_font.py with gfx_font.py in your project — no other changes are required.
All existing functionality of ili9341.py remains fully compatible.
from ili9341 import Display, color565
from gfx_font import GfxFont
font = GfxFont("FreeSansBold24pt7b.h")
text = "Hello world!"
text_w = font.measure_text(text)
x = (320 - text_w) // 2
y = (240 - font.y_advance * font.scale) // 2
display.draw_text(x, y, text, font, color565(255, 255, 255), color565(255, 0, 0), False, False, 1)