parent
eb968ec16f
commit
368ceb4373
@ -44,17 +44,19 @@ class display_playback(display):
|
||||
self.title = title
|
||||
|
||||
w,h = self.d.textsize(self.title, font=self.font_title)
|
||||
if (w > self.width):
|
||||
self.title += ". " # Wraparound for scrolling (pt1)
|
||||
self.title_scroll_max,h = self.d.textsize(self.title, font=self.font_title)
|
||||
self.title_scroll = self.title_scroll_max - 10
|
||||
self.title += self.title # Wraparound for scrolling (pt2)
|
||||
# Prerender
|
||||
if (w > self.width): # Check the text is short enough to be static
|
||||
self.title += "."
|
||||
w,h = self.d.textsize(self.title, font=self.font_title)
|
||||
self.title_img = Image.new('1', (w, h), color = not self.fg)
|
||||
w += 10 # Spacing between repetitions
|
||||
self.title_scroll_max = w
|
||||
self.title_scroll = self.title_scroll_max - 10
|
||||
# Prerender
|
||||
fw = w + self.width
|
||||
self.title_img = Image.new('1', (fw, h), color = not self.fg)
|
||||
font_shift = 5
|
||||
ImageDraw.Draw(self.title_img).text((0,-font_shift), self.title, font=self.font_title, fill=self.fg)
|
||||
self.title_img = self.title_img.crop((0,0,w,h-font_shift))
|
||||
self.title_img.paste(self.title_img, (w,0))
|
||||
self.title_img = self.title_img.crop((0,0,fw,h-font_shift))
|
||||
else:
|
||||
self.title_scroll = 0
|
||||
self.title_scroll_max = -1
|
||||
|
Loading…
Reference in New Issue
Block a user