Skip to content

Commit

Permalink
Merge pull request #42 from FoamyGuy/add_forkawesome_example
Browse files Browse the repository at this point in the history
adding forkawesome example
  • Loading branch information
jepler authored Apr 3, 2021
2 parents 4b54dbb + d4eb8a4 commit ed16e1b
Show file tree
Hide file tree
Showing 4 changed files with 846 additions and 0 deletions.
39 changes: 39 additions & 0 deletions examples/bitmap_font_label_forkawesome.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# SPDX-FileCopyrightText: 2021 Tim Cocks
# SPDX-License-Identifier: MIT

"""
This example uses addfruit_display_text.label to display fork awesome
icons.
More info here: https://emergent.unpythonic.net/01606790241
"""

import board
from forkawesome_icons import microchip, python, terminal
from adafruit_display_text import label
from adafruit_bitmap_font import bitmap_font

# use built in display (PyPortal, PyGamer, PyBadge, CLUE, etc.)
# see guide for setting up external displays (TFT / OLED breakouts, RGB matrices, etc.)
# https://learn.adafruit.com/circuitpython-display-support-using-displayio/display-and-display-bus
display = board.DISPLAY

font_file = "fonts/forkawesome-42.pcf"

# Set text, font, and color
text = "{} {} {}".format(terminal, python, microchip)
font = bitmap_font.load_font(font_file)
color = 0xFF00FF

# Create the tet label
text_area = label.Label(font, text=text, color=color)

# Set the location
text_area.anchor_point = (0.5, 0.5)
text_area.anchored_position = (display.width // 2, display.height // 2)

# Show it
display.show(text_area)

while True:
pass
Binary file added examples/fonts/forkawesome-42.pcf
Binary file not shown.
3 changes: 3 additions & 0 deletions examples/fonts/forkawesome-42.pcf.license
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# SPDX-FileCopyrightText: 2018, Fork Awesome (https://forkawesome.github.io), with Reserved Font Name Fork Awesome.

# SPDX-License-Identifier: OFL-1.1-RFN
Loading

0 comments on commit ed16e1b

Please sign in to comment.