def draw(self, cr, pos, text_width):
self.strip()
width = sum([box.width for box in self.boxes])
# Center lines not equal to text width.
if not math.isclose(width, text_width):
pos.x -= (text_width - width)/2
for box in self.boxes:
# We start drawing from the right edge of the text block,
# and move to the left, thus the subtraction instead of
# addition below.
pos.x -= box.width
box.draw(cr, pos)
评论列表
文章目录