The ttf file is also included in case you need to generate other sizes.
The font uses character codes starting at 0xf000, so using regular characters like "012" or "abc" won't show anything. Instead, to find the code of a character, visit the forkawesome website, click the icon you want, and look for the Unicode (f322 for the fa-python icon). Then, in your CircuitPython code, create a label with the text "\uf322" or chr(0xf322) and the FontAwesome font to show it:
from adafruit_bitmap_font.bitmap_font import load_font from adafruit_display_text.label import Label from displayio import Group font = load_font("/forkawesome-36.pcf") text = chr(0xf322) group = Group() label = Label(font=font, text=text, background_color=0x111111) label.anchor_point = (0, 0) label.anchored_position = (0,0) group.append(label) board.DISPLAY.show(group) while True: pass
You can also use the attachment icons.py as a reference for the character codes. The python identifiers are the same as the font's "id", except that "-" is replaced with "_","500px" is renamed to "fivehundredpx", and several names that are Python built in functions or reserved words have an underscore appended (file_, filter_, list_, map_, print_, try_).
Files currently attached to this page:
forkawesome-12.pcf | 185.4kB |
forkawesome-14.pcf | 191.4kB |
forkawesome-16.pcf | 199.9kB |
forkawesome-18.pcf | 208.5kB |
forkawesome-20.pcf | 220.1kB |
forkawesome-24.pcf | 259.6kB |
forkawesome-28.pcf | 331.6kB |
forkawesome-32.pcf | 364.7kB |
forkawesome-36.pcf | 399.3kB |
forkawesome-42.pcf | 466.4kB |
forkawesome-48.pcf | 569.8kB |
forkawesome-56.pcf | 740.5kB |
forkawesome-64.pcf | 858.8kB |
forkawesome-72.pcf | 1.0MB |
forkawesome.ttf | 213.2kB |
icons.py | 16.4kB |
Entry first conceived on 1 December 2020, 2:37 UTC, last modified on 28 December 2020, 22:06 UTC
Website Copyright © 2004-2024 Jeff Epler