Start to reorganize views a little.
[audio.git] / src / youtube / thumbnail.py
index a6cd9c5..42e8070 100644 (file)
@@ -44,6 +44,8 @@ def draw_version(img, d, context, get_font_path):
         if item.get('vskip'):
             cursor += item['vskip']
         text = item['text'].format(**context)
+        if not text:
+            continue
         if item.get('uppercase'):
             text = text.upper()
         font = ImageFont.truetype(get_font_path(item['font-family']), item['font-size'])
@@ -53,6 +55,7 @@ def draw_version(img, d, context, get_font_path):
             realheight = draw.textsize(line, font=font)[1]
             if cursor + realheight > newimg.size[1]:
                 return False
+            draw.text((0, cursor), line, font=font, fill=item.get('color'))
             cursor += item['line-height']
 
     img.paste(newimg, (d.get('x', 0), d.get('y', 0)), newimg)