Actually load the values for screenshot text, etc. correctly from the config. Pass them into draw_text which doesn't have them readily available.
This commit is contained in:
parent
b14c12c609
commit
1ac3851065
4 changed files with 42 additions and 19 deletions
17
dcc/text.py
17
dcc/text.py
|
@ -4,12 +4,12 @@ import wand.drawing
|
|||
import wand.image
|
||||
|
||||
|
||||
def draw_text(img, text, font_size=64):
|
||||
def draw_text(img, text, font, text_fill, text_stroke, font_size=64):
|
||||
with wand.drawing.Drawing() as draw:
|
||||
draw.font = self.thumbnail_font
|
||||
draw.font = font
|
||||
draw.font_size = font_size
|
||||
draw.fill_color = wand.color.Color(self.thumbnail_text_fill)
|
||||
draw.stroke_color = wand.color.Color(self.thumbnail_text_stroke)
|
||||
draw.fill_color = wand.color.Color(text_fill)
|
||||
draw.stroke_color = wand.color.Color(text_stroke)
|
||||
draw.stroke_width = font_size * 5 / 32
|
||||
draw.text_interline_spacing = -font_size / 4
|
||||
draw.text(5, int(draw.font_size) + 5, text)
|
||||
|
@ -34,9 +34,14 @@ class Text(dcc.doom_base.WadMap):
|
|||
text = "{}\n{}".format(text, parsed_args.demotype)
|
||||
with wand.image.Image(
|
||||
height=self.thumbnail_height,
|
||||
width=self.thumbnail_height
|
||||
width=self.thumbnail_width
|
||||
) as img:
|
||||
draw_text(img, text)
|
||||
draw_text(
|
||||
img, text,
|
||||
self.thumbnail_font,
|
||||
self.thumbnail_text_fill,
|
||||
self.thumbnail_text_stroke
|
||||
)
|
||||
img.trim()
|
||||
img.reset_coords()
|
||||
img.save(filename=self.text_thumb_path())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue