Skip to content

Add font file check #19

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
Aug 13, 2019
Merged

Add font file check #19

merged 1 commit into from
Aug 13, 2019

Conversation

caternuson
Copy link
Contributor

oled_test.py (rst pin changed as needed)

import board
import digitalio
import adafruit_ssd1306

rst = digitalio.DigitalInOut(board.D22)

disp = adafruit_ssd1306.SSD1306_I2C(128, 64, board.I2C(), reset=rst, addr=0x3d)

disp.fill(0)
disp.fill_rect(5, 20, 30, 10, 1)
disp.text('hello world', 0, 0, 1)
disp.show()

CircuitPython

BAD Font File

Adafruit CircuitPython 4.1.0 on 2019-08-03; Adafruit Metro M4 Express with samd51j19
>>> import oled_test
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "oled_test.py", line 11, in <module>
  File "/lib/adafruit_framebuf.py", line 313, in text
  File "/lib/adafruit_framebuf.py", line 370, in __init__
RuntimeError: Invalid font file: font5x8.bin
>>> 

GOOD Font File

Adafruit CircuitPython 4.1.0 on 2019-08-03; Adafruit Metro M4 Express with samd51j19
>>> import oled_test
>>> 

Blinka

BAD Font File

pi@pizerow:~/oled_test $ python3 oled_test.py 
Traceback (most recent call last):
  File "oled_test.py", line 11, in <module>
    disp.text('hello world', 0, 0, 1)
  File "/home/pi/repos/Adafruit_CircuitPython_framebuf/adafruit_framebuf.py", line 313, in text
    self._font = BitmapFont()
  File "/home/pi/repos/Adafruit_CircuitPython_framebuf/adafruit_framebuf.py", line 370, in __init__
    raise RuntimeError("Invalid font file: " + font_name)
RuntimeError: Invalid font file: font5x8.bin
pi@pizerow:~/oled_test $

GOOD Font File

pi@pizerow:~/oled_test $ python3 oled_test.py 
pi@pizerow:~/oled_test $ 

@ladyada ladyada merged commit 8d7f44c into adafruit:master Aug 13, 2019
adafruit-adabot added a commit to adafruit/Adafruit_CircuitPython_Bundle that referenced this pull request Aug 21, 2019
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