Skip to content

Commit 9a062c9

Browse files
authored
Merge pull request #50 from adafruit/patch-fix
Linted
2 parents ab64389 + 026f8f2 commit 9a062c9

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

adafruit_bitmap_font/bitmap_font.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,19 +33,19 @@ def load_font(filename, bitmap=None):
3333
import displayio
3434

3535
bitmap = displayio.Bitmap
36-
font_file = open(filename, "rb")
37-
first_four = font_file.read(4)
38-
if filename.endswith("bdf") and first_four == b"STAR":
39-
from . import bdf
36+
with open(filename, "rb") as font_file:
37+
first_four = font_file.read(4)
38+
if filename.endswith("bdf") and first_four == b"STAR":
39+
from . import bdf
4040

41-
return bdf.BDF(font_file, bitmap)
42-
if filename.endswith("pcf") and first_four == b"\x01fcp":
43-
from . import pcf
41+
return bdf.BDF(font_file, bitmap)
42+
if filename.endswith("pcf") and first_four == b"\x01fcp":
43+
from . import pcf
4444

45-
return pcf.PCF(font_file, bitmap)
46-
if filename.endswith("ttf") and first_four == b"\x00\x01\x00\x00":
47-
from . import ttf
45+
return pcf.PCF(font_file, bitmap)
46+
if filename.endswith("ttf") and first_four == b"\x00\x01\x00\x00":
47+
from . import ttf
4848

49-
return ttf.TTF(font_file, bitmap)
49+
return ttf.TTF(font_file, bitmap)
5050

5151
raise ValueError("Unknown magic number %r" % first_four)

0 commit comments

Comments
 (0)