Skip to content

Commit ed16e1b

Browse files
authored
Merge pull request #42 from FoamyGuy/add_forkawesome_example
adding forkawesome example
2 parents 4b54dbb + d4eb8a4 commit ed16e1b

File tree

4 files changed

+846
-0
lines changed

4 files changed

+846
-0
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# SPDX-FileCopyrightText: 2021 Tim Cocks
2+
# SPDX-License-Identifier: MIT
3+
4+
"""
5+
This example uses addfruit_display_text.label to display fork awesome
6+
icons.
7+
8+
More info here: https://emergent.unpythonic.net/01606790241
9+
"""
10+
11+
import board
12+
from forkawesome_icons import microchip, python, terminal
13+
from adafruit_display_text import label
14+
from adafruit_bitmap_font import bitmap_font
15+
16+
# use built in display (PyPortal, PyGamer, PyBadge, CLUE, etc.)
17+
# see guide for setting up external displays (TFT / OLED breakouts, RGB matrices, etc.)
18+
# https://learn.adafruit.com/circuitpython-display-support-using-displayio/display-and-display-bus
19+
display = board.DISPLAY
20+
21+
font_file = "fonts/forkawesome-42.pcf"
22+
23+
# Set text, font, and color
24+
text = "{} {} {}".format(terminal, python, microchip)
25+
font = bitmap_font.load_font(font_file)
26+
color = 0xFF00FF
27+
28+
# Create the tet label
29+
text_area = label.Label(font, text=text, color=color)
30+
31+
# Set the location
32+
text_area.anchor_point = (0.5, 0.5)
33+
text_area.anchored_position = (display.width // 2, display.height // 2)
34+
35+
# Show it
36+
display.show(text_area)
37+
38+
while True:
39+
pass

examples/fonts/forkawesome-42.pcf

466 KB
Binary file not shown.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# SPDX-FileCopyrightText: 2018, Fork Awesome (https://forkawesome.github.io), with Reserved Font Name Fork Awesome.
2+
3+
# SPDX-License-Identifier: OFL-1.1-RFN

0 commit comments

Comments
 (0)