1"""
2fonts.py
3========
4
5.. figure:: /_static/fonts.png
6 :align: center
7
8 Pages through all characters of four fonts on the Display.
9"""
10
11import utime
12from machine import Pin, SPI
13import gc9a01
14import tft_config
15
16import vga1_8x8 as font1
17import vga1_8x16 as font2
18import vga1_bold_16x16 as font3
19import vga1_bold_16x32 as font4
20
21
22def main():
23 tft = tft_config.config(tft_config.TALL)
24
25 tft.init()
26 tft.fill(gc9a01.BLACK)
27 utime.sleep(1)
28
29 while True:
30 for font in (font1, font2, font3, font4):
31 tft.fill(gc9a01.BLUE)
32 line = 0
33 col = 0
34 for char in range(font.FIRST, font.LAST):
35
36 tft.text(font, chr(char), col, line, gc9a01.WHITE, gc9a01.BLUE)
37
38 col += font.WIDTH
39 if col > tft.width() - font.WIDTH:
40 col = 0
41 line += font.HEIGHT
42
43 if line > tft.height() - font.HEIGHT:
44 utime.sleep(3)
45 tft.fill(gc9a01.BLUE)
46 line = 0
47 col = 0
48
49 utime.sleep(3)
50
51
52main()