From dbf0fa7fc7520e33091d08ef7e8916e80ab8de30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alfonso=20S=C3=A1nchez-Beato?= Date: Thu, 20 Oct 2022 11:37:14 +0100 Subject: [PATCH] plugins: label-freetype: Fix font alignment label->width is used to calculate wrapping of lines and it is by default -1. We need to use label->area.width instead when aligning a line, as label->width might not have been set. --- src/plugins/controls/label-freetype/plugin.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/controls/label-freetype/plugin.c b/src/plugins/controls/label-freetype/plugin.c index bb29fc4c..ee66f46a 100644 --- a/src/plugins/controls/label-freetype/plugin.c +++ b/src/plugins/controls/label-freetype/plugin.c @@ -314,9 +314,9 @@ draw_control (ply_label_plugin_control_t *label, /* Start at start position (alignment) */ if (label->alignment == PLY_LABEL_ALIGN_CENTER) - pen.x += (label->width - width_of_line (label, cur_c)) << 5; + pen.x += (label->area.width - width_of_line (label, cur_c)) << 5; else if (label->alignment == PLY_LABEL_ALIGN_RIGHT) - pen.x += (label->width - width_of_line (label, cur_c)) << 6; + pen.x += (label->area.width - width_of_line (label, cur_c)) << 6; while (*cur_c && *cur_c != '\n') { /* TODO: Unicode support. */