summaryrefslogtreecommitdiff
path: root/txtgameengine/fonts.py
blob: 60660d645d903122a4843ba44a963ea1454ba341 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
from abc import ABC
from dataclasses import dataclass
from typing import Optional


class Font(ABC):
    def get_glyph(self, char: str) -> Optional['Glyph']:
        raise NotImplementedError()

    @property
    def font(self):
        raise NotImplementedError()


@dataclass
class Glyph:
    font: 'Font'
    x_texture_offset: int
    y_texture_offset: int
    x_width: int
    y_width: int


class MonospacedFont(Font):
    def get_glyph(self, char: str):
        pass