diff options
Diffstat (limited to 'src/sliceitoff/text/fonts.py')
-rw-r--r-- | src/sliceitoff/text/fonts.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/sliceitoff/text/fonts.py b/src/sliceitoff/text/fonts.py index a1687b6..af9aefb 100644 --- a/src/sliceitoff/text/fonts.py +++ b/src/sliceitoff/text/fonts.py @@ -1,15 +1,17 @@ +""" text.fonts - .FNT file loading and storing """ import os import pygame DEBUG = os.getenv("DEBUG") class Fonts: + """ Fonts - static class to store loaded fonts """ fonts = {} @staticmethod def load_fonts(base_path): filename_fontlist = os.path.join(base_path, "assets", "fonts.lst") - with open( filename_fontlist ) as fontlist_file: + with open(filename_fontlist, "r", encoding="utf-8") as fontlist_file: for line in fontlist_file: name, *path = line.strip().split() filename = os.path.join(base_path, *path) @@ -18,6 +20,7 @@ class Fonts: class Font: + """ Font - font surfaces to be loaded from file """ def __init__(self, filename, height = 16): if DEBUG: print(f"Loading font {filename = }") @@ -34,6 +37,7 @@ class Font: surface.set_at((bit,line),"white") byte <<= 1 self.surfaces.append(surface) - + def get(self, ch): + """ Just get surface of the font size 8x16 max """ return self.surfaces[ch%256] |