Extracted get_font function
This commit is contained in:
parent
2f53c639b5
commit
c51f9643f2
1 changed files with 5 additions and 2 deletions
|
@ -17,7 +17,7 @@ class TextDesign (DesignEntity):
|
||||||
|
|
||||||
def __finish_image__ (self):
|
def __finish_image__ (self):
|
||||||
self.__init_image__()
|
self.__init_image__()
|
||||||
self.__font__ = ImageFont.truetype(path + self.font_family, self.font_size)
|
self.__font__ = self.__get_font__()
|
||||||
pos = self.__pos_from_alignment__()
|
pos = self.__pos_from_alignment__()
|
||||||
ImageDraw.Draw(self.__image__).text(pos, self.text, fill=0, font=self.__font__)
|
ImageDraw.Draw(self.__image__).text(pos, self.text, fill=0, font=self.__font__)
|
||||||
|
|
||||||
|
@ -35,4 +35,7 @@ class TextDesign (DesignEntity):
|
||||||
elif self.vertical_alignment == "right":
|
elif self.vertical_alignment == "right":
|
||||||
x = int(self.size[0] - width)
|
x = int(self.size[0] - width)
|
||||||
|
|
||||||
return (x, y + paddingcorrection)
|
return (x, y + paddingcorrection)
|
||||||
|
|
||||||
|
def __get_font__(self):
|
||||||
|
return ImageFont.truetype(path + self.font_family, self.font_size)
|
Loading…
Reference in a new issue