-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtext.py
More file actions
19 lines (16 loc) · 797 Bytes
/
Copy pathtext.py
File metadata and controls
19 lines (16 loc) · 797 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
### ENUM OF AVAILABLE FONTS
from enum import Enum
from PIL import ImageFont
class Font(Enum):
BOLD = ImageFont.truetype('fonts/MyriadPro-Bold.otf', 130)
CONDENSED = ImageFont.truetype("fonts/MyriadPro-Cond.otf", 64)
BOLD_CONDENSED = ImageFont.truetype("fonts/MyriadPro-BoldCond.otf", 72)
BOLD_SMALL = ImageFont.truetype('fonts/MyriadPro-Bold.otf', 36)
### TEXT FORMATTING CLASS ###
class Text:
def __init__(self, text, position, font, colour=(0,0,0), anchor='lm') -> None:
self.text = text
self.position = position
self.font = font
self.colour = colour
self.anchor = anchor # https://pillow.readthedocs.io/en/stable/handbook/text-anchors.html