Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions discover_overlay/voice_overlay.py
Original file line number Diff line number Diff line change
Expand Up @@ -862,6 +862,12 @@ def draw_text(self, context, string, pos_x, pos_y,
if font:
font = Pango.FontDescription(font)
layout.set_font_description(font)

if self.align_right:
layout.set_alignment(Pango.Alignment.RIGHT)
else:
layout.set_alignment(Pango.Alignment.LEFT)

(ink_rect, logical_rect) = layout.get_pixel_extents()
text_height = logical_rect.height
text_width = logical_rect.width
Expand All @@ -883,10 +889,9 @@ def draw_text(self, context, string, pos_x, pos_y,

self.col(tx_col)
context.move_to(
pos_x - text_width - self.text_pad - ink_rect.x,
(pos_x - self.text_pad) - (ink_rect.x + ink_rect.width),
pos_y + text_y_offset
)
layout.set_alignment(Pango.Alignment.RIGHT)
PangoCairo.show_layout(self.context, layout)
else:
context.move_to(0, 0)
Expand All @@ -901,10 +906,9 @@ def draw_text(self, context, string, pos_x, pos_y,

self.col(tx_col)
context.move_to(
pos_x + self.text_pad + avatar_size- ink_rect.x,
(pos_x + self.text_pad + avatar_size) - ink_rect.x,
pos_y + text_y_offset
)
layout.set_alignment(Pango.Alignment.LEFT)
PangoCairo.show_layout(self.context, layout)
context.restore()
return text_width
Expand Down