Example #1
0
 def test_multiline_lr(self):
     font = ImageFont.load_default()
     td = TextDraw('Hello\nWorld', font, placement='lr')
     img = Image.new('RGB', (100, 100))
     draw = ImageDraw.Draw(img)
     total_box, boxes = td.text_boxes(draw, (100, 100))
     eq_(total_box, (65, 70, 95, 95))
     eq_(boxes, [(65, 70, 95, 81), (65, 84, 95, 95)])
Example #2
0
 def test_multiline_center(self):
     font = ImageFont.load_default()
     td = TextDraw('Hello\nWorld', font, placement='cc')
     img = Image.new('RGB', (100, 100))
     draw = ImageDraw.Draw(img)
     total_box, boxes = td.text_boxes(draw, (100, 100))
     eq_(total_box, (35, 38, 65, 63))
     eq_(boxes, [(35, 38, 65, 49), (35, 52, 65, 63)])
Example #3
0
 def test_ul(self):
     font = ImageFont.load_default()
     td = TextDraw('Hello', font)
     img = Image.new('RGB', (100, 100))
     draw = ImageDraw.Draw(img)
     total_box, boxes = td.text_boxes(draw, (100, 100))
     eq_(total_box, boxes[0])
     eq_(len(boxes), 1)
Example #4
0
 def test_multiline_ul(self):
     font = ImageFont.load_default()
     td = TextDraw('Hello\nWorld', font)
     img = Image.new('RGB', (100, 100))
     draw = ImageDraw.Draw(img)
     total_box, boxes = td.text_boxes(draw, (100, 100))
     eq_(total_box, (5, 5, 35, 30))
     eq_(boxes, [(5, 5, 35, 16), (5, 19, 35, 30)])
Example #5
0
 def test_multiline_center(self):
     font = ImageFont.load_default()
     td = TextDraw('Hello\nWorld', font, placement='cc')
     img = Image.new('RGB', (100, 100))
     draw = ImageDraw.Draw(img)
     total_box, boxes = td.text_boxes(draw, (100, 100))
     eq_(total_box, (35, 38, 65, 63))
     eq_(boxes, [(35, 38, 65, 49), (35, 52, 65, 63)])
Example #6
0
 def test_multiline_lr(self):
     font = ImageFont.load_default()
     td = TextDraw('Hello\nWorld', font, placement='lr')
     img = Image.new('RGB', (100, 100))
     draw = ImageDraw.Draw(img)
     total_box, boxes = td.text_boxes(draw, (100, 100))
     eq_(total_box, (65, 70, 95, 95))
     eq_(boxes, [(65, 70, 95, 81), (65, 84, 95, 95)])
Example #7
0
 def test_multiline_ul(self):
     font = ImageFont.load_default()
     td = TextDraw('Hello\nWorld', font)
     img = Image.new('RGB', (100, 100))
     draw = ImageDraw.Draw(img)
     total_box, boxes = td.text_boxes(draw, (100, 100))
     eq_(total_box, (5, 5, 35, 30))
     eq_(boxes, [(5, 5, 35, 16), (5, 19, 35, 30)])
Example #8
0
 def test_ul(self):
     font = ImageFont.load_default()
     td = TextDraw('Hello', font)
     img = Image.new('RGB', (100, 100))
     draw = ImageDraw.Draw(img)
     total_box, boxes = td.text_boxes(draw, (100, 100))
     eq_(total_box, boxes[0])
     eq_(len(boxes), 1)
Example #9
0
 def test_unicode(self):
     font = ImageFont.load_default()
     td = TextDraw(u'Héllö\nWørld', font, placement='cc')
     img = Image.new('RGB', (100, 100))
     draw = ImageDraw.Draw(img)
     total_box, boxes = td.text_boxes(draw, (100, 100))
     eq_(total_box, (35, 38, 65, 63))
     eq_(boxes, [(35, 38, 65, 49), (35, 52, 65, 63)])
Example #10
0
 def test_unicode(self):
     font = ImageFont.load_default()
     td = TextDraw(u'Héllö\nWørld', font, placement='cc')
     img = Image.new('RGB', (100, 100))
     draw = ImageDraw.Draw(img)
     total_box, boxes = td.text_boxes(draw, (100, 100))
     eq_(total_box, (35, 38, 65, 63))
     eq_(boxes, [(35, 38, 65, 49), (35, 52, 65, 63)])
Example #11
0
 def test_unicode(self):
     font = ImageFont.load_default()
     td = TextDraw(u'Héllö\nWørld', font, placement='cc')
     img = Image.new('RGB', (100, 100))
     draw = ImageDraw.Draw(img)
     total_box, boxes = td.text_boxes(draw, (100, 100))
     if PY3:
         raise SkipTest('unicode handling for default font differs on PY3')
     eq_(total_box, (35, 38, 65, 63))
     eq_(boxes, [(35, 38, 65, 49), (35, 52, 65, 63)])
Example #12
0
 def test_unicode(self):
     font = ImageFont.load_default()
     td = TextDraw(u'Héllö\nWørld', font, placement='cc')
     img = Image.new('RGB', (100, 100))
     draw = ImageDraw.Draw(img)
     total_box, boxes = td.text_boxes(draw, (100, 100))
     if PY3:
         raise SkipTest('unicode handling for default font differs on PY3')
     eq_(total_box, (35, 38, 65, 63))
     eq_(boxes, [(35, 38, 65, 49), (35, 52, 65, 63)])