X-Git-Url: https://git.ctpug.org.za/?a=blobdiff_plain;f=naja%2Fwidgets%2Ftext.py;h=1d9732e4ced817da97dbdb9207107a59c84394cb;hb=266660e05f9b1a834544f11674dc493217b6d80e;hp=4cc4272f7435d9a7bf16ef530a3c1bb004a29c7a;hpb=ae063f219281b426fc31f6fb4becec845ab4549a;p=naja.git diff --git a/naja/widgets/text.py b/naja/widgets/text.py index 4cc4272..1d9732e 100644 --- a/naja/widgets/text.py +++ b/naja/widgets/text.py @@ -170,7 +170,7 @@ class TextBoxWidget(TextWidget): def _wrapped_lines(self, image_map): def words_fit(words): words_line = ' '.join(words) - width = self.font.size(words_line)[0] + width = self.font.size(words_line)[0] * EIGHT_BIT_SCALE if width < self.box_width: return True elif len(words) == 1: @@ -226,6 +226,9 @@ class TextBoxWidget(TextWidget): x, y = self.padding, self.padding for line_surface in rendered_lines: + if self.centre: + x = (width - line_surface.get_rect().width) / 2 + x += self.padding self.surface.blit(line_surface, (x, y)) y += line_surface.get_rect().height for pos, img in image_map.items():