ForkAwesome font converted for CircuitPython

ForkAwesome is a fork of the last permissively (OSL) licensed version of FontAwesome. The project doesn't seem to be too active, but I thought it would be interesting and possibly useful to convert the font into the "pcf" format usable by CircuitPython! So here they are, in a range of bitmap sizes from 12 to 72. Unfortunately, some changes are needed to Adafruit_CircuitPython_DisplayLabel before it will work, because these fonts lack the letter "M", which is assumed to be in any font. See this pull request for the status of that change. (it also requires a recently updated Adafruit_CircuitPython_Bitmap_Font, because support for binary "pcf" fonts is pretty new)

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.pcf185.4kB
forkawesome-14.pcf191.4kB
forkawesome-16.pcf199.9kB
forkawesome-18.pcf208.5kB
forkawesome-20.pcf220.1kB
forkawesome-24.pcf259.6kB
forkawesome-28.pcf331.6kB
forkawesome-32.pcf364.7kB
forkawesome-36.pcf399.3kB
forkawesome-42.pcf466.4kB
forkawesome-48.pcf569.8kB
forkawesome-56.pcf740.5kB
forkawesome-64.pcf858.8kB
forkawesome-72.pcf1.0MB
forkawesome.ttf213.2kB
icons.py16.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