Skip to content

Add font_name to BitmapFont call for custom fonts #32

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 15, 2020

Conversation

xdmtk
Copy link
Contributor

@xdmtk xdmtk commented May 15, 2020

Hi all,

I've been using this package as part of the Adafruit_Python_SSD1306 package for few weeks now and I've been having issues making calls to the text drawing function using custom font paths (and consequently custom fonts as well).

As it is right now, any call made to adafruit_ssd1306.SSD1306_I2C.text() with or without a font_name= parameter specified expects a file font5x8.bin in the current working directory of the calling script despite what may be specified, rendering the font_name= keyword param useless.

After some digging it looks like the BitmapFont class is never instantiated with the font_name parameter, despite the BitmapFont class having a default parameter available to override. I have added the font_name parameter in the call to instantiate BitmapFont in this pull request, and it has fixed my build (allowing me to keep my font files out of the working directory of the active script).

Hopefully this pull request helps and this repo is still alive and well. Thanks

@ladyada
Copy link
Member

ladyada commented May 15, 2020

nice, we do recommend PILLOW for drawing fonts, the built in font is really minimal :)

@ladyada ladyada merged commit a098593 into adafruit:master May 15, 2020
adafruit-adabot added a commit to adafruit/Adafruit_CircuitPython_Bundle that referenced this pull request May 19, 2020
Updating https://github.com/adafruit/Adafruit_CircuitPython_DS1841 to 1.0.2 from 1.0.1:
  > fixing blinka example
  > Merge pull request adafruit/Adafruit_CircuitPython_DS1841#2 from adafruit/pylint-update
  > build.yml: add black formatting check

Updating https://github.com/adafruit/Adafruit_CircuitPython_RGB_Display to 3.9.3 from 3.9.2:
  > Merge pull request adafruit/Adafruit_CircuitPython_RGB_Display#80 from makermelissa/master
  > Merge pull request adafruit/Adafruit_CircuitPython_RGB_Display#79 from makermelissa/master

Updating https://github.com/adafruit/Adafruit_CircuitPython_BluefruitConnect to 1.1.2 from 1.1.1:
  > Merge pull request adafruit/Adafruit_CircuitPython_BluefruitConnect#21 from caternuson/example_update

Updating https://github.com/adafruit/Adafruit_CircuitPython_framebuf to 1.3.2 from 1.3.1:
  > Merge pull request adafruit/Adafruit_CircuitPython_framebuf#32 from xdmtk/xdmtk-patch/font-bug

Updating https://github.com/adafruit/Adafruit_CircuitPython_LED_Animation to 2.0.1 from 2.0.0:
  > Merge pull request adafruit/Adafruit_CircuitPython_LED_Animation#22 from kattni/comet-tail-exception

Updating https://github.com/adafruit/Adafruit_CircuitPython_PyBadger to 2.2.2 from 2.2.1:
  > Merge pull request adafruit/Adafruit_CircuitPython_PyBadger#32 from FoamyGuy/button_debouncer_example
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants