Implemented default font in assets-file
This commit is contained in:
parent
c51f9643f2
commit
a8cad34b32
2 changed files with 6 additions and 2 deletions
|
@ -15,6 +15,8 @@ sunriseicon = im_open(opath+'wi-sunrise.jpeg')
|
|||
sunseticon = im_open(opath+'wi-sunset.jpeg')
|
||||
windicon = im_open(opath+'wi-strong-wind.jpeg')
|
||||
|
||||
defaultfont = "Assistant-Regular.ttf"
|
||||
|
||||
datetime_locals = {
|
||||
"de" : "de_DE.UTF-8",
|
||||
"en" : "en_US.UTF-8"
|
||||
|
|
|
@ -1,14 +1,16 @@
|
|||
from DesignEntity import DesignEntity
|
||||
from PIL import ImageFont, ImageDraw, ImageOps
|
||||
from Assets import path
|
||||
from Assets import path, defaultfont
|
||||
|
||||
paddingcorrection = -5
|
||||
|
||||
class TextDesign (DesignEntity):
|
||||
"""Object that manages all information relevant to text
|
||||
and prints it to an image"""
|
||||
def __init__ (self, size, font = "Assistant-Regular.ttf", fontsize = 12, text = "", horizontalalignment = "left", verticalalignment = "top"):
|
||||
def __init__ (self, size, font = None, fontsize = 12, text = "", horizontalalignment = "left", verticalalignment = "top"):
|
||||
super(TextDesign, self).__init__(size, mask = True)
|
||||
if font is None:
|
||||
font = defaultfont
|
||||
self.font_family = font
|
||||
self.font_size = fontsize
|
||||
self.text = text
|
||||
|
|
Loading…
Reference in a new issue