Total Complexity | 6 |
Total Lines | 30 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | from pathlib import Path |
||
2 | |||
3 | |||
4 | class Font: |
||
5 | """Font file used to render text onto an image.""" |
||
6 | |||
7 | DEFAULT = 'titilliumweb-black' |
||
8 | WATERMARK = 'tahoma-bold' |
||
9 | |||
10 | def __init__(self, path): |
||
11 | self._path = path |
||
12 | |||
13 | def __str__(self): |
||
14 | return self.name |
||
15 | |||
16 | def __bool__(self): |
||
17 | return self.name != self.DEFAULT |
||
18 | |||
19 | @property |
||
20 | def name(self): |
||
21 | return self._path.stem.lower().replace('_', '-') |
||
22 | |||
23 | @property |
||
24 | def path(self): |
||
25 | return str(self._path) |
||
26 | |||
27 | @path.setter |
||
28 | def path(self, value): |
||
29 | self._path = Path(value) |
||
30 |