Skip to content

Commit 046d431

Browse files
committed
change simpletest script to work with CPython and CircuitPython
1 parent ed16e1b commit 046d431

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

examples/bitmap_font_simpletest.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
11
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
22
# SPDX-License-Identifier: MIT
33

4-
# Call this with the font file as the command line argument.
4+
"""
5+
This example loads a font and uses it to print an
6+
ASCII art representation of the given string specimen
7+
"""
58

6-
import os
7-
import sys
8-
9-
# Add paths so this runs in CPython in-place.
10-
sys.path.append(os.path.join(sys.path[0], ".."))
119
from adafruit_bitmap_font import bitmap_font # pylint: disable=wrong-import-position
1210

13-
sys.path.append(os.path.join(sys.path[0], "../test"))
14-
font = bitmap_font.load_font(sys.argv[1])
15-
specimen = "Adafruit CircuitPython" if len(sys.argv) == 2 else sys.argv[2]
11+
# you can change this to a different bdf or pcf font file
12+
font_file = "fonts/LeagueSpartan-Bold-16.bdf"
13+
14+
# you can change the string that will get printed here
15+
specimen = "<3 Blinka"
16+
17+
font = bitmap_font.load_font(font_file)
1618

1719
_, height, _, dy = font.get_bounding_box()
1820
font.load_glyphs(specimen)

0 commit comments

Comments
 (0)