-
Notifications
You must be signed in to change notification settings - Fork 1
/
dataclasses.py
32 lines (24 loc) · 1.09 KB
/
dataclasses.py
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
27
28
29
30
31
32
from typing import Tuple, Iterable, Optional
class Metadata:
def __init__(self, number: int, ascii_value: int, font_name: str) -> None:
self.number = number
self.ascii_value = ascii_value
self.font_name = font_name
# Store the character represented by the metadata for debugging purposes
self.character = chr(ascii_value)
def __str__(self) -> str:
return 'Metadata:{number: ' + str(self.number) \
+ ', ascii_value: ' + str(self.ascii_value) \
+ ', font_name: ' + self.font_name \
+ ', character: ' + self.character + '}'
class Glyph:
def __init__(self, number: int, left: int, right: int, coordinates: Iterable[Optional[Tuple[int, int]]]):
self.number = number
self.left = left
self.right = right
self.coordinates = coordinates
def __str__(self) -> str:
return 'Glyph:{number: ' + str(self.number) \
+ ', left: ' + str(self.left) \
+ ', right: ' + str(self.right) \
+ ', coordinates: ' + str(self.coordinates) + '}'