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