File tree Expand file tree Collapse file tree 1 file changed +13
-11
lines changed
Expand file tree Collapse file tree 1 file changed +13
-11
lines changed Original file line number Diff line number Diff line change 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 ], ".." ))
119from 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+ message = "<3 Blinka"
16+
17+ font = bitmap_font .load_font (font_file )
1618
1719_ , height , _ , dy = font .get_bounding_box ()
18- font .load_glyphs (specimen )
20+ font .load_glyphs (message )
1921
2022for y in range (height ):
21- for c in specimen :
23+ for c in message :
2224 glyph = font .get_glyph (ord (c ))
2325 if not glyph :
2426 continue
You can’t perform that action at this time.
0 commit comments